Trying to hide flags


(neotic) #1

I’m trying to hide team_CTF_redflag / team_CTF_blueflags. I want the illusion that both teams can pick this objective up and capture it, so naturally I inserted two flags for each team. When one team picks up a flag it makes the other flag that the other team can pickup invisible. If the taken flag was returned the other flag would return to default and be visible.

So far I’ve tried simple setstates referring to the scriptname of the flags. However, that did not work, the states wouldn’t change. I tried giving the flags a targetname for the setstates to refer to, but either the flag is going invisible right away and won’t change states or its breaking the flags all together (I can’t tell which). I thought perhaps the setstate that makes the flags invisible in the stolen block was somehow being accessed right away, I tried to circumvent by using a trigger which lead to no success.

I’m not sure what I’m doing wrong… Gerbil insists its possible… so if anyone can point out where I’m messing up, that would be great.

"targetname" "axis_gold"
"scriptname" "axis_gold"
"classname" "team_CTF_redflag"
"origin" "-3328 7800 1040"
"message" "the Gold"
"model" "models/mapobjects/goldbox_sd/goldbox.md3"
"skin" "models/mapobjects/goldbox_sd/goldbox.tga"

"targetname" "allied_gold"
"skin" "models/mapobjects/goldbox_sd/goldbox.tga"
"model" "models/mapobjects/goldbox_sd/goldbox.md3"
"message" "the Gold"
"origin" "-3328 7672 1040"
"classname" "team_CTF_blueflag"
"scriptname" "allied_gold"

Here are several attempts I tried:

allied_gold
{
	spawn
	{
		wait 200
		setstate allied_gold_captured invisible
		setstate axis_gold default
	}

	trigger stolen
	{
		
		wm_announce "The Axis have stolen the Allied gold"
		setstate allied_gold_cm_marker invisible
		trigger hide
	}

	trigger returned
	{
		wm_announce "The Allies have retrieved the gold"
		setstate allied_gold_cm_marker default
		setstate axis_gold default
	}

	trigger captured
	{
		wm_announce "The Axis have secured the Allied gold"
		setstate allied_gold_red invisible
		setstate allied_gold_captured default
		setstate axis_gold invisible
	}
	
	trigger hide
	{
		setstate axis_gold invisible
	}
} 
axis_gold
{
	spawn
	{

		wait 200
		setstate axis_gold_captured invisible
		setstate allied_gold default
	}

	trigger stolen
	{
		wm_announce "The Axis have stolen the Allied gold"
		setstate axis_gold_cm_marker invisible
		setstate allied_gold invisible
	}

	trigger returned
	{
		wm_announce "The Allies have retrieved the gold"
		setstate axis_gold_cm_marker default
		setstate allied_gold invisible
	}

	trigger captured
	{
		wm_announce "The Axis have secured the Allied gold"
		setstate axis_gold_red invisible
		setstate axis_gold_captured default
		setstate allied_gold invisible
	}
} 

(Ifurita) #2

From Tactical_final


game_manager
{
	spawn 
   	{
	
		// Game rules
		wm_axis_respawntime	1
		wm_allied_respawntime	1
		wm_number_of_objectives 8
		wm_set_round_timelimit	60

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

		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=Overtime)
		wm_setwinner	0 //Assumes allies defending

		wait 2000

		alertentity token_allied
		alertentity token_axis
		accum 0 set 0
		globalaccum 0 set 0

You need to add alertentity [targetname of ctf_flag] in game_manager


(neotic) #3

Thanks for the quick reply Ifurita. I threw the altertentity’s in the game_manager and tested that. Upon loading I got this:

g_scripting: alertentity “allied_gold” (classname = team_CTF_blueflag) doesn’t have a “use” function

I’ll admit, I’m very rusty since I released ruins and do appologize for this, lol. However, I’m quite confused at the situtation.


(Ifurita) #4

You can download the tactical_final source here

http://www.planetwolfenstein.com/4newbies/source/tactical_final_source.zip

I have both a red and blue flag that is used for the run token. Once it’s grabbed, the other one goes invisible and does not reset until it’s capped at the end of the run.

The pk3 is on pcgamemods somewhere