Entity scripting question


(=PoW= Kernel 2.6.5) #1

Hi all,

I have an info_player_intermission that is behaving in an undesirable way.

I have an info_player_deathmatch which is where I want spectators to spawn.
At the end of the map, I want everyone to have a view from the info_player_intermission.

Every combination of info_player_intermission I tried gave the same results.
Spectators spawn at and the end of map view is from the info_player_intermission.

I was thinking I could just disable the info_player_intermission via scripting until just before the map ends.

There is a kill function and a remove function for entities on Chrucker’s site.
Alertentity is one of the functions I need but I don’t see a disable or toggle.
Will kill or remove work or will those eliminate the entity to make alerting it impossible?

Is there a better way to accomplish what I’m trying to do?

Thanks for any help.


(Flippy) #2

i dont know about info_player_intermission things… but if you want to remove it from your script you have two options:

setstate [targetname of info_player_intermission] invisible (or “default” instead of “invisible” to bring it back)

or


[scriptname of info_player_intermission]
{
   trigger kill
   {
        remove
   }
}

and have something do “trigger [scriptname of i_p_i] kill” right before the map end

however, im not sure how to make this happen right before the map ends.

you could try putting it in a “game_manager - timelimit_hit” scriptblock, which is called when the timelimit is expired (and also put it in the scriptblock where you make the attacking team win and end the match ofcourse), but maybe that will be just too late… you have to try it


(nUllSkillZ) #3

You could take a look at the official maps.
If axis win you have a different view as if the allied win.

You can try “alertentity”.
If you can not set a state of an entity sometimes you can alert it (switch on to off or vice versa).


(=PoW= Kernel 2.6.5) #4

I didn’t think you could setstate an entity, only brushes. Is that not true?

null, are you sure about the alertentity toggling it’s state? I won’t have time to test this until late tonight.


(Flippy) #5

erm, afaik you can only setstate entities, and not brushes.

How would you setstate a normal brush? You need to give the entity (“worldspawn” if you try to setstate a brush i guess) a targetname which you use in the script. And im sure making worldspawn invisible isn’t a good idea :wink:

I think not all entities can be setstated, but most of them can… a few examples would be func_door(_rotating), script_mover, func_static, func_rotating, etc, etc ,etc…


(MrLego) #6

Place a “info_notnull” where you want the players to look when the allies win when the map ends and give it a targetname = allies_win.

Then target a “info_player_intermission” to “allies_win” , check off allied (spawnflags=2).

Do the same thing, this time with another “info_notnull” “targetname” = “axis_win” and set another “info_player_intermission” target to “axis_win” and check off axis (spawnflags=1).

{
"classname" "info_player_intermission"
"target" "allies_win"
"spawnflags" "2"
}

{
"classname" "info_notnull"
"targetname" "allies_win"
}
{
"classname" "info_player_intermission"
"target" "axis_win"
"spawnflags" "1"
}

{
"classname" "info_notnull"
"targetname" "axis_win"
}

(=PoW= Kernel 2.6.5) #7

Mr. Lego - I think you misunderstand the problem.

The problem isn’t getting the info_player_intermission to work.
It works too well and overrides the info_player_deathmatch.

I need to disable the info_player_intermission and the spawn flags don’t seem to matter unless you use two info_player_intermission’s in your map.
If use one, all players spawn there and all players get their intermission views from there no matter what the spawn flags are.

When you have two of them and select allies for one and axis for the other they work as expected.
That’s not the problem.

I don’t want them to work at all until the very end of the map.

=================================================================================

Another scripting questions for the group.

Is there something game_manager does when time runs out.
Will it trigger a function that I can use or do I have to make a timer function that runs the same length of time the map does and have it take care of some final things (like playing a sound file).

Edit - hmmmmm I’m thinking this is what happens in Oasis.
I’ll look there too.


(=PoW= Kernel 2.6.5) #8

I found this in Oasis:

	trigger timelimit_hit
	{
		trigger end_boom_north check_0
		trigger end_boom_south check_1
	}
}


Is trigger timelimit_hit a built-in function of game_manager ?

Sorry if my double post irritates you but it is the best way to reset the new reply flag for those who have already seen my previous post.


(kamikazee) #9

From what I remember from creating ET Headshot 2, just use an info_player_intermission with no spawnflags where you want the spectators to spawn.
Those with spawnflags are only touched on the map’s end.

Proof from the game code:

/*
=================
FindIntermissionPoint

This is also used for spectator spawns
=================
*/

If you would keep reading the code, you would see that the game doesn’t even look for an info_player_deathmatch if there is an intermission point. The deathmatch spawn point is only used when it tries to spawn the spectator trough a normal spawn because there is no intermission point at all.


(=PoW= Kernel 2.6.5) #10

OK then.

I’ll add another intermission next to the deathmatch and report back.

TADA !!!

You are the man Kami.

Did what you suggested and problem solved.

Put an info_player_intermission with no flags near my info_player_deathmatch and now spectators spawn there.

Second info_player_intermission has both Axis and Allies flags set and both teams see that view at the end of map.

Only need to test out that time out thing in game_manager.


(nUllSkillZ) #11

trigger timelimit_hit is build in.
It’s hit if the time exceeds.

You have to use it if you want to create a double objective map to and to end the map if no side fullfills their objectives.
But be aware you have to set a winner first in the game_manager/spawn-scriptblock (1 or 0).
And then override it in “timelimit_hit” (as far as I remember with -1).

Edit:

some words were missing
:smiley:


(Flippy) #12

^^^what he said,
in script:


game_manager
{
   spawn
   {
        //blabla
        wm_setwinner 0   // makes axis win when time expires, you MUST state this or your map won't end
   }

   trigger timelimit_hit
   {
        wm_setwinner -1   // Makes the game a draw
        wm_endround    // Forces the map to end
   }
}

if you put “wm_setwinner -1” in the spawn scriptblock it won’t work, because “timelimit_hit” will not be run and the game will continue with timelimit “0:00”
however, using timelimit_hit you can force the game to end with a draw


(=PoW= Kernel 2.6.5) #13

Well, I’m using Axis as the default winning team.

Then using the timelimit_hit to play a sound file so I’m not making the round a draw, just adding a few things that will happen before we jump into the intermission.

So far, everything seems to be working.

BTW - Thanks for all the help everyone.


(=PoW= Kernel 2.6.5) #14

Another problem on scripting and end of round:

Heres my code:


game_manager
{
	spawn
	{
		// remapshaderflush
		// Set scenario information.
		wm_axis_respawntime 10
		wm_allied_respawntime	10
		wm_number_of_objectives 4
		wm_set_round_timelimit	25

		// If the round timer expires,
		// set the round winner: -1 = no one has won, 0 = AXIS, 1 = ALLIED.
		wm_setwinner 0 

		// Stopwatch mode defending team (0=Axis, 1=Allies).
		wm_set_defending_team	0

		wait 100
		setstate mlb_kill1_t invisible
		setstate fireplace1 default

		setautospawn Bunker axis
	}

	trigger allies_win
	{
		wm_setwinner 1
		wm_announce "^1ALLIES WIN !!!"
		wait 1000
		wm_teamvoiceannounce 1 sound/katastrophie/03brag16.wav
		wait 1000
		wm_teamvoiceannounce 0 sound/katastrophie/01taunt13.wav
		wait 5000
		wm_endround
	}
	
	trigger timelimit_hit
	{
		wm_setwinner -1
		wm_announce "^1AXIS WIN !!!"
		wait 1000
		wm_teamvoiceannounce 0 sound/katastrophie/03brag16.wav
		wait 1000
		wm_teamvoiceannounce 1 sound/katastrophie/01taunt13.wav
		wait 5000
		wm_setwinner 0
		wait 500
		wm_endround
	}
}

I’ve tried various combinations of wm_setwinner.

Problem is, it seems like the timelimit_hit is never triggered.
The round ends and it shows Axis win but nothing in the timelimit_hit function is executed.

The Allies win trigger is working fine and is trigger by destroying the final objective.


(WeeBull) #15

I think you should remove the wm_setwinner 0 in the spawn section.

And another thing. I believe the setautospawn command only works with 0 (axis) and 1 (allies). So it should be: setautospawn Bunker 0. Correct me if I’m wrong.


(=PoW= Kernel 2.6.5) #16

The setautospwan is working but that may be because there are only 2 axis spawns
and since Bunker is the name of the desired spawn and it’s an Axis only spawn it’s working.

I’ll give your wm_setwinner suggestion a try when I get home tonight
but in posts further up this thread, a couple of people said that won’t work and the map will never end.


(nUllSkillZ) #17

I think it’s not necessary to set the winners in the “timelimit_hit” scriptblock.
Because first you set winner to -1 and later you set it to 0 again.
Remove or comment those lines out.
Set to -1 is only needed if you have a double objective map.


(=PoW= Kernel 2.6.5) #18

I tried that too null.

Problem is that no matter what I change the wm_setwinner to in the main part of game manager or in the timelimit_hit,
the trigger timelimit_hit is never executed.


(Loffy) #19

Hallo!


game_manager
{
	spawn
	{
		wm_setwinner 0 // If 0 or 1, the timelimit_hit script below will run.
		globalaccum 1 set 0 // Counter. Allied total score.
	} // End spawn

	trigger allies_do_their_thing
	{
		globalaccum 1 inc 1 // Allied score increases with 1.
		trigger game_manager doallistuff
	}

	trigger doallistuff
	{
		globalaccum 1 abort_if_not_equal 1 // Have the Allies really won?
		wm_setwinner 1
		wait 1500
		wm_endround
	}

	trigger timelimit_hit // Game-clock hits full-time without allies scoring anything.
	{
		wm_setwinner 0 // Axis win
		trigger game_manager tokskript
		wait 250
		wm_setwinner 0 // Just to make darn sure that Axis win.
	}

	trigger tokskript
	{
		// trigger stuff here, that you want to happen at end of match
	}

}  // End game_manager bracket.---------------------

A script that triggers "allies_do_their_thing" (In this example, a capture):
{
	trigger captured  // This flag/gold is now captured (by the allies)!
	{
		trigger game_manager allies_do_their_thing
		wm_announce "^1Allied Forces for teh win!"
	}
}

Tapir-endorsed.


(=PoW= Kernel 2.6.5) #20

Thanks Loffy.

I tried but it didn’t work.

The only thing that did work was removing the wait statements.

I tried calling another trigger as Loffy suggested but still didn’t work unless I removed the waits.

I finally settled on this:


game_manager
{
	spawn
	{
		// remapshaderflush
		// Set scenario information.
		wm_axis_respawntime 10
		wm_allied_respawntime	10
		wm_number_of_objectives 4
		wm_set_round_timelimit	1

		// If the round timer expires,
		// set the round winner: -1 = no one has won, 0 = AXIS, 1 = ALLIED.
		wm_setwinner 0 

		// Stopwatch mode defending team (0=Axis, 1=Allies).
		wm_set_defending_team	0

		wait 100
		setstate mlb_kill1_t invisible
		setstate fireplace1 default

		setautospawn Bunker axis
	}

	trigger allies_win
	{
		wm_setwinner 1
		wm_announce "^1ALLIES WIN !!!"
		wait 1000
		wm_teamvoiceannounce 1 sound/katastrophie/03brag16.wav
		wait 1000
		wm_teamvoiceannounce 0 sound/katastrophie/01taunt13.wav
		wait 5000
		wm_endround
	}

	trigger axis_win
	{
		//wm_setwinner 0
		wm_announce "^1AXIS WIN !!!"
		wait 1000
		wm_teamvoiceannounce 0 sound/katastrophie/03brag16.wav
		wait 1000
		wm_teamvoiceannounce 1 sound/katastrophie/01taunt13.wav
		wait 1000
		//wm_endround
	}
	
	trigger timelimit_hit
	{
		wm_setwinner -1
		//trigger game_manager axis_win
		//wm_announce "^1AXIS WIN !!!"
		//wait 1000
		wm_teamvoiceannounce 0 sound/katastrophie/03brag16.wav
		//wait 1000
		wm_teamvoiceannounce 1 sound/katastrophie/01taunt13.wav
		//wait 5000
		wm_setwinner 0
		//wait 500
		wm_endround
	}
}

I left in the commented out stuff so you can see some of the thing I tried.