Extending Objectives

Post your scripting questions / solutions here

Moderator: Moderators

spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Extending Objectives

Post by spy0012 »

I am still in the scripting learning curve and asked lots of questions already but i want to extend an objective instead of it ending once done.

I have currently setup the steal papers objective but i want to be able to extend the objective by having the person have to go and transmit them via a radio else where in the map, but when that person dies the docs return.

How could i do this, i cannot find any tuts on objectives like this otherwise i would do it that way.

I am doing well so far but struggling on objectives, liberation no problem just obj

Your help is greatly appriciated
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

just add the radio mission as an objective that needs to be completed b4 the round ends

Code: Select all

   level waittill roundstart
      
      $documents thread global/obj_dm.scr::bomb_thinker
      $radio_obj thread global/obj_dm.scr::bomb_thinker
      
      $documents thread axis_win_bomb $documents $radio_obj
      $documents thread allied_win_timer

//bla bla

//just change $documents & $radio_obj to match your targetnames :wink: 
its usually best to post your script.
Image
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

Here is most of the script just removed the allies/axis messages

Code: Select all

level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 1 // Number of targets in this map
level.bomb_damage = 200 // Default damage of the bomb
level.bomb_explosion_radius = 2048 // Default radius of bomb blast

   // level waittill roundstart
   // Start the win check thread for allies
   thread desk_document_check
   // If the end of the match is reached, the Axis win
   $door_bomb thread global/obj_tick.scr::bomb_thinker
   level waittill axiswin
 end // end of main

 // Document checks
 desk_document_check:
   while(1) { // forever
     // Dont execute past this line
     // until someone triggers the object
     $documents_trigger waittill trigger
     // parm.other is the triggerer
     if(parm.other.dmteam == allies) {
       // Make the document graphix disappear
       $documents hide
       // break out of the while loop
       break
     }
     // protection against making this
     // thread use too much CPU
     waitframe
   }
   teamwin allies // Make allies win the match
 end // end allies victory test
Bombing the radio would be better, don't bomb documents you steal them so above code would be wrong in a way.

Bomb thinker, obj_tick.scr is my custom bomb thinker, quicker arming ect,

Any firther help would be appriciated
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

uhm, even though it is quoted out, it should be

Code: Select all

thread use_too_much_CPU
secon of all i thought this was a documents/radio thing, not a bomb obj... wheres the radioing section???
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

that is the part i need help on, as i have no idea how to travel with the documents. Maybe i will just do the blow radio instead.

make objectives simple for everyone, just when i do the steal / bomb tutorial nothing works so i added my own bomb exploder just to access an area and did the steal tutorial and it worked eventually.

I cannot seem to combine objectives
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

if this doesnt help,ill post a script i made for southern france were i added the V2 objectives to it :wink:

Code: Select all

level.defusing_team = "axis" 
level.planting_team = "allies" 
level.targets_to_destroy = 1 
level.bomb_damage = 200 
level.bomb_explosion_radius = 2048 

   // level waittill roundstart

   thread desk_document_check

   //$door_bomb thread global/obj_tick.scr::bomb_thinker//whats tick?
   $door_bomb thread global/obj_dm.scr::bomb_thinker
   $radio_obj thread global/obj_dm.scr::bomb_thinker

   $door_bomb thread allies_win_bomb $documents $radio_obj
   $door_bomb thread axis_win_timer

   //level waittill axiswin
 end 

 // Document checks
 desk_document_check:
   while(1) 
{ 


     $documents_trigger waittill trigger

     if(parm.other.dmteam == allies) 
{
       $documents hide

       break
     }
     waitframe
   }
   //teamwin allies
 end 

allies_win_bomb local.bomb1 local.bomb2:

   while ((local.bomb1.exploded != 1) && (local.bomb2.exploded != 1))
      wait .1
      
   teamwin allies
end

axis_win_timer:

   level waittill axiswin

end
Image
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

obj_tick.scr is a custom version of obj_dm.scr, quicker arm and disarm of bomb ect.

The door_bomb isn't an objective just a bomb to blow a panel of wood off a doorway to access a house.

Documents is the first objective and i need help scripting for the radio part as i have never done scripting before.

Maybe i could have the documents left as an objective and just do a bomb radio objective, just combining objectives with the steal objective i can't do either and the tut when i do it don't work for combining multiple different objectives

any help would be appriciated, i may have to setup my radio for bombing first
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

here it is

Code: Select all

// SOUTHERN FRANCE
// ARCHITECTURE: SENN
// SCRIPTING: POWZER
//MoD by:Green Beret

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Allies"
setcvar "g_obj_alliedtext2" "Explode V2"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" "  Axis"
setcvar "g_obj_axistext3" "  Defend V2"

setcvar "g_scoreboardpic" "m1|2a"

	level waitTill prespawn
//fire for rocket------------------------------------------------------------
local.damage3 = spawn script_model targetname exploderfire
local.damage3 model "models/emitters/explosion_tank.tik"
local.damage3.origin = ( -783.20 -765.83 848.13 )
local.damage3.angles = 0
local.damage3 solid
local.damage3.set = 1
//v2 rocket------------------------------------------------------------------
local.v2 = spawn script_model targetname t17
local.v2 model "models/static/v2.tik"
local.v2.origin = ( -783.20 -765.83 448.13 ) 
local.v2.angles = ( 0 0 0 )
local.v2 solid
//ctrl room bomb-------------------------------------------------------------
local.ctrl = spawn script_model targetname t18
local.ctrl model "models/miscobj/radio_military.tik"
local.ctrl.origin = ( 1103.13 286.73 304.13 ) 
local.ctrl.angles = ( 0 -90 0 )
local.ctrl solid
//exp------------------------------------------------------------------------
local.exp = spawn script_model targetname v2_explode
local.exp model "models/items/pulse_explosive.tik"
local.exp.origin = ( -672.20 -770.83 488.13 ) 
local.exp.angles = ( 0 180 0 )
local.exp solid
local.exp.exploder_set = 1
local.exp.trigger_name = v2_bomb
local.exp.target = t17
//exp1-----------------------------------------------------------------------
local.exp1 = spawn script_model targetname ctrlroom_explode
local.exp1 model "models/items/pulse_explosive.tik"
local.exp1.origin = ( 1081.42 235.32 304.13 ) 
local.exp1.angles = ( 0 0 0 )
local.exp1 solid
local.exp1.exploder_set = 2
local.exp1.trigger_name = ctrlroom_bomb
local.exp1.target = t18	
//explosion------------------------------------------------------------------
local.damage2 = spawn script_model targetname exploderfire
local.damage2 model "models/emitters/explosion_tank.tik"
local.damage2.origin = ( -783.20 -765.83 648.13 )
local.damage2.angles = 0
local.damage2 solid
local.damage2.set = 1
//explosion1-----------------------------------------------------------------
local.ctrldamg = spawn script_model targetname exploderfire
local.ctrldamg model "models/emitters/explosion_tank.tik"
local.ctrldamg.origin = ( 1081.42 235.32 604.13 )
local.ctrldamg.angles = 0
local.ctrldamg solid
local.ctrldamg.set = 2
//switch trigger 2-----------------------------------------------------------
local.bombtrig = spawn trigger_use targetname v2_bomb
local.bombtrig.origin = ( -650.20 -765.83 488.13 )
local.bombtrig setsize ( -10 -10 -10 ) ( 60 60 60 )
local.bombtrig wait 1
local.bombtrig delay 0
//switch trigger 3-----------------------------------------------------------
local.bombtrig1 = spawn trigger_use targetname ctrlroom_bomb
local.bombtrig1.origin = ( 1081.42 235.32 304.13 )
local.bombtrig1 setsize ( -10 -10 -10 ) ( 60 60 60 )
local.bombtrig1 wait 1
local.bombtrig1 delay 0
//---------------------------------------------------------------------------

	//*** Precache Dm Stuff
	exec global/DMprecache.scr

	level.script = maps/dm/mohdm1.scr
	exec global/ambient.scr mohdm1

	thread global/exploder.scr::main

	level waittill spawn

        level.defusing_team = "axis"
	level.planting_team = "allies"
	level.bomb_damage = 200
	level.bomb_explosion_radius = 2048

	// set the parameters for round based match
	level.dmrespawning = 1 // 1 or 0
	level.dmroundlimit = 7 // round time limit in minutes
	level.clockside = axis // set to axis, allies, kills, or draw
	
		
		$v2_explode thread global/obj_dm.scr::bomb_thinker
		$ctrlroom_explode thread global/obj_dm.scr::bomb_thinker
		
		thread allies_win_bomb $v2_explode $ctrlroom_explode
		$v2_explode thread axis_win_timer
		
end

//*** --------------------------------------------
//*** "Allies Victory"
//*** --------------------------------------------

allies_win_bomb local.bomb1 local.bomb2:

	while (local.bomb1.exploded != 1)
		wait .1
	while (local.bomb2.exploded != 1)
		wait .1
end

//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------

axis_win_timer:

	level waittill axiswin

end
Last edited by Green Beret on Sun Mar 13, 2005 4:28 am, edited 1 time in total.
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

You want a "retrieve document and send its info over radio" objective, right?
Not a sepate "document objective" followed by a "use radio" objective, right?

If so: you will need to:
1) mark the player that triggers the doc objective.

Code: Select all

parm.other.has_docs = 1
... would work for that just after he has triggerad the objective.
2) only let people with documents trigger the radio.

Code: Select all

if(parm.other.has_docs == 1 )
...would test that just after he has triggered the radio objective.
3) Continuosly scan the player to check if he is alive, else respawn the docs objective.
4) Continuosly scan the player to check if he is still on the server, so he does not take the docs, logout, and destroy the game for the rest of the players.

Check my Liberation for MOH:AA tutorial for scanners like that: http://gronnevik.se/rjukan/index.php?n= ... ionInMOHAA

In conclution, it is a lot of work and will result in a VERY complex script. It will also result in a complex gameplay, and as people are hard enough to persuade to try a new map at all: I'd suggest making a sepate "document objective" followed by a "use radio" objective...

But if you want something hard to bite in to learn scripting, you may learn a lot. Just make sure you are comfortable with basic scripting before you start the complex stuff.
Admin .MAP Forums
Image
Head above heels.
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

do you know of any use radio objectives tuts as i can't find many objective tutorials.

I will do the use obj instead, too complex and like you say may not play it

Cheers
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

A use radio would look exactly like a document objective, but with a radio model instead of a document.
Admin .MAP Forums
Image
Head above heels.
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

Havn't seen tutes for this, I just made it up to suit the map, here is a couple of routines you can use and adapt to your own scenario.
The script spawns in a radio and a trigger, then sets up a looping thread to monitor the trigger, if conditions are met it will start a countdown routine. It is art of a multi objective mod I made for Holland, the map is loaded as a roundbased game and the gametype is changed to obj mode. For use in your obj you could make the teamwin condition at the end of the counter to give the opposit team a chance to stop the countdown, it's very similar to the standard bomb thinker really only this is local to a specific map.

Code: Select all

main:

 if(level.roundbased)
  thread roundbasedthread

----
----
level waittill prespawn
----
----
level waittill spawn


end

//---------------------
roundbasedthread:
//---------------------
  setcvar "g_gametype" "4"    //set game to OBJ mode
  // set scoreboard for OBJ mode
  setcvar "g_obj_alliedtext1" "Prevent Axis calling" 
  setcvar "g_obj_alliedtext2" "their Tank to start"
  setcvar "g_obj_alliedtext3" "Or destroy it"
  
  setcvar "g_obj_axistext1" "Call the Tank &"
  setcvar "g_obj_axistext2" "protect it until"
  setcvar "g_obj_axistext3" "it reaches Allies area"
  
//------------------------
  level waitTill prespawn
//------------------------
  exec global/ambient.scr
  exec global/door_locked.scr
  exec global/DMprecache.scr

//------------------------  
	level waittill spawn
//------------------------

	// set the parameters for this round based match
	level.dmrespawning = 1
	level.dmroundlimit = 15
	level.clockside = allies

//------------------------
//	level waittill roundstart
//------------------------

  waitthread setup_axisradio
  thread axis_try_to_start_tank

end


//------------------------
 setup_axisradio:
//------------------------

  //radio axis use to start up the tank
  local.radio = spawn models/miscobj/radio_military_pulsing.tik
  local.radio.origin = ( -1190.42 -1007.43 298.13 )
  local.radio.angles = ( 0.00 179.24 0.00 )
  local.radio notsolid
  local.radio nodamage
  local.radio targetname "axis_radio"
  
  //trigger on radio
  local.trig = spawn trigger_use 
  local.trig.origin = $axis_radio.origin
  local.trig.angles = $axis_radio.angles
  local.trig setsize ( -40 -40 -40 ) ( 40 40 40 )
  local.trig targetname "axis_trigger"

end

//------------------------
 axis_try_to_start_tank:
//------------------------
 level.tank_called = 0
 level.tank_away = 0
 
 while (1)
 {
  $axis_trigger waittill trigger
  local.player = parm.other
  
  if ( level.tank_called != 1 && local.player.dmteam != axis )
   local.player iprint "What are you thinking? Only Axis can radio the tank to start!"

  if ( level.tank_called != 1 && local.player.dmteam == axis )
  {
   iprintlnbold_noloc "Axis have sent orders for their tank to move in 45 seconds."
   level.tank_called = 1
   thread time_counter     
  }
  
  if ( level.tank_called == 1 && local.player.dmteam == allies && level.tank_away !=1 )
  {
    level.tank_called = 0
    level.tank_away = 0
  }
  waitframe
 }
 
end
     
     
//------------------------ counting down from 45 to 0 //------------------------
time_counter:
//------------------------
	for ( local.timer = 45; local.timer > 0; local.timer-- )
	{
	  if ( level.tank_called == 0 )
	  {
	    iprintlnbold_noloc "Allies have stopped the tank countdown!"
	    end
	  }
	  wait 1
	  locprint 40 100 local.timer 
	}
	level.tank_away = 1
	locprint 40 100 "TOO LATE!"
	iprintlnbold_noloc "The Axis tank is now underway!"
	thread setup_allies_bomb
  wait 2
  thread start_tank
	iprintlnbold_noloc "Allies your only hope now is to detonate the bomb on the tank before it reaches your spawn area!"
end	
An ambiguous question will get a similar answer...
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Thats nice: Why dont U add it as a tutorial on my Wiki: http://gronnevik.se/rjukan/
Admin .MAP Forums
Image
Head above heels.
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

I have currently got the following script but only problem is if you use the radio before getting documents game ends, if you get the documents it dosen't end till the radio is done which is correct way.

Here is code, ?? at bottom

Code: Select all

//Farmhouse Objective Scripting

 main:
   setcvar "g_obj_alliedtext1" "- Steal the documents" 
   setcvar "g_obj_alliedtext2" "- Transmit Documents"
   setcvar "g_obj_alliedtext3" ""
   setcvar "g_obj_axistext1" "- Defend Documents"
   setcvar "g_obj_axistext2" "- Defend Radio Transmitter"
   setcvar "g_obj_axistext3" ""
   setcvar "g_scoreboardpic" "none"
   
   level waittill prespawn
   exec global/DMprecache.scr
   
   level.script = maps/obj/mp_farm_house_obj.scr
   exec global/ambient.scr mohdm2
   thread global/exploder.scr::main
   
   level waittill spawn
   // Set the parameters for round based match
   level.dmrespawning = 0
   level.dmroundlimit = 5
   level.clockside = axis
	  
	level.defusing_team = "axis"
	level.planting_team = "allies"
	level.targets_to_destroy = 2 
	level.bomb_damage = 200 
	level.bomb_explosion_radius = 2048

   // level waittill roundstart //Disabled for testing
   
   thread document_check
   thread radio_check
  
   $door_bomb thread global/obj_tick.scr::bomb_thinker // obj_tick.scr custom bomb script
   
	level waittill axiswin
end

 // Document checks
 document_check:
   while(1) {
     
     $documents_trigger waittill trigger
     
     if(parm.other.dmteam == allies) {
       
       $documents hide
      
       break
     }
     
     waitframe
   }

   //teamwin allies
end

// radio checks
 radio_check:
   while(1) {
   
     $radio_trigger waittill trigger

     if(parm.other.dmteam == allies) {

       $radio hide // leaves a non flashing radio when used

       break
     }
    
     waitframe
   }
   teamwin allies
end
Questions:

1. How can i make it so they have to steal documents then do the radio
2. how can i point the compass to these objectives in correct order

If anyone can help me with these it would be good, i have only ever mapped liberation maps so this is new, and i am sorry about all the dumb questions i am learning i am adapting tutorials for my own stuff just taking help and time
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Docs before radio:

Code: Select all

//Farmhouse Objective Scripting

 main:
	setcvar "g_obj_alliedtext1" "- Steal the documents"
	setcvar "g_obj_alliedtext2" "- Transmit Documents"
	setcvar "g_obj_alliedtext3" ""
	setcvar "g_obj_axistext1" "- Defend Documents"
	setcvar "g_obj_axistext2" "- Defend Radio Transmitter"
	setcvar "g_obj_axistext3" ""
	setcvar "g_scoreboardpic" "none"

	level waittill prespawn
	exec global/DMprecache.scr

	level.script = maps/obj/mp_farm_house_obj.scr
	exec global/ambient.scr mohdm2
	thread global/exploder.scr::main

	level waittill spawn
	// Set the parameters for round based match
	level.dmrespawning = 0
	level.dmroundlimit = 5
	level.clockside = axis

	level.defusing_team = "axis"
	level.planting_team = "allies"
	level.targets_to_destroy = 2
	level.bomb_damage = 200
	level.bomb_explosion_radius = 2048

	// level waittill roundstart //Disabled for testing

	thread document_check

	// obj_tick.scr custom bomb script
	$door_bomb thread global/obj_tick.scr::bomb_thinker

	level waittill axiswin
end

// Document checks
document_check:
	while(1) {
		$documents_trigger waittill trigger
		if(parm.other.dmteam == allies) {
			$documents hide
			break
		}
		waitframe
	}
	thread radio_check
	
end

// radio checks
radio_check:
	while(1) {
		$radio_trigger waittill trigger
		if(parm.other.dmteam == allies) {
			$radio hide // leaves a non flashing radio when used
			break
		}
		waitframe
	}
	teamwin allies
end
Compass... you can do this in SP, not sure you can do it in MP at all... but I've been in error before :)
Admin .MAP Forums
Image
Head above heels.
Post Reply