easy question: objectives


(Victorianetza) #1

well i am making one simple objective: allies steal documents and transmitt them… my question is the following: what entities should have the trigger_fragonly ? i used this tutorial: http://www.wolfensteinx.com/surface/tutorials/documents.html
but i made the script: http://victorianetza.hit.bg/islandfull.script

and it does not work… where’s the problem? :???:


(Ifurita) #2

Here’s a tutorial with prefab and script if you want to give this a go

http://www.planetwolfenstein.com/4newbies/objective.htm


(Victorianetza) #3

tnx, i will see what i can get from it :smiley:


(eRRoLfLyNN) #4

Some points in this thread might help you too: http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=6343&highlight=


(Victorianetza) #5

tnx people… i wonder why it is so hard to make such an easy objective?

i just wanted 2 documents to be stolen and transmitteed?!


(Victorianetza) #6

@Ifurita: in the link you showed, is the full script needed for the objective there or a part ???


(Ifurita) #7

It’s designed to be a drop and play prefab. It all really depends on how much scripting you’ve already done. You will need the entities (except for the truck mode) and all parts of the script. The script controls the flags as well as counting the number of objectives taken and capped. The game will end (can’t remember who wins) when the second obj is capped


(Victorianetza) #8

can you tell me: i have this script: http://victorianetza.hit.bg/islandfull.script

i have the entities: team_ctf_redflag with: message: the secret docs; scriptname: documents; model…

and trigger_fragonly_multiple with: spawnflags 1; scriptname: documents_obj;

why the game does not end if i wrote it in the script to end? ( the thing with the objective is not on the bottom of the script;)

please SOMEONE TELL ME :???: :frowning:


(nUllSkillZ) #9

I can not open / download your script.
If it’s possible please post you script enclosed in code-tags.


(Ifurita) #10

I’d just post the script here, i’m having troubles opening it. However, you don’t even have any of the scripting from the returnable objective prefab. You have a condition that accum x is supposed to end the game when x = y, but you have no mechanism for increasing the value of x


(Victorianetza) #11

here is the part of the script that i think you need to help me:

////////////////////MANAGER
game_manager
{
	spawn
	{	
		// Game rules
		wm_axis_respawntime	20
		wm_allied_respawntime	20
		wm_number_of_objectives 3
		wm_set_round_timelimit	30

		// Objectives
		// 1: SECONDARY: Destroy the main entrance
		// 2: PRIMARY:   Steal the secret information
		// 3: PRIMARY:   Transmit the secret information

		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_set_main_objective		1	0
		wm_set_main_objective		1	1

		// Objective overview status indicators
		//wm_objective_status <objective> <team (0=Axis, 1=Allies)> <status (0=neutral 1=complete 2=failed)>
		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0

		//If the time is up, the winner is axis
		wm_setwinner 0

		//Wait
		wait 500

		//vars
		accum 1 set 0   // Allies have secured the information ( 1= YES / 0=NO )
		accum 2 set 0	// The Radar is constructed ( 1= YES / 0= NO )
		accum 9 set 0   // check if button is pressed
	} 
	trigger allies_win
	{
		accum 9 abort_if_equal 1
		accum 1 abort_if_not_equal 1
		accum 2 abort_if_not_equal 1

		accum 9 set 1 

		wm_setwinner	1
		wm_announce "Allied team has sent the secret information!"

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1

		wait 1500
		wm_endround
	}
	trigger allies_destroy_fortwall
	{
		wm_objective_status 1 1 1
		wm_objective_status 1 0 2

		wm_set_main_objective		2	0
		wm_set_main_objective		2	1


		wm_announce	"Allies have breached the Main Entrance!"
		wm_teamvoiceannounce 1 "nightcrawlers_main_destr"
		wm_teamvoiceannounce 0 "nightcrawlers_main_destr"

		wait 1000
	}
	trigger documents_secured
	{
		wm_objective_status 2 1 1
		wm_objective_status 2 0 2

		wm_set_main_objective	3	0
		wm_set_main_objective	3	1

		accum 1 set 1

		wm_announce	"Allies have secured the documents!"

	}
	trigger radara_built
	{
		accum 2 set 1
		wm_announce "The antenna has been constructed" 
	}
	trigger radara_destroyed
	{
		accum 2 set 0
		wm_announce "The antenna has been destroyed"
	}
}
//Constructions
////axis most
axisbridge
{ 
   spawn 
   { 
      wait 200 
      constructible_class 3 
      trigger self startup 
   } 

   buildstart final 
   { 
   } 

   built final 
   { 
      setstate construction_extra default 
      setstate bridge1 invisible
      setstate construction_materials invisible 

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

   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 bridge!" 
   } 

   trigger startup 
   { 
      setstate construction_extra invisible 
      setstate bridge1 default 
      setstate construction_materials default 
   } 
} 

////allied Bridge
alliesbridge
{ 
   spawn 
   { 
      wait 200 
      constructible_class 3 
      trigger self startup 
   } 

   buildstart final 
   { 
   } 

   built final 
   { 
      setstate construction_extra default 
      setstate bridge2 default 
      setstate construction_materials2 invisible 

      // Some kind of UI pop-up to alert players 
      wm_announce   "Allied team has built the Bridge!" 
   } 

   decayed final 
   { 
      trigger self startup 
   } 

   death 
   { 
      trigger self startup 
      // Some kind of UI pop-up to alert players 
      wm_announce   "Axis team has destroyed the Allied Bridge!" 
   } 

   trigger startup 
   { 
      setstate construction_extra invisible 
      setstate bridge2 invisible
      setstate construction_materials2 default 
   } 
}
//Allies Radar
radara
{ 
   spawn 
   { 
      wait 200 
      constructible_class 3 
      trigger self startup 
   } 

   buildstart final 
   { 
   } 

   built final 
   { 
      setstate construction_extra default 
      setstate radar1 default 
      setstate construction_materials8 invisible 

      // Some kind of UI pop-up to alert players 
      wm_announce   "Allied team has built the Radar Tower!" 
   } 

   decayed final 
   { 
      trigger self startup 
   } 

   death 
   { 
      trigger self startup 
      // Some kind of UI pop-up to alert players 
      wm_announce   "Axis team has destroyed the Radar Tower" 
   } 

   trigger startup 
   { 
      setstate construction_extra invisible 
      setstate radar1 invisible
      setstate construction_materials8 default 
   } 
} 
//Axis wAtch Tower1
kyla1
{ 
   spawn 
   { 
      wait 200 
      constructible_class 2 
      trigger self startup 
   } 

   buildstart final 
   { 
   } 

   built final 
   { 
      setstate construction_extra default 
      setstate tower1 default 
      setstate construction_materials3 invisible 

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

   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 Axis Watchtower" 
   } 

   trigger startup 
   { 
      setstate construction_extra invisible 
      setstate tower1 invisible
      setstate construction_materials2 default 
   } 
}

//Axis wAtch Tower2
kyla2
{ 
   spawn 
   { 
      wait 200 
      constructible_class 2 
      trigger self startup 
   } 

   buildstart final 
   { 
   } 

   built final 
   { 
      setstate construction_extra default 
      setstate tower2 default 
      setstate construction_materials4 invisible 

      // Some kind of UI pop-up to alert players 
      wm_announce   "Axis team has built the Second WatchTower" 
   } 

   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 Axis Watchtower" 
   } 

   trigger startup 
   { 
      setstate construction_extra invisible 
      setstate tower2 invisible
      setstate construction_materials4 default 
   } 
}

//gate dynamites
//gate1
gate1
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Frontier gate!"
   }
}
//gate 2
gate2
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Second Frontier Gate!"
   }
}
//fortwall
fortwall
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Fort Wall"
   }
}
//kanal exit
kanal1
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Tunnel Exit"
   }
}

I hope this did it :smiley:


(Victorianetza) #12

so did anyone figured it out?


(nUllSkillZ) #13

You should post your whole script (may be “edit” your last post).
And please enclose it in [ code ]-tags.

What I can see so far: You haven’t triggered your “allies_win”-event.


(Victorianetza) #14

what do you meam i didn’t triggered it?

trigger allies_win
{
accum 9 abort_if_equal 1
accum 1 abort_if_not_equal 1
accum 2 abort_if_not_equal 1

  accum 9 set 1 

  wm_setwinner   1 
  wm_announce "Allied team has sent the secret information!" 

  wm_objective_status 3 0 2 
  wm_objective_status 3 1 1 

  wait 1500 
  wm_endround

(Ifurita) #15

what event calls game_manager trigger allies_win?

Some event has to call that function, like the return of an objective, destruction of an object etc.


(Victorianetza) #16

oo i see… maybe trigger_fragonly_multiple? yes, the place where the objective is secured


(nUllSkillZ) #17

Yeah, I just have had a look at the tutorial (your link).
I haven’t found the part of the “trigger_flagonly” in your script.
The script-part in the tutorial is:


transmitter_obj
{
	spawn
	{
	}
	death
	{
		trigger game_manager objective1
	}
}

Instead of “trigger game_manager objective1” there should be something like “trigger game_manager allies_win” in your script.
Not sure if this is all that is missing.
I will try to have a look tomorrow.


(Victorianetza) #18

tnx i will try it and tell the result tommorow because its 22:23 at home and can not miss Midsomer Murders


(nUllSkillZ) #19

Btw. I think it’s easier to have the following part in the “game_manager”-script-block:


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

	...

	trigger checkgame_objective_counter
	{
		accum 1 inc 1
		accum 1 abort_if_not_equal 2

		wm_announce "Allies have won the game!"
		wait 1000

		wm_setwinner 1
		wm_endround
	}
}

All you have to do is to change the following line to your needs (just change the 2 into the number of primary objectives):


accum 1 abort_if_not_equal 2

And trigger this event for example out of “death”-events of your objectives:


func_explosive_ENTITY_SCRIPTNAME
{
	spawn
	{
		...
	}
	death
	{
		...
		trigger game_manager checkgame_objective_counter
	}
}

I think I have got this from Ifuritas Scripting Tutorial.
Very good Tutorial for beginners. Very helpful and easy written.


(Ifurita) #20

Here’s the basic script I use for returnable objectives:

//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 
} 
} 

The death part is what calls the game win script. In my case, it’s just called obj1. In your case, you want to change this to:

trigger game_manager allied_win

Logically, what is happening is that every time a document is returned, it goes to game_manager to check the victory conditions. If the total number of docs returned = 2, the the allies are declared the winner