team_WOLF_obj error


(Malverik) #1

I have this error right when the script calls a “alertentity cpspawnblob”:

G_Scripting: alertentity "cpspawnblob"
(classname = team_WOLF_objective)
doesn't have a "use" function

what I have is a forward spawn you can capture with a flag. If a team captures the flag, they get the spawn (phspawnblob) and another spawn (cpspawnblob) is activated for the other team to spawn at. At the start, no one has any of those spawns. Here is the script for the flag:


/*----------------------------------------------------------------------
| POWERHOUSE SPAWN FLAG
|-----------------------------------------------------------------------
|
| Slot	Used for
| ====	========
| 0     Flag owner:	0 = Axis	1 = Allies
*/
phflag
{
	spawn
	{
		setstate phspawnblob invisible
		setstate cpspawnblob invisible
		accum 0 set 0
	}

	trigger axis_capture	      
	{
		setstate phspawnblob default
		setstate cpspawnblob default
		accum 0 abort_if_equal 0	// Abort if Axis already have it

		accum 0 set 0			// Set Axis as current owner
		wm_announce "Axis capture the Powerhouse!"
		wm_announce "Allies establish outpost in the central building."

		// *----------------------------------- vo ------------------------------------------*
		// Voice messages here
		// *---------------------------------------------------------------------------------*

		// * Update obj here *

		alertentity phspawnblob
		alertentity cpspawnblob
	}

	trigger allied_capture
	{
		setstate phspawnblob default
		setstate cpspawnblob default
		accum 0 abort_if_equal 1	// Abort if Allies already have it

		accum 0 set 1			// Set Allies as current owner
		wm_announce "Allies capture the PowerHouse!"
		wm_announce "Axis establish outpost in the central building."

		// *----------------------------------- vo ------------------------------------------*
		// Voice messages here
		// *---------------------------------------------------------------------------------*

		// * Update obj here *

		alertentity phspawnblob
		alertentity cpspawnblob
	}
}
/*----------------------------------------------------------------------
| END POWERHOUSE SPAWN FLAG
|-----------------------------------------------------------------------
*/

Another thing, if the axis capture the flag first, i dont get the error because the script only makes the spawns visible. In that case, the flags apear correctly but the cpspawnblob doesnt work even if I select it!

phspawnblob and cpspawnblob are both the team_WOLF_objectives. cpspawnblob is set to def_allies and phspawnblob is set to def_axis. The phflag has for target all the team_bluespawn and team_redspawn around the phspawnblob.

Any ideas?


(CptnTriscuit) #2

Well the first problem is your phflag’s accum 0 is being set to 0 in the spawn routine. That should not be there if the flag is supposed to be neutral at the start of the map. So set accum 0 to equal something other than 0 or 1. Also, the accum 0 check in both the trigger allied_capture and trigger axis_capture routines need to come first - this is whats causing your second problem. When the Axis capture the team_wolf_objectives are made default, but then the routine is aborted becuase accum 0 was set to 0 when the entity was spawned.

Also, your phflag does not need to be targeting the spawn entities, thats just how it was done in RTCW.

I have run into that same g_scripting error before, but I dont remember what causes it. Have you been looking at goldrush as your reference for your spawn? I did, and it confused the heck out of me. Check out the .script for Radar and look at the spawn stuff it seemed alot simpler.


(Malverik) #3

I looked at the depot yard in railgun for this one since it’s the only one i could think of where no one can spawn there at the start.
Before I looked at it I also tought I should set the accum to 2 and set the team_WOLF_obj to none of the teams, but since “alertentity” on the team_wolf_obj simply inverts the team spawning there, it wouldnt know what to invert.
The way it works in railgun is that the spawn is assigned to the axis but the t_W_o is set to invisible. That way the axis cannot select it in the command map. If the axis capture it first, it is only made visible so that they can now select it. After that, wich ever team captures it set the accum to itself and inverts the spawning team.
If I comment out the stuff about the cpspawnblob, the spawn around the flag works perfectly.


(Malverik) #4

hehehe! turns out a little “wait 200” in the spawn fixed everything!