Page 1 of 1

Restart script

Posted: Mon Jul 14, 2003 10:21 pm
by elgaucho
Ok.... need some help here!

Dows anyone know what the "restart" command is in scripting? as in the equivalent of restart in rcon?

I have a small problem i'm trying to solve.... Scores don't reset after each map for all players, so say, if stadt ends and destroyed village starts, some players start with 30 frags! a quick restart solves this, but i'd like to automate it to restart in the first few seconds of each map and reset the scores! I'm using vstr nextmap aliasing to do a mixmap rotation, and think this is what may be causing it.

Secondly, it would help give time to load all the ambient sounds in grabstatte, which don't start until the second round, and from what i've read on boards, this may be a precache thing with the map not loading everything before the map has begun. I'm not a scripter i'm afraid.... so i'm at a loss here.

A friend suggested i do the following:

add "exec maprestart.scr" to the end of the dmprecache.scr and create the following .scr to tell the game to restart the map after a few seconds:

main:
if (level.dmzdt_run != 1)
{
level waittill spawn
thread dmzdtinit
end
}
end


dmzdtinit:

if (level.dmzdt_run != 1)
{
level.dmzdt_run = 1
}
else
end

thread dmzdtbeta
end

dmzdtbeta:
wait 20.0

THIS is where i need a map restart command, assuming the time is right for the wait command.

end

Any help would be appreciated! (It may be much simpler, but i've not found any evidence of anyone else experiencing this, and so no other solutions.... i'm really grabbing at straws here!!) :?

Posted: Tue Jul 15, 2003 12:24 am
by nuggets
haven't tried this but...

main:
level waittill spawn
for (local.i = 1;local.i <= $player.size; local.i++)
{$player[local.i] stufftext "restart"}
end

give it a go anyway :P

Posted: Tue Jul 15, 2003 2:16 am
by Alcoholic
my guess would be...

self stufftext "restart"

tells the server itself to restart, i think..

Posted: Tue Jul 15, 2003 6:26 am
by jv_map
No I don't think you can restart a dedicated server from script :?

Posted: Tue Jul 15, 2003 10:45 pm
by elgaucho
ok, guys!

Cheers for the replies!

I'll have a look at what you suggested! I'm quite surprised though that no one else has experienced this issue with scores... :?

Jv_map: when you say "restart a dedicated server" do you mean restart it entirely (as in realunch the game) or just restart the map? I'm not sure if i made myself clear on that, i only need to reset the maps when they finish loading so all scores return to zero!

Thanks again! :wink:

Posted: Wed Jul 16, 2003 7:23 am
by jv_map
I meant restarting the map.

Posted: Fri Apr 16, 2004 11:30 am
by Thormohaa
elgaucho,

I know it's been a long time since anyone has posted to this thread, but did you ever figure out how to reset the team scores on the scoreboard after the map finishes?

I'm having the same problem, and so far this is the only thread that even mentions it.

Thor

g_allclasses

Posted: Fri Apr 16, 2004 2:58 pm
by tltrude
I found this in MOHAATools/docs/g_allclasses, if it helps.

DM_Manager -> Listener -> Class
doroundtransition - delayed function call to (possibly) determine round winner and restart next round.
finishroundtransition - delayed function call to do the actual restart for the next round.

Posted: Sun Apr 18, 2004 2:30 pm
by Rindog
I just tested local.player stufftext restart and it worked. This was on a non-dedicated server, so I would imagine you would need local.player stufftext rcon restart for a dedicated server. And you would have to insure that player has rcon access.

Also, I wonder if a wait statement in the precache might eliminate the need to restart.

Posted: Mon Apr 19, 2004 1:39 am
by kai0ty
well couldnt you just use the restartmap command like u do in console?

Posted: Thu Apr 29, 2004 3:57 pm
by WarTech
jv_map wrote:No I don't think you can restart a dedicated server from script :?
Yes it will work in a dedicated.
Here is just an Idea for you guys the true GURU's I havent tested it but it may work and provide everyone with a way to do the auto restarting in dedicated. Corrections are welcome anytime.

main:

level waittill spawn

level.timelimit = 0 targetname "auto_restart"
level.scorelimit = 0 targetname "auto_restart"


auto_restart:

while (1)
{
$auto_restart waittill level.timelimit || level.scorelimit

if (local.timelimite == "15")
{
local.timelimite thread $reset
}
if (local.scorelimite == "50")
{
local.scorelimite thread $reset
}
wait .1
}
end

reset:

for (local.i = 1;local.i <= $player.size; local.i++)
{$player[local.i] stufftext "restart"}
end

<TWZ>Wartech = NooB

Posted: Thu Apr 29, 2004 4:33 pm
by jv_map
Well what if none of the players is a server admin ;)

I think you could do the following, however:

Code: Select all

map (getcvar mapname)

Posted: Thu Apr 29, 2004 6:47 pm
by WarTech
jv_map wrote:Well what if none of the players is a server admin ;)

I think you could do the following, however:

Code: Select all

map (getcvar mapname)
Yup,, That would do it too. I would even tie it into the voting and withing the map script. But I havent try that one out yet. That was just something that you guys the GURUS can look over it and see if it needs any fixing. The general idea is there. I think

Regards

<TWZ>WarTech = Noob at this, in diaper stage :P