Need Victory Script


(Blaster_Jr) #1

ok My map is done the scripting is done except i need to add a way for a team to win… My Script Will Be Below

game_manager
{
   spawn
   {
   }
}

alliesgate
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Gate!"
   }
}

alliestransmitterdoor
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Transmitterdoor!"
   }
}

alliestransmitter
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Transmitter!"
   }
}

alliesreciever
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Reciever!"
   }
}

axisgate
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Gate!"
   }
}
axistransmitterdoor
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Transmitter Door!"
   }
}
axistransmitter
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Transmitter!"
   }
}
axisreciever
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Reciever!"
   }
}

Will someone add a victory to this script… i dont know how to Pics will be out soon for my map.

Thx Who Ever Can Help Me!


([rD]MrPink) #2

I don’t mean to be mean, but I didn’t realize Transmitterdoor would be one word, lol.


(Blaster_Jr) #3

Ok i made the axis/allies objectivies one word so it would be easyer to script…+ didnt know that there could be underlines until this morning
when i was done with the triggers

Can You Help Me!

PLEASEEE!!!


([rD]MrPink) #4

Unfortunately I don’t know much about scripts. However, you can put anything you want in place of Transmitterdoor. You could put “The Allies are having sex with goats!” and it would still print it.


(Mean Mr. Mustard) #5

What you need is something like this:


game_manager
{
   spawn
   {
   }
   trigger allies_win
	{
		wm_setwinner	1
		wm_announce "Allied team has won!"

		wait 1500
		wm_endround
	}
		
	trigger axis_win
	{
		wm_setwinner	0
		wm_announce "Axis has won!"

		wait 1500
		wm_endround
	}	
}


Then somewhere in the script, after the objectives are complete do

trigger game_manager allies_win

(Blaster_Jr) #6

Um I dont get it does it make it so when all objectives destroyed the team who did it wins or do i have to do an accumulative type objective


(Blaster_Jr) #7
game_manager
{
	spawn {
		wm_number_of_objectives 8
		wm_axis_respawntime 20
		wm_allied_respawntime 18
		wm_set_defending_team 1
		wm_set_round_timelimit	30

		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_set_main_objective		1	0
		wm_set_main_objective		0	1
		
		// If the round timer expires, the Axis have won, so set the current winning team
		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner -1
	}
}
{
   spawn
   {
   }
}

alliesgate
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Gate!"
   }
}

alliestransmitterdoor
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Transmitterdoor!"
   }
}

alliestransmitter
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Transmitter!"
   }
}

alliesreciever
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Axis have blown up the Allies Reciever!"
      wm_announce "Axis have won!" 
		wm_setwinner 0
		wm_endround
   }
}

axisgate
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Gate!"
   }
}
axistransmitterdoor
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Transmitter Door!"
   }
}
axistransmitter
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Transmitter!"
   }
}
axisreciever
{
   spawn
   {
      wait 200
      constructible_class 3
   }
   death
   {
      wm_announce "Allies have blown up the Axis Reciever!"
      wm_announce "Allies have won!" 
		wm_setwinner 1
		wm_endround
   }
}

Anything Wrong With This… I Cant Get it to run!


(Mean Mr. Mustard) #8

I think you need: wm_setwinner 0 not wm_setwinner -1

It looks like which ever team blows the opposing receiver first wins. Is that how you want it?

And you need wm_set_main_obective 1 1 not 0 1

Explain the flow of your game a little more (ie. axis have to do this, this and this to win, etc), then we can help with the scripting.


([rD]MrPink) #9

  death 
   { 
      wm_announce "Axis have blown up the Allies Transmitterdoor!" 
   } 

Change that to say “Transmitter Door!” already!


(Blaster_Jr) #10

ok the axis and allies have 4 objectives each… They must destroy the transmitter and the reciever to win… But i cant make it have the team who accomplishes It Win… Can you help me now!


(Mean Mr. Mustard) #11

Thanks for the info - it helps.

Few more questions:

  1. do the objectives have to be done in order (ie. transmitter then receiver) or can they be blown in any order (just as long as both are blown)?

  2. who is the winer if time runs out?

  3. can the transmitter and receiver be rebuilt? (doesn’t look like it from your script)

Would you be willing to send me your map? (just a pk3 file not the .map file since scripting can be modified with out recompiling) This way I can make sure the script works.


(Mean Mr. Mustard) #12

Without seeing your map, I’ll take a stab at it:

Now some explanation:
I set up two counters: accum 0 and accum 1 in game_manager. Initially, they are both set to 0. Accum 0 is for the axis team and accum 1 is for the allied team. I’ve added two triggers in game_manager: ‘axis_win’ and ‘allies_win’. These routines check for the winner.

I’ll just explain the axis one. First, accum 0 is incremented by 1 (accum 0 inc 1) when the trigger ‘axis_win’ is called. Then accum 0 is checked for its value. In this case, it must be 2 or the axis have not won yet. So it does the ‘accum 0 abort_if_less_than 2’ - basically don’t go passed this point in the trigger until accum 0 is 2. If accum 0 is 2, then it sets the winner and ends the round.

Now, ‘axis_win’ is called in two places: after the transmitter is destroyed and the receiver is destroyed. It doesn’t matter the order. The first one destroyed will increment accum 0 by 1 (accum 0 = 1). The second one will increment accum 0 again, making it accum 0 = 2 and ending the round.

The allied one is very similar but checks/sets accum 1.

Hope this helps. (I provided the explanation so you can modify the script if necessary)

game_manager 
{ 
   	spawn 
   	{ 
		wait 200
		accum 0 set 0	// Axis objective completed counter
		accum 1 set 0	// Allied objective completed counter
   	} 

	trigger axis_win
	{
		accum 0 inc 1			// increment counter
		accum 0 abort_if_less_than 2	// needs to be 2 to win!

		wm_announce "Axis have destroyed both objectives!"
		wm_setwinner 0

		wait 500
		wm_endround				
	}

	trigger allies_win
	{
		accum 1 inc 1			// increment counter
		accum 1 abort_if_less_than 2	// needs to be 2 to win!

		wm_announce "Allies have destroyed both objectives!"
		wm_setwinner 1

		wait 500
		wm_endround				
	}
} 

alliesgate 
{ 
   	spawn 
   	{ 
      		wait 200 
      		constructible_class 3 
   	} 
   	death 
   	{ 
      		wm_announce "Axis have blown up the Allies Gate!" 
   	} 
} 

alliestransmitterdoor 
{ 
   	spawn 
  	 { 
     		 wait 200 
      		constructible_class 3 
   	} 
   	death 
   	{ 
   		   wm_announce "Axis have blown up the Allies Transmitterdoor!" 
   	} 
} 

alliestransmitter 
{ 
   	spawn 
   	{ 
      		wait 200 
      		constructible_class 3 
   	} 

   	death 
   	{ 
    		wm_announce "Axis have blown up the Allies Transmitter!" 
		trigger game_manager allies_win	
   	} 
} 

alliesreciever 
{ 
   	spawn 
   	{ 
     		 wait 200 
     		 constructible_class 3 
   	} 

   	death 
   	{ 
   		wm_announce "Axis have blown up the Allies Reciever!" 
		trigger game_manager allies_win
  	} 
} 

axisgate 
{ 
   	spawn 
   	{ 
     		 wait 200 
      		constructible_class 3 
   	} 

   	death 
   	{ 
      		wm_announce "Allies have blown up the Axis Gate!" 
   	} 
} 

axistransmitterdoor 
{ 
   	spawn 
   	{ 
      		wait 200 
      		constructible_class 3 
   	} 

   	death 
   	{ 
      		wm_announce "Allies have blown up the Axis Transmitter Door!" 
   	} 
} 

axistransmitter 
{ 
   	spawn 
   	{ 
     		 wait 200 
     		 constructible_class 3 
   	} 

  	death 
   	{ 
      		wm_announce "Allies have blown up the Axis Transmitter!" 
		trigger game_manager axis_win
   	} 
} 

axisreciever 
{ 
   	spawn 
  	{ 
     		 wait 200 
     		 constructible_class 3 
   	} 

   	death 
   	{ 
     		wm_announce "Allies have blown up the Axis Reciever!" 
		trigger game_manager axis_win
   	} 
} 


(Blaster_Jr) #13

ok i want it so they can be done in any order, But you have to destroy the transmitter door befor they can destroy the transmitter does that help


(Mean Mr. Mustard) #14

Try the script I posted above. See if that works (for the most part). If we need to modify it so the door is blown first, we can work on that.

Let me know if it works - I think it should but it’s untested.


(Blaster_Jr) #15

mean Mr. Mustard it works only 1 prob(The victory’s Were reversed)
im gonna fix it k

Thx For The Help

Ill Be sure to add you to the credits of the map


(Mean Mr. Mustard) #16

Blaster_Jr - glad it works! Sorry about the reversed victories!

Let me know if you need any more additions to the script - like preventing victory until the transmitter doors are blown.

It’s not necessary to add me to the credits, but it is appreciated :drink:


(Blaster_Jr) #17

ok well the door has to be blown up to even reach the transmitter so there is no need for further scripting for that… now i need to know how to make a gate/door SLIDE not ROTATE

How Do I Do This?