timelimit_hit and script_mover question


(Max1) #1

Hello,

I have 2 questions about the following things. It would be great if you guys could give me some hints.

  1. In my map both teams can score points. The problem is the end sequence.

I want the map to end like this:

Axis have most points -> Axis win

Allies have most ponts -> Allies win

Both teams same points -> Draw

I would also like to have a little delay after the map has ended so the players can still move, but can’t change the winner anymore.

This is the relevant part of my game_manager:


game_manager
{
	spawn
	{
		remapshaderflush
		wm_axis_respawntime	12
		wm_allied_respawntime	12
		wm_set_round_timelimit	30
		wm_setwinner 0
		wait 500
		accum 0 set 2147483647
                 }
	trigger timelimit_hit
	{
	                printaccum 0
		wm_setwinner -1	
		trigger self check_allies
		trigger self check axis
		accum 0 abort_if_not_equal 2147483647
		wm_announce "^3Both teams are doomed!"
		wm_endround
	}
	trigger check_axis
	{
		accum 0 abort_if_equal 2147483647
		accum 0 abort_if_less_than 2147483647
		wm_setwinner 0
		wm_announce "^3Allies are doomed!"
		wm_endround
		playsound Panzerball_axis_win volume 512
	}
	trigger check_allies
	{
		accum 0 abort_if_equal 2147483647
		accum 0 abort_if_greater_than 2147483647
		wm_setwinner 1
		wm_announce "^3Allies escape!"
		wm_endround
		playsound Panzerball_allies_win volume 512
	}
}

If both teams have the same number of points its draw. But if any of the teams has more points allies always win (even if accum 0 is something like 2147483648). It seems like the script completley ignores the abort_if_greater_than.
I use accum 0 to keep track of the score. I’ve chosen 2147483647 as value for it, because as far as i know accums can store 32 bit integer values so from 0 to (2^32)-1 so i set it to (2^31)-1 which should be pretty close to the middle.
To make sure that the score part works correct i’ve added the print accum ( and this works correct).

Next problem is the delay. Couldnt really think of any good way to implement that, because if the winner is set to -1 it wont call the timelimit_hit trigger and i dont really want to use a wait, because the value for 30 mins would be 30601000 :expressionless: dont really know if it would be a good idea to let that counter run the whole time during the map and nobody could manually change the timelimit.

  1. The second problem is probably quite easy to solve, but i think im kinda blind or something.

I just want a script_mover to call its death trigger when its shot by a panzer and then come back with full health.

So my script_mover has the following setup:

“classname” “script_mover”
“spawnflags” “46”
“scriptname” “allies_goal”
“targetname” “allies_goal”
“health” “1”

46 = solid; allied; explosivedamageonly; resurectable

script part:


allies_goal
{
	spawn
	{
		wait 500
		accum 0 bitset 1
		accum 0 bitset 2
	}
	death
	{
		trigger self score_axis
		alertentity allies_goal
	}
}

It calls the death trigger and it also calles the rebirth, but it seems like it cant be damaged again.

I really tried to figure out these problems myself so sorry if im asking redundant questions and thanks in advance for the help.

Greetz Max1


(-SSF-Sage) #2

For timelimit:

You can make something like this, but note then you can’t use cmd timelimit to change the timelimits…:


game_manager
{
   spawn
   {
    wait 50
    wm_set_round_timelimit	30
    //blabla
   accum 0 set 0 //timelimit
    trigger self timelimit
   }

   trigger timelimit
   {
    wait 60000
    accum 0 inc 1
    trigger self timelimit_check
    }

    trigger timelimit_check
    {
    accum 0 abort_if_not_equal 31 //ends after 30 mins, only way to change the actual timelimit if you use this
    //your end routines, you can trigger check winner from here
    }
}

And for that obj counter, you can check Baserace. It is simple to understand, it’s not that complex unless you don’t pay attention.

edit. And for that script_mover thing; did you give it an origin? Might be a problem, dunno.


(Flippy) #3

For the delay, why not just add a wait before the “wm_endround” call? That way, it won’t be ‘waiting’ the whole map, and you could still manually change the timelimit of the map.
Usually, there is already a wait, but only for about 3 seconds orso… You can just make it longer to be 10 seconds, a minute? whatever you want.

Also a little thing I noticed was in this script part:


allies_goal
{
   spawn
   {
      wait 500
      accum 0 bitset 1
      accum 0 bitset 2
   }
   death
   {
      trigger self score_axis
      alertentity allies_goal
   }
} 

The “trigger self score_axis”. Doesn’t this call the “score_axis” event in the “allies_goal” scriptblock, which doesn’t exist? Unless you are omitting some code, which you should always mention.


(-SSF-Sage) #4

He probably is omitting. Why would he use local accums if he didn’t? :slight_smile: But he’s probably trying to trigger the score_axis from game_manager. That’s the only clever thing imo (trigger it in game_manager). So change it if it’s not inside the scriptblock.


(Max1) #5

Thanks for the replies guys.

For timelimit:

You can make something like this, but note then you can’t use cmd timelimit to change the timelimits…:

I think that timelimit_check would be possible, but pretty much the same as a very long wait, or not?

And for that obj counter, you can check Baserace. It is simple to understand, it’s not that complex unless you don’t pay attention.

The Baserace script was indeed interesting. Apparently there is also one accum used to track the difference between the ponits, but that accum is set to 0 at the start. Ill try using 0 too now instead of (2^31)-1 would be great if that did the trick.

I also saw in the code that there was no timelimit_hit trigger in the script and the winner was set to -1 at the beginning. Instead there was a findwinner trigger which might get triggered from some entity in the map, because i couldnt find any round timer which triggers the findwinner from script. So im not really sure if its still possible to change timilimit then.
However that little delay is not really a must i would be happy already if i got the end_game working.

edit. And for that script_mover thing; did you give it an origin? Might be a problem, dunno.

Yep it has an origin and it behaves correct except if you shoot it a second time :/. There is also a second script_mover for the other team with a similar setup, but they arent connected to each other in any way. They both have their own script block.

For the delay, why not just add a wait before the “wm_endround” call? That way, it won’t be ‘waiting’ the whole map, and you could still manually change the timelimit of the map.
Usually, there is already a wait, but only for about 3 seconds orso… You can just make it longer to be 10 seconds, a minute? whatever you want.

I tried that first, but it seems like the script ignores the wait and just ends the map once the timelimit is hit.

He probably is omitting. Why would he use local accums if he didn’t? But he’s probably trying to trigger the score_axis from game_manager. That’s the only clever thing imo (trigger it in game_manager). So change it if it’s not inside the scriptblock.

Yea I have left some parts out. The score_axis function is supposed to get triggered when the axis score so they get a point. Im also triggering that score_axis function from a second script block. The score_axis function is just setstating a couple of brushes for the scoreboard. The script_mover is the only entity with that script_name. So each entity has its own script block.

I think im pretty much on the right track for timelimit now, but i still dont know what could be wrong about the mover. Can’t be that complicated tho since its only a stupid mover, but i really dont want to leave it out.

Greez Max1


(-SSF-Sage) #6

Yeah pretty much. It’s easier to control now. And you will not need to have those big numbers. And it will be easy to control when the game ends and who wins etc…

Hmm. Maybe you should try to redo it from the scratch. Alertentity should heal the entity and resurectable makes it not dissapear. I don’t see the point where it’s broken.

Edit. Hmmmmmmmmm. What if you give it a little wait, let’s say 3 seconds before it’s alertentitied?

Edit.2 Did you check with g_sriptdebug that the alertentity get’s called? Is everything else called from the trigger? Do you have waits in those other triggers, it might be the “wait-bug”. You can just move it above the trigger self score_axis and try if it helps.


(Diego) #7

In my map, I used a func_timer to create the delay before running end-of-map scripted events that would have to take place after the timer ran out.

I used the setwinner of -1. Set the timer to fire every minute. And for a 30 minute map, the timer fires 31 times. (31 because it fires the first time right at the start of the map.)

So each time the timer fires off the script trigger, the script increments an accum value. As soon as that value reaches 31, it will run the ending scripts. Then I use wait statements in each teams victory scripting.


victory_manager
{
	spawn
	{
		accum 1 set 0         // Axis Objectives
        accum 2 set 0         // Allied Objectives
	}
	
	trigger allied_objective_counter //Counts allied objectives completed
	{
		accum 2 inc 1
		trigger self allied_endgame

	}
	
	trigger allied_endgame  // Check to see if all of allied objectives are complete
	{
		accum 2 abort_if_not_equal 1		
		globalaccum 3 abort_if_not_equal 1  //Just in case timer ends round before dyno blows
		wm_setwinner 1

		wait 1000
		//====================================================================================
		wm_announce "^3The Allies have destroyed the Radar Control Center!" 
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "praetoria_axis_radar_destroyed"
		wm_teamvoiceannounce 1 "praetoria_allies_radar_destroyed"
		// *---------------------------------------------------------------------------------*
		//====================================================================================		
		togglespeaker allied_victory_speaker
		wait 2000
		trigger fighter_A move_plane_A1 // Start at 2 seconds
		wait 5000
		trigger fighter_B move_plane_A1 // Start at 7 seconds
		wait 5000
		trigger cargo_plane move_plane_A1 // Start at 12 seconds
		wait 6000
		trigger fighter_C move_plane_A1 // Start at 18 seconds
		wait 2000
		wm_announce "^3The Allied Paratrooper force has safely penetrated the Axis Anti-Air Defenses!"	//Start at 20 seconds	

		wait 3000

		wm_endround
	}
	
	trigger axis_objective_counter //Counts axis objectives completed (i.e. # of times the timer fires this trigger)
	{
		accum 1 inc 1
//		wm_announce "^3timer triggered"
		trigger self axis_endgame

	}
		
	trigger axis_endgame  // Check to see if all of axis objectives are complete
	{
		accum 1 abort_if_not_equal 31

		setstate allied_destruct_radar_toi invisible // This removes the Radar Controls TOI so the dyno can't blow radar after timer runs out.
		globalaccum 3 set 0 // This is used as a failsafe to interrupt allied victory script in case dyno blows while axis victory is running.
		wait 1000

		togglespeaker axis_victory_speaker
		
			//====================================================================================
			// *----------------------------------- vo ------------------------------------------*
			wm_teamvoiceannounce 0 "praetoria_axis_airstrike_spotted"
			wm_teamvoiceannounce 1 "praetoria_allies_airstrike_spotted"	
			// *---------------------------------------------------------------------------------*
			//====================================================================================			
		wait 2000
		trigger fighter_A move_plane_B1 // Start at 2 seconds
		trigger flyby_tester randomfire
		wait 2000
		trigger fighter_B move_plane_B1 // Start at 5 seconds
		wait 7900
		trigger cargo_plane move_plane_B1 // Start at 12 seconds
		wait 8000
		wm_announce "^3The Allied Paratrooper force has been shot down by the Axis Anti-Air Defenses!" //Start at 20 seconds
		wait 500
		trigger fighter_C move_plane_B1 // Start at 20.5 seconds

		wait 6000
		wm_setwinner 0
		wait 500
		wm_endround
	}
}


(Max1) #8

I think all my probs are pretty much solved now

Edit. Hmmmmmmmmm. What if you give it a little wait, let’s say 3 seconds before it’s alertentitied?

I put the alertentiy infront of the trigger score_axis and put a wait 500 before and after it and that did the trick. :slight_smile:

And for the delay i think Diegos method is pretty much the best one to achieve this.

Huge thanks to you Diego and Sage!

I also found a little spelling mistake in my script:

trigger self check axis

trigger check_axis

as you can see there was just a _ missing. :confused:

As for the accums i found out this:


(G_Script) game_manager-> "bitset 1"
(G_Script) game_manager: Accum[0] = 2
(G_Script) game_manager-> "bitset 2"
(G_Script) game_manager: Accum[0] = 4
(G_Script) game_manager-> "bitset 3"
(G_Script) game_manager: Accum[0] = 8
(G_Script) game_manager-> "bitset 4"
(G_Script) game_manager: Accum[0] = 16
(G_Script) game_manager-> "bitset 5"
(G_Script) game_manager: Accum[0] = 32
(G_Script) game_manager-> "bitset 6"
(G_Script) game_manager: Accum[0] = 64
(G_Script) game_manager-> "bitset 7"
(G_Script) game_manager: Accum[0] = 128
(G_Script) game_manager-> "bitset 8"
(G_Script) game_manager: Accum[0] = 256
(G_Script) game_manager-> "bitset 9"
(G_Script) game_manager: Accum[0] = 512
(G_Script) game_manager-> "bitset 10"
(G_Script) game_manager: Accum[0] = 1024
(G_Script) game_manager-> "bitset 11"
(G_Script) game_manager: Accum[0] = 2048
(G_Script) game_manager-> "bitset 12"
(G_Script) game_manager: Accum[0] = 4096
(G_Script) game_manager-> "bitset 13"
(G_Script) game_manager: Accum[0] = 8192
(G_Script) game_manager-> "bitset 14"
(G_Script) game_manager: Accum[0] = 16384
(G_Script) game_manager-> "bitset 15"
(G_Script) game_manager: Accum[0] = 32768
(G_Script) game_manager-> "bitset 16"
(G_Script) game_manager: Accum[0] = 65536
(G_Script) game_manager-> "bitset 17"
(G_Script) game_manager: Accum[0] = 131072
(G_Script) game_manager-> "bitset 18"
(G_Script) game_manager: Accum[0] = 262144
(G_Script) game_manager-> "bitset 19"
(G_Script) game_manager: Accum[0] = 524288
(G_Script) game_manager-> "bitset 20"
(G_Script) game_manager: Accum[0] = 1048576
(G_Script) game_manager-> "bitset 21"
(G_Script) game_manager: Accum[0] = 2097152
(G_Script) game_manager-> "bitset 22"
(G_Script) game_manager: Accum[0] = 4194304
(G_Script) game_manager-> "bitset 23"
(G_Script) game_manager: Accum[0] = 8388608
(G_Script) game_manager-> "bitset 24"
(G_Script) game_manager: Accum[0] = 16777216
(G_Script) game_manager-> "bitset 25"
(G_Script) game_manager: Accum[0] = 33554432
(G_Script) game_manager-> "bitset 26"
(G_Script) game_manager: Accum[0] = 67108864
(G_Script) game_manager-> "bitset 27"
(G_Script) game_manager: Accum[0] = 134217728
(G_Script) game_manager-> "bitset 28"
(G_Script) game_manager: Accum[0] = 268435456
(G_Script) game_manager-> "bitset 29"
(G_Script) game_manager: Accum[0] = 536870912
(G_Script) game_manager-> "bitset 30"
(G_Script) game_manager: Accum[0] = 1073741824
(G_Script) game_manager-> "bitset 31"
(G_Script) game_manager: Accum[0] = -2147483648
(G_Script) game_manager-> "bitset 32"
(G_Script) game_manager: Accum[0] = 1

I’ve set accum 0 to different bitsets to test which value they are equal to. It was pretty suprising for me, because I always thought it would be like bitset 1 sets it to 1 and 2 to 2 and 3 to 4 etc.

As you can see accums can have values going from -2147483648 to 2147483647.

So the 0 and the -1 are in the middle I fixed that now in the script. I also found out that the accum will go to negative values once you go over 2147483647 (just in case someone searches for bitsets).

Greez Max1


(-SSF-Sage) #9

No problem, I’m glad you got it working. And what comes to my and Diego’s methods. The difference is that I prefer scripting over to an entity. It works just the same tho.