I need help with captureable objectives


(Higgins) #1

For my current map, I need to have the axis steal an object, but every tutorial I have read does not help very much at all. :banghead: :bash:.

Example would be radar, but I only want one object to be captured and taken to a area.

Could some one please give me a step to strp guide on how to do it, with a script?

Thanks


(nUllSkillZ) #2

There’s a tutorial on Ifurita’s page:
http://www.planetwolfenstein.com/4newbies/objective.htm


(Ifurita) #3

tutorial + prefab and script


(Higgins) #4

Thanks for the good link, I am editing the perfab and script right now, only thing that bugs me, is this part:

allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity 
{ 
death 
{ 
trigger game_manager obj1  //Higgins says: WTF? would I change the obj1 to what ever objective this is in my map?
} 
}

What does he mean by that?


(nUllSkillZ) #5

You need the “trigger game_manager EVENTNAME” when you want to react at the securing of the “team_CTF_xxxxflag” (gold / parts / …).
If you want to react you have to include something like the following:


game_manager
{
     // ...

     accum 1 set 0

     trigger EVENTNAME
     {
          accum 1 inc 1

          // change this according to the No. of flag objectives
          // for example:
          // accum 1 abort_if_not_equal 2
          // if you have two flag objectives
          accum 1 abort_if_not_equal 1

          wm_announce "Allies / Axis have secured the flag(s) and win the game!"

          wm_setwinner TEAM // set 0 = axis or 1 = allies for TEAM
          wm_endround
     }
}


(Higgins) #6

This is the code for my capture the flag objective.

}
allied_decoder //Gold
{ 
spawn 
{ 
wait 200 
setstate allied_decoder_captured invisible 
} 

trigger stolen 
{ 
wm_announce "The Axis have stolen the Allied decoder" 
setstate allied_decoder_cm_marker invisible 
} 


trigger returned 
{ 
wm_announce "The Allies have retrieved the decoder" 
setstate allied_decoder_cm_marker default 
} 

trigger captured 
{ 
wm_announce "The Axis have secured the Allied decoder!" 
setstate allied_decoder_red invisible 
setstate allied_decoder_captured default 
} 
} 


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



I have never used accum’s before, because they confused me. Could you tell me from what I have done below will work. If not, can you tell me the right way please?

game_manager 
{ 
     //I put in the round time and spawn times stuff here + objectives

     accum 1 set 0 

     trigger "decoder" //decoder being the trigger name 
     { 
          accum 1 inc 1 

          accum 1 abort_if_not_equal 1 

          wm_announce "Axis have secured the Allied decoder!!" 

          wm_setwinner 0
          wm_endround 
     } 
} 
allied_decoder
{ 
spawn 
{ 
wait 200 
setstate allied_decoder_captured invisible 
} 

trigger stolen 
{ 
wm_announce "The Axis have stolen the Allied decoder" 
setstate allied_decoder_cm_marker invisible 
} 


trigger returned 
{ 
wm_announce "The Allies have retrieved the decoder" 
setstate allied_decoder_cm_marker default 
} 

trigger captured 
{ 
wm_announce "The Axis have secured the Allied decoder!" 
setstate allied_decoder_red invisible 
setstate allied_decoder_captured default 
} 
} 


allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity 
{ 
death 
{ 
     accum 1 set 1
} 
} 



Have I done this correct? and if not, could any one correct it for me please, thank you so much.


(nUllSkillZ) #7

Try the following script:


game_manager
{
     //I put in the round time and spawn times stuff here + objectives

     accum 1 set 0

     trigger decoder //decoder being the trigger name
     {
          accum 1 inc 1

          accum 1 abort_if_not_equal 1

          wm_announce "Axis have secured the Allied decoder!!"

          wm_setwinner 0
          wm_endround
     }
}

allied_decoder
{
	spawn
	{
		wait 200
		setstate allied_decoder_captured invisible
	}

	trigger stolen
	{
		wm_announce "The Axis have stolen the Allied decoder"
		setstate allied_decoder_cm_marker invisible
	}

	trigger returned
	{
		wm_announce "The Allies have retrieved the decoder"
		setstate allied_decoder_cm_marker default
	}

	trigger captured
	{
		wm_announce "The Axis have secured the Allied decoder!"
		setstate allied_decoder_red invisible
		setstate allied_decoder_captured default
	}
}

allied_objectives
{
	death
	{
		trigger game_manager decoder
	}
}


(Higgins) #8

Yep, I can take the object, drop it, return it and secure it. But It will not end the match with axis winning, when I secure it, the match carries on. Would there be any thing else I need to add to this part (or the game manger?):

allied_decoder 
{ 
   spawn 
   { 
      wait 200 
      setstate allied_decoder_captured invisible 
   } 

   trigger stolen 
   { 
      wm_announce "The Axis have stolen the Allied decoder" 
      setstate allied_decoder_cm_marker invisible 
   } 

   trigger returned 
   { 
      wm_announce "The Allies have retrieved the decoder" 
      setstate allied_decoder_cm_marker default 
   } 

   trigger captured 
   { 
      wm_announce "The Axis have secured the Allied decoder!" 
      setstate allied_decoder_red invisible 
      setstate allied_decoder_captured default 
   } 
} 

allied_objectives 
{ 
   death 
   { 
      trigger game_manager decoder 
   } 
}

(nUllSkillZ) #9

Do you have a “script_multiplayer”-entity within your map?
It has the following key/value-pair:
key: scriptname
value: game_manager

This entity is the link between your map and your script.

Are the targetnames/scriptnames correct?


(Higgins) #10

… I am a fool :P, I do not have the script_multiplayer in my map, doh! I dont know why I forgot about that, maybe because I was just testing the capture the flag map piece. Thanks for the reminder :).


(Higgins) #11

Hmmmm

game_manager 
{ 
     //I put in the round time and spawn times stuff here + objectives 

     accum 1 set 0 

     trigger decoder //decoder being the trigger name (what is this again sorry?, I have no clue what it is used for)
     { 
          accum 1 inc 1 

          accum 1 abort_if_not_equal 1 

          wm_announce "Axis have secured the Allied decoder!!" 

          wm_setwinner 0 
          wm_endround 
     } 
} 

allied_decoder 
{ 
   spawn 
   { 
      wait 200 
      setstate allied_decoder_captured invisible 
   } 

   trigger stolen 
   { 
      wm_announce "The Axis have stolen the Allied decoder" 
      setstate allied_decoder_cm_marker invisible 
   } 

   trigger returned 
   { 
      wm_announce "The Allies have retrieved the decoder" 
      setstate allied_decoder_cm_marker default 
   } 

   trigger captured 
   { 
      wm_announce "The Axis have secured the Allied decoder!" 
      setstate allied_decoder_red invisible 
      setstate allied_decoder_captured default 
   } 
} 

allied_objectives 
{ 
   death 
   { 
      trigger game_manager decoder 
   } 
}

Can you see the error? :|!


(nUllSkillZ) #12

Sorry my fault.
Has to be:


game_manager
{
     spawn
     {
          // game rules here
          accum 1 set 0
     }

     trigger decoder
     // ...
}

// ...


(Higgins) #13

Thanks for you help, its working now, the hardest script part is behind me, I can work on all the easy stuff now. Thanks again.

:smiley: :smiley: :smiley: :clap: :smiley: :smiley: :smiley: