hide team_ctf_redflag


(eiM) #1

hi,

I already read that there is a bug when i want to hide/unhide a team_ctf_red/blueflag. This is what I did:

  • Added team_ctf_redflag with target+scriptname: rocketcontrol
  • Added alertentity rocketcontrol to the game_manager spawn part (script at the end)
  • used setstate in the later script

But now I get the following error message:

G_scripting alertentity “rocketcontrol” (classname = team_ctf_redflag) doesn’t have a “use” function

I have no idea what I did wrong… So here you get all the necessary parts of my script:

game_manager
{
	spawn
	{
	
		wm_axis_respawntime 30
		wm_allied_respawntime 20
		wm_set_round_timelimit 15
		wm_number_of_objectives 5
		wm_setwinner 0

		setautospawn "Bunker Spawn" 1
		setautospawn "Forward Bunker Spawn" 0

		alertentity rocketcontrol

		trigger game_manager setstatesoff

		setstate rocketcontrol invisible

	}
...
}

...


glotz
{
spawn
{
wait 200
trigger self setup

constructible_class 3
}

trigger setup
{
setstate glotz invisible

setstate baumaterial_toi default

setstate baumaterial default
setstate baumaterial_mod default
}

buildstart final
{
setstate glotz underconstruction

alertentity glotzfake

setstate baumaterial default
setstate baumaterial_mod default
}

built final
{
setstate glotz invisible

setstate baumaterial invisible
setstate baumaterial_mod invisible

setstate rocketcontrol default

wm_announce "The Rocket Controls have been dismantled."
}

decayed final
{
setstate glotz invisible

alertentity glotzfake

setstate baumaterial default
setstate baumaterial_mod default
}

death
{
}

}

...

rocketcontrol
{
	spawn
	{
	}

	trigger stolen
	{

		wait 1000

		// *----------------------------------- vo ------------------------------------------*
		//wm_teamvoiceannounce 0 "radar_axis_radarw_taken"

		//wm_teamvoiceannounce 1 "radar_allies_radarw_taken"
		// *---------------------------------------------------------------------------------*
	}

	trigger returned
	{
		// *----------------------------------- vo ------------------------------------------*
		//wm_teamvoiceannounce 0 "radar_axis_radarw_returned"

		//wm_teamvoiceannounce 1 "radar_allies_radarw_returned"
		// *---------------------------------------------------------------------------------*

	}

	trigger captured
	{
		trigger truckbox2 visible
		trigger truckboxtrans2 invisible

		// Allies win
	}
}

Please help me out with this.

eiM


(nUllSkillZ) #2

If setstate isn’t working with an entity you should try alertentity instead.

My guess:
With first alertentity it is invisible.
With next alertentity it’s visible again and so on.


(isbowhten) #3

if you have a count key no obj will be spawned uless u use alertentity…
e.g. if you have count key 10 but wanna have 20 objs then you use alertentity twice…
if you dont have a count key, one obj should spawn !without alerentity!(default) and it is possible just to set it invisible i think.

if you have only one obj it should not make problems…
i once tried to make objs that help you on a special place but can be re-stolen again to anohter place…
and there occurred problems after i had captured it once at all places … so
if but there was no problem with setstates.


(stealth6) #4

if you are interested I could search for a prefab I have somewhere of a capture the flag that goes to 99 caps, the 100th cap ends the game or until the time runs out + scoreboard.


(merlin1991) #5

[QUOTE=eiM;184564]But now I get the following error message:

G_scripting alertentity “rocketcontrol” (classname = team_ctf_redflag) doesn’t have a “use” function
[/QUOTE]

that one says it all, team_ctf_redflag can’t be used therefore no alertentity.

i just checked the goldrush script and mapsource

thats the team_ctf_redflag entity that is used there:

classname 	team_ctf_redflag
count 		2
message		The Gold Crate
model		models/mapobjects/goldbox_sd/goldbox.md3
origin		2478 -2248 -316
scriptname	gold_crate

thats the script they use on the crate

gold_crate
{
	spawn
	{
		accum 0 set 0 // gold counter
	}

	trigger stolen
	{
		accum 0 inc 1
		accum 0 trigger_if_equal 1 gold_crate stolen1
		accum 0 trigger_if_equal 2 gold_crate stolen2
	}

	trigger secured
	{
		accum 0 trigger_if_equal 1 gold_crate secured1
		accum 0 trigger_if_equal 2 gold_crate secured2
	}

	trigger returned
	{
		accum 0 inc -1
		accum 0 trigger_if_equal 0 gold_crate returned1
		accum 0 trigger_if_equal 1 gold_crate returned2
	}

	trigger stolen1
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "goldrush_axis_gold1_taken"

		wm_teamvoiceannounce 1 "goldrush_allies_gold1_taken"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger stolen2
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "goldrush_axis_gold2_taken"

		wm_teamvoiceannounce 1 "goldrush_allies_gold2_taken"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger secured1
	{
		wm_announce "Allied team has secured the first Gold Crate!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "goldrush_axis_gold1_secured"

		wm_teamvoiceannounce 1 "goldrush_allies_gold1_secured"
		// *---------------------------------------------------------------------------------*
	}

	trigger secured2
	{
		wm_announce "Allied team has secured the second Gold Crate!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "goldrush_axis_gold2_secured"

		wm_teamvoiceannounce 1 "goldrush_allies_gold2_secured"

		wm_removeteamvoiceannounce 0 "goldrush_axis_gold_defend"

		wm_removeteamvoiceannounce 1 "goldrush_allies_gold_defend"
		// *---------------------------------------------------------------------------------*
	}

	trigger returned1
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "goldrush_axis_gold1_returned"

		wm_teamvoiceannounce 1 "goldrush_allies_gold1_returned"
		// *----------------------------------- vo ------------------------------------------*
	}

	trigger returned2
	{
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "goldrush_axis_gold2_returned"

		wm_teamvoiceannounce 1 "goldrush_allies_gold2_returned"
		// *----------------------------------- vo ------------------------------------------*
	}
}

and that are all alertentity calls in the whole goldrush script:

alertentity tankdepot_axis_spawns
alertentity tankdepot_allied_spawns
alertentity tankdepotblob
alertentity tank
alertentity bank_door1
alertentity bank_door2
alertentity truck
alertentity rubble1
alertentity rubble2
alertentity rubble3

as you can see, they just use count 2 in the entity and no alertentity at all

hiding it should work with setstate “bla” invisible
unhiding with setstate “bla” default but i don’t know if it works


(isbowhten) #6

hm ok then the objs are dropped even when youdont use alertentity.
but i am 100% sure (cause i did it) that you may use alertentity.
maybe add a wait, that often helps xD
i know it. i am sure you may use alertentity


(eiM) #7

so what shall i do now if I want the objective to have a count of one and me being able to setstate it to invisible?

I think I need a targetname to set it default/invisible via setstate command so IF i add a targetname it disappears which makes me need an altertentity in the game_manager spawn. But here I get the upper error message.

So what to change? I have no idea from what you’ve posted, what do change.

When I dont set a targetname my setstate’s dont work because of “no entitie found” to setstate it.

EDIT:
a little wait of 500 in game_manager spawn fixxed all problems
the rest was fine… alertentity once to spawn it to the map and from then on I can use setstates


(isbowhten) #8

hehe…
wait often helps.
maybe the entity doid not spawn yet cause you ahd no wait at all