Wait Statement limits


(Diego) #1

Is there a limitation to how long we can set a wait statement in the script?

I’m trying to set up a scripted sequence for my map when the defenders win. But I need to extend the game beyond the time limit to do that. I have it working ok using a test round limit of 1 minute. But that calls for a wait statement in the script of 60,000. That’s will be quite large with a value of 30 minutes.

I tried a func_timer to fire my script trigger, but since the timer fires once at the start of the map, it ends the game immediately.

Anyway, I think the way I have it will work fine. I’m just concerned about a wait statement value of 1,800,000 trashing the script - if it is even possible to use a value that high.

If not, I’m open to suggestions on how to fire a trigger exactly at the end of the round without using a wait statement.


(kamikazee) #2

According to Chruker’s script reference: entity reference, the game_manager scriptblock can have a routine named “trigger timelimit_hit” which gets called when the timelimit is hit and a winner is set using wm_setwinner.


(Diego) #3

I saw that script routine in the Seawall Battery script. I didn’t really get to test it out much. The first time I tried it, the map would not load. But that might have been due to other issues at the time.

But the important thing I’m trying to do is run these scripted sequences “Live”. In other words, I don’t want them running from a spectator camera while the scores are displayed on top of it. I want players still active in the map even though the allies can no longer achieve their final objective.

I was thinking about it more this morning. Since the func_timer works, I think I can set up an “accum inc” value to work around the fact that it fires at the start of the map. For example, I can have a wait of 60 on the func timer so that it fires once every minute. The func-timer triggers a script trigger that counts the firings up to 30 in the scriptblock. Once that accum reaches a value of 30, that scriptblock can trigger the final ending sequence.

I’m pretty sure that will work. I’ll test it tonight. and also take a closer look at the time-limit hit scripting. Thanks.


(d3coy) #4

the other thing you could do is script the sequence your wanting in your end game… so that it will happen before the end is triggered…

So say capturing documents is the end of the round, well once docs are capped… use wait statements to delay the actual end of game and have it trigger your script for the sequence.

example:

Gold captured on a truck would end game for allies win… but before the round is actually over you want to show a truck drive off… script everything for the truck to move where you want it… time it out how long it takes the truck to get where you want it to be when the round ends… use the wait statement to delay and have the gold captured trigger the truck script…

seems this would be a way for it to work… just depends on what you are wanting done.


(Diego) #5

That would work if I only wanted to have a scripted ending for the attacking team. It becomes more complicated when you want to have two different scripted endings. The tricky part is getting the the scripted ending for the defending team to start after the round has technically ended, but still prevent the allies from accidentally achieving their final objective after the timer has officially run out.

In my map, the allies have to destroy an objective to win the game. I don’t want them planting dyno at that objective with 25 seconds left on the clock and have it blow up during the Axis Victory scripting and cause a conflict on which team actually wins the game. I am assuming that if I remove the final objective’s TOI entity before the dynomite blows, that it will not actually trigger the death of that objective. If I am wrong about that, I think I can still work around it with my global accum.

It’s probably a bit confusing right now. Once I have it working, I’ll post a sample of the related scripting.


(d3coy) #6

what is the final objective? If it is destructable, then just setstate its toi to invisible and this will prevent allies from blowing it up.

If it is capturable then you could setstate the toi for capture point to invisible

either of those can be done within the same script that starts the sequence.


(Diego) #7

That’s what I figured. I just had not had a chance to test it in action to make sure it would work.

For comparison, I tried the trigger timelimit_hit command, but like I expected, it just runs events after the round has ended from the spectator camera with the scores covering the screen.

But I got my script to work this morning. So now the game will run the Axis victory scriptblock after the timer runs out while players are still active in the map. The TOI turned off prevented the dyno from blowing objective just fine. But I have a globalaccum as a backup interrupter just in case.

And of course, in a more normal manner, the Allied Victory scriptblock will run if they blow the objective.

I have to go to work now, I’ll post the script sample later tonight.