scripting problems with gold bar objectives


(=ds=bart) #1

hi every one im just a beginner
with no basics in scripting .
bud i wenht and tryd a prefab to learn from .
thx to iffy who has helpout a greath deal off people i guess.
budd every thing works bud when i take obj .
i can drop it off ad the gold_box_red dunno wath i dun wrong.
i have this script so far .
game_manager

//Gold allied_gold
{
spawn
{
wait 200
setstate allied_gold_captured invisible
}

trigger stolen
{
wm_announce 0 “Return the Allied gold to the getaway truck”
wm_announce 1 “The Axis have stolen the Allied gold”
setstate allied_gold_cm_marker invisible
}

trigger returned
{
wm_announce 0 “The Allies have retrieved the gold”
wm_announce 1 “Gold returned! Protect the gold”
setstate allied_gold_cm_marker default
}

trigger captured
{
wm_announce “The Axis have secured the Allied gold”
setstate allied_gold_red invisible
setstate allied_gold_captured default
}
}

allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity
{
death
{
trigger game_manager obj1
}
}

i would love to know what do i need to change to make a winnable map .
me noob at scripting so bud wil geth it one day .
sorry for the poor englisch .
:beer: thx in advance from the land off beer .
BELGIUM

EDIT: Changed title to be more informative.


(nUllSkillZ) #2

You have taken this from Ifuritas page I guess.
Theres a mistake in the first line of the script.
And the script is not part of the game_manager-scriptblock.
Here is the corrected script with the checkgame part that is missing in Ifuritas script-example:


game_manager
{
	spawn
	{
		// ...
		accum 1 set 0
	}

	trigger obj1
	{
		// accum 1 holds the No.'s of completed objectives
		// so if the objective is completed the No. will be increased by 1
		accum 1 inc 1

		// If accum 1 is less then the total No. of primary objectives (in this case 1)
		// the script is aborted
		accum 1 abort_if_not_equal 1
		
		// otherwise the winner is set
		// I think in Ifuritas example the axis have to secure the gold
		wm_setwinner 0	// 0 == axis | 1 == allied

		// and the round is ended
		wm_endround
	}
}

allied_gold //Gold
{ 
	spawn 
	{ 
		wait 200 
		setstate allied_gold_captured invisible 
	} 

	trigger stolen 
	{ 
		wm_announce 0 "Return the Allied gold to the getaway truck" 
		wm_announce 1 "The Axis have stolen the Allied gold" 
		setstate allied_gold_cm_marker invisible 
	} 


	trigger returned 
	{ 
		wm_announce 0 "The Allies have retrieved the gold" 
		wm_announce 1 "Gold returned! Protect the gold" 
		setstate allied_gold_cm_marker default 
	} 

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

allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity 
{ 
	death 
	{ 
		trigger game_manager obj1 
	} 
}

If you are looking for an example map.
I’ve made a concept map.
And in this map I used Ifuritas tutorial.
Download (source map is included ~100KB):
http://www.nullskillz.de/et/maps/concept_dual_objective.zip


(=ds=bart) #3

thx allot for your advice.
im just getting in to this scripting stuf and have to learn .
it from skartch .
so many thx for your help il give it a try .
:bump: :beer:


(Ifurita) #4

Have you tried looking thru my scripting tutorial?

http://planetwolfenstein.com/4newbies/Map_Scripting_4_Newbies.pdf


(=ds=bart) #5

yep i dith watch there already.
like a 1000 times and many more forums and tuts.
bud im really very dumb haha so it wil take me forever to geth this scripting stuff haha.
the rest in radiant is starting to work out greath thow .
:clap: :clap:
i already build like a 1000 maps to geth al things and constructions to work .
so i wil geth it one day lol thx for the info .
bud where lies the secret in mùaking the map winable like when allies breach a wall are axis one team wins .
sorry for the poor englisch . :bump: .
from the land off beer :drink: :drink: .
BELGIUM


(Ifurita) #6

You need 3 pieces in your script. These are the relevent sections in my script where the allies need to grab a radar module and return it once for the win. Read from the bottom up:


game_manager
{

[bunch of stuff snipped]

//Objective counter and game win check scripts

   trigger alliedobjectivecounter  //Completion of Allied objectives
   {
      //Set accum to increase by 1 so we know that the objective has been completed
      accum 1 inc 1

      //call function called checkgame in game_manager to check if the round has been won

      trigger game_manager alliedcheckgame
   }

   trigger alliedcheckgame // checks to see if Axis win requirements have been met
   {
      accum 1 abort_if_not_equal 1
      wm_setwinner 1
      wait 1500
      wm_endround
   }
   
} //end of game_manager section 

When the objective is dropped off, the alliedobjective counter routine is executed which increments the obj counter from 0 to 1, then checks to see if the game win conditions have been met.

Next, the alliedcheckgame function is called to see if 1 objective has been returned. If not, the game goes on. if so, the game ends and the allies are declared the winner. If you have multiple objectives, you would just set the abort_if_not_equal to 2 or more.

and


launch_code_exit
{ 
   death 
   { 
      trigger game_manager alliedobjectivecounter   // Inc counter game counter 
   } 
} 

The scriptname value of the trigger_flagonly_multiple (drop off point) is launch_code_exit, which means that this script is executed whenever the flag is dropped off.