Dyna. Objective


(TFate) #1

Ok, I’ve made a level I’m rather fond of, it involves the Allies breaking through a gate and dynamiting two fuel storages. Now my question is how do alter my script so that once both fuel storages are destroyed the Allies win?

Here’s the script. It works fine.

game_manager
{
spawn
{
}
}

obj_gate
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_announce “Allies have destroyed the Front Gate!”
}
}

obj_fuel_1
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_announce “Fuel Storage destroyed!”
}
}

obj_fuel_2
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_announce “Fuel Storage destroyed!”
}
}

Help is appreciated, right now I’m really eager to finish this map. I feel like I’m so close!


(Mean Mr. Mustard) #2

This is how I would do it (but there are multipe ways…)

game_manager 
{ 
   spawn 
   {  
      globaccum 0 set 0
   } 

   trigger allies_win
  {
      globalaccum 0 abort_if_not_equal 2
      wm_setwinner 1
      wait 2000
      wm_endround
  }
} 

obj_gate 
{ 
   spawn 
   { 
      wait 200 
      constructible_class 3 
   } 
   death 
   {   
     wm_announce "Allies have destroyed the Front Gate!" 
   } 
} 

obj_fuel_1 
{ 
spawn 
{ 
wait 200 
constructible_class 3 
} 
death 
{ 
      wm_announce "Fuel Storage destroyed!" 
     globalaccum 0 inc 1
     trigger game_manager allies_win
} 
} 

obj_fuel_2 
{ 
spawn 
{ 
wait 200 
constructible_class 3 
} 
death 
{ 
     wm_announce "Fuel Storage destroyed!" 
     globalaccum 0 inc 1
     trigger game_manager allies_win
} 
} 

So, when a fuel dump is blown, globalaccum is incremented by 1. Once it is 2, then the allies_win trigger will set the winner and end the round.


(TFate) #3

Thank you! :drink: