Script error


(Theisy) #1

I can’t seem to get the hang of this scripting business. I am making a constructible mg42 nest but when trying to play my map I getthe error:

G_Script_ScriptParse(), Error (line 2) :
Unknown event: bunker_script

Here is a copy of my script (c n’ p) from Socks in a thread with the name changed:



game_manager
{
bunker_script 
{ 
   	spawn 
   	{ 
		wait 200 
      		constructible_class 2 
      		trigger self startup 
   	} 

   	buildstart final 
   	{ 
   	} 

   	built final 
   	{ 
     		setstate bunker_extra default 
     		setstate bunker_mg42 default 
      		setstate bunker_materials invisible 

      		// Some kind of UI pop-up to alert players 
      		wm_announce   "Axis team has built the bunker mg!" 
   	} 

   	decayed final 
   	{ 
      	trigger self startup 
   	} 

   	death 
   	{ 
     		trigger self startup 

      		// Some kind of UI pop-up to alert players 
      		wm_announce   "Allied team has destroyed the bunker mg!" 
  	} 

   	trigger startup 
   	{ 
      		setstate bunker_extra invisible 
      		setstate bunker_mg42 invisible 
      		setstate bunker_materials default 
      		repairmg42 bunker_mg42 
   	} 
} 
}


Any help would be appreciated


(swaggers) #2

So first off your game_manager is wrong. It’s not a over-all call. It’s a first call. So open it and close it right away.

Other then that if you are just copy/pasting someone else’s script then it’s hard to say what else is wrong, because I don’t know what your models and brushes are called and how your TOI is set-up.

Here’s mine from my testmap and it works 100%.


game_manager
{
	spawn
	{
	}
}


mg_area
{
	spawn
	{
		wait 400
		trigger mg_area setup
		constructible_class 3
	}

	trigger setup
	{
		setstate defense_build default
		setstate defense_build_clip default
		setstate gun invisible
		setstate sand1 invisible
		setstate sand2 invisible
	}

	buildstart final
	{
		setstate defense_build default
		setstate defense_build_clip default
		setstate gun underconstruction
		setstate sand1 underconstruction
		setstate sand2 underconstruction
	}

	built final
	{
		setstate defense_build invisible
		setstate defense_build_clip invisible
		setstate gun default
		setstate sand1 default
		setstate sand2 default
		wm_announce "The Allied have built the useless wall!"
	}

	decayed final
	{
		setstate defense_build default
		setstate defense_build_clip default
		setstate gun invisible
		setstate sand1 invisible
		setstate sand2 invisible
	}

	death
	{
		setstate defense_build default
		setstate defense_build_clip default
		setstate gun invisible
		setstate sand1 invisible
		setstate sand2 invisible
		wm_announce "The Axis have spent valuable time destroying a worthless wall!"

	}
}


(Thej) #3

(sock) #4

The error is indeed on line 2, the routine “game_manager” is a seperate routine to “bunker_script” and needs to be closed/finished first.

Sock
:moo:


(Theisy) #5

:banana:

Yay, I closed game_manager and it works now :slight_smile:

Thanks people for helping me create a constructible