Restart script

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
elgaucho
Private
Posts: 9
Joined: Mon Jun 16, 2003 6:03 pm
Location: Brazil, Uruguay, UK
Contact:

Restart script

Post 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!!) :?
Victurus te Saluto!
De mortuis nil nisi bene.
TOW MAP GUIDE:
http://www.nsdapmoh.kit.net/GuiaTow/index.htm
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post 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
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

my guess would be...

self stufftext "restart"

tells the server itself to restart, i think..
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

No I don't think you can restart a dedicated server from script :?
Image
elgaucho
Private
Posts: 9
Joined: Mon Jun 16, 2003 6:03 pm
Location: Brazil, Uruguay, UK
Contact:

Post 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:
Victurus te Saluto!
De mortuis nil nisi bene.
TOW MAP GUIDE:
http://www.nsdapmoh.kit.net/GuiaTow/index.htm
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I meant restarting the map.
Image
Thormohaa
Private
Posts: 5
Joined: Wed Mar 03, 2004 5:49 pm
Contact:

Post 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
Image

"Never insult 7 men when all you're carrying is a 6-shooter."
- Col. Sherman T. Potter - M*A*S*H 4077th, Commanding Officer
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

g_allclasses

Post 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.
Tom Trude,

Image
Rindog
Corporal
Posts: 29
Joined: Wed Sep 24, 2003 6:34 pm

Post 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.
kai0ty
Brigadier General
Posts: 507
Joined: Fri Mar 19, 2004 1:45 am

Post by kai0ty »

well couldnt you just use the restartmap command like u do in console?
There are only 10 kinds of people in this world; those who know what binary is, and those who don't.
WarTech
Colour Sergeant
Posts: 88
Joined: Mon May 05, 2003 3:15 am

Post 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
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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)
Image
WarTech
Colour Sergeant
Posts: 88
Joined: Mon May 05, 2003 3:15 am

Post 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
Post Reply