Page 1 of 1

Capturing more than one document

Posted: Sat Jul 30, 2005 9:40 pm
by Goldeneye090
This is part of one of my old map's script for a Steal-the-Document objective. It worked, but for my new map I want to make it work for 3 different documents. How would I do this?

Code: Select all

level waittill spawn

thread desk_document_check

Code: Select all

//***--------------------------------------------
//*** "Document Checks"
//*** --------------------------------------------


desk_document_check: 

while(1) 
{ $documents_trigger waittill trigger // Dont execute past this line until triggered 
if (parm.other.dmteam == axis) 
{ // parm.other is the triggerer 
$documents hide 
break // exit the while loop 
} 
waitframe 
} 
teamwin axis 
end

Thanks.

Posted: Sat Jul 30, 2005 10:12 pm
by agentmad007
Here is a way how you could do that ....


Add 3 documents to your map called whatever you want , by defaut lets say:

$document1
$document2
$document3

each one surrounded by a trigger_use

$document1_trigger
$document2_trigger
$document3_trigger

you can do that by mapping or scripting.

----------------------------------------------------------

Your script now :

Code: Select all


level waittill spawn 


level.num_docs_to_steal = 3    //obviously the 3 docs you have to rob
level.docs_in_possession = 0   //and what you ve robbed (nuthin )

$documents1 thread objective1
$documents2 thread objective2
$documents3 thread objective3



end


objective1:

$documents1_trigger waittill trigger

if (parm.other.dmteam == axis)//chose the team
{ 
$documents1 hide
level.docs_in_possession++ //That will add 1 point 
}

thread win_status//check if the 3docs has been stealed

end

objective2:

$documents2_trigger waittill trigger

if (parm.other.dmteam == axis)//chose the team
{ 
$documents2 hide
level.docs_in_possession++ //That will add 1 point 
}

thread win_status//check if the 3docs has been stealed

end


objective3:

$documents3_trigger waittill trigger

if (parm.other.dmteam == axis)//chose the team
{ 
$documents1 hide
level.docs_in_possession++ //That will add 1 point 
}

thread win_status//check if the 3docs has been stealed

end


win_status:

if(level.num_docs_to_steal == level.docs_in_possession)
{
teamwin axis
}


end



Posted: Sat Jul 30, 2005 10:28 pm
by Goldeneye090
Thanks. To win, the allies not only have to steal all three documents, but also destroy a flak canon (the flak canon script works as well). How would I combine the two so the script knows the allies have to complete both objectives, not just the flak or the documents seperately? Here's what the script looks like all-together:

Code: Select all

 
 // Obj_Bunkers
 // ARCHITECTURE: GoldenEye
 // SCRIPTING: GoldenEye

main:


setcvar "g_obj_alliedtext1" "Destroy the Flak" 
setcvar "g_obj_alliedtext2" "Steal the Documents"
setcvar "g_obj_alliedtext3" "Kill Axis" 
setcvar "g_obj_axistext1" "Defend the Flak"
setcvar "g_obj_axistext2" "Protect the Documents"
setcvar "g_obj_axistext3" "Kill Allies"
setcvar "g_scoreboardpic" "none"


level waittill prespawn


exec global/DMprecache.scr
exec global/door_locked.scr::lock
exec global/ambient.scr Obj_Bunkers
level.script = maps/obj/Obj_Bunkers.scr


level waittill spawn

$documents1 thread objective1 
$documents2 thread objective2 
$documents3 thread objective3

level.num_docs_to_steal = 3    //obviously the 3 docs you have to rob 
level.docs_in_possession = 0   //and what you ve robbed (nuthin ) 

level.bomb_damage = 200
level.bomb_explosion_radius = 640
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 1
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw 

// level waittill roundstart

// Set the parameters for round based match
level.dmrespawning = 0 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

$flak88_explosive1 thread global/obj_dm.scr::bomb_thinker
$flak88_explosive1 thread axis_win_timer

thread allies_win_bomb
thread desk_document_check

end // end of main


objective1: 

$documents1_trigger waittill trigger 

if (parm.other.dmteam == allies)//chose the team 
{ 
$documents1 hide 
level.docs_in_possession++ //That will add 1 point 
} 
thread win_status//check if the 3docs has been stealed 

end 

objective2: 

$documents2_trigger waittill trigger 

if (parm.other.dmteam == allies)//chose the team 
{ 
$documents2 hide 
level.docs_in_possession++ //That will add 1 point 
} 
thread win_status//check if the 3docs has been stealed 

end 


objective3: 

$documents3_trigger waittill trigger 

if (parm.other.dmteam == allies)//chose the team 
{ 
$documents1 hide 
level.docs_in_possession++ //That will add 1 point 
} 
thread win_status//check if the 3docs has been stealed

end 


win_status: 

if(level.num_docs_to_steal == level.docs_in_possession) 
{ 
teamwin allies 
} 

end 



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

axis_win_timer:

level waittill axiswin

end

//*** --------------------------------------------
//*** "Allied Victory"
//*** --------------------------------------------

allies_win_bomb:

while(level.targets_destroyed < level.targets_to_destroy)
waitframe

teamwin allies
end

Posted: Sat Jul 30, 2005 10:54 pm
by agentmad007
Try this but i am not sure

Code: Select all


 // Obj_Bunkers
 // ARCHITECTURE: GoldenEye
 // SCRIPTING: GoldenEye

main:


setcvar "g_obj_alliedtext1" "Destroy the Flak"
setcvar "g_obj_alliedtext2" "Steal the Documents"
setcvar "g_obj_alliedtext3" "Kill Axis"
setcvar "g_obj_axistext1" "Defend the Flak"
setcvar "g_obj_axistext2" "Protect the Documents"
setcvar "g_obj_axistext3" "Kill Allies"
setcvar "g_scoreboardpic" "none"


level waittill prespawn


exec global/DMprecache.scr
exec global/door_locked.scr::lock
exec global/ambient.scr Obj_Bunkers
level.script = maps/obj/Obj_Bunkers.scr


level waittill spawn

$documents1 thread objective1
$documents2 thread objective2
$documents3 thread objective3

level.obj_to_achieve = 4  
level.obj_done = 0   

level.bomb_damage = 200
level.bomb_explosion_radius = 640
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 1
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

// level waittill roundstart

// Set the parameters for round based match
level.dmrespawning = 0 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

$flak88_explosive1 thread global/obj_dm.scr::bomb_thinker
$flak88_explosive1 thread axis_win_timer

thread check_if_my_bomb_exploded

end // end of main



check_if_my_bomb_exploded:

while (true)
{

if($flak88_explosive1.exploded ==1)
{
println "the bomb has exploded"
level.obj_done++
thread win_status //check if the 4 obj are done
}
wait 10

}

end 

objective1:

$documents1_trigger waittill trigger

if (parm.other.dmteam == axis)//chose the team
{
$documents1 hide
level.obj_done++ //That will add 1 point
}

thread win_status //check if the 4 obj are done

end

objective2:

$documents2_trigger waittill trigger

if (parm.other.dmteam == axis)//chose the team
{
$documents2 hide
level.obj_done++ //That will add 1 point
}

thread win_status //check if the 4 obj are done

end


objective3:

$documents3_trigger waittill trigger

if (parm.other.dmteam == axis)//chose the team
{
$documents1 hide
level.obj_done++ //That will add 1 point
}

thread win_status //check if the 4 obj are done

end


win_status:

if(level.obj_done  == level.obj_to_achieve)
{
teamwin allies
}

end



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

axis_win_timer:

level waittill axiswin

end


The scanner will check if the bomb has exploded and will add a point to the level_obj_done so if the 4 obj are achieved the allies team will win

First exploded the bomb and check if the console says : BOMB HAS EPXLODED , if so the the script will work otherwise come back here......

Posted: Sun Jul 31, 2005 12:28 am
by Goldeneye090
That script didn't work :cry:, the scoreboard messages didn't even come up.

Posted: Sun Jul 31, 2005 1:00 am
by agentmad007
send your map + script to agentmad007@hotmail.com if it not to big , there is no way for the scoreboard not being displayed

you mmight have done something wrong

Posted: Sun Jul 31, 2005 2:43 am
by agentmad007

Code: Select all

// ARCHITECTURE: GoldenEye
// SCRIPTING: GoldenEye

main: 


setcvar "g_obj_alliedtext1" "Destroy the Flak" 
setcvar "g_obj_alliedtext2" "Steal the Documents" 
setcvar "g_obj_alliedtext3" "Kill the Axis" 
setcvar "g_obj_axistext1" "Defend the Flak" 
setcvar "g_obj_axistext2" "Protect the Documents" 
setcvar "g_obj_axistext3" "Kill the Allies" 
setcvar "g_scoreboardpic" "none" 


level waittill prespawn 


exec global/DMprecache.scr 
exec global/door_locked.scr::lock 
exec global/ambient.scr Obj_Bunkers 
level.script = maps/obj/Obj_Bunkers.scr 


level waittill spawn 

$documents1 thread objective1 
$documents2 thread objective2 
$documents3 thread objective3 

level.obj_to_achieve = 4  
level.obj_done = 0    

level.bomb_damage = 200 
level.bomb_explosion_radius = 640 
level.defusing_team = "axis" 
level.planting_team = "allies" 
level.targets_to_destroy = 1 
level.dmrespawning = 0 // 1 or 0 
level.dmroundlimit = 5 // round time limit in minutes 
level.clockside = axis // set to axis, allies, kills, or draw 

// level waittill roundstart 

// Set the parameters for round based match 
level.dmrespawning = 0 // 1 or 0 (0=no respawn) 
level.dmroundlimit = 5 // round time limit in minutes 
level.clockside = axis // set to axis, allies, kills, or draw 

$flak88_explosive1 thread global/obj_dm.scr::bomb_thinker 
$flak88_explosive1 thread axis_win_timer 

thread check_if_my_bomb_exploded 

end // end of main 



check_if_my_bomb_exploded: 

while (true) 
{ 

	if ($flak88_explosive1.exploded ==1) 
	{ 

	thread bomb_obj_done

	} 

wait 10 

} 

end 

bomb_obj_done:

if(level.point_added !=1)
{
level.point_added = 1
println "the bomb has exploded" 
level.obj_done++ 
thread win_status
}

end

objective1: 

$documents1_trigger waittill trigger 

if (parm.other.dmteam == axis)//chose the team 
{ 
$documents1 hide 
level.obj_done++ //That will add 1 point 
} 

thread win_status

end 

objective2: 

$documents2_trigger waittill trigger 

if (parm.other.dmteam == axis)//chose the team 
{ 
$documents2 hide 
level.obj_done++ //That will add 1 point 
} 

thread win_status

end 


objective3: 

$documents3_trigger waittill trigger 

if (parm.other.dmteam == axis)//chose the team 
{ 
$documents1 hide 
level.obj_done++ //That will add 1 point 
} 

thread win_status

end 


win_status: 

if(level.obj_done == level.obj_to_achieve) 
{ 
teamwin allies 
} 

end 



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

axis_win_timer: 

level waittill axiswin 

end 

Posted: Sun Jul 31, 2005 3:05 am
by Goldeneye090
everything but being able to steal the documents works

Posted: Sun Jul 31, 2005 6:37 am
by bdbodger
Another thing you can do is to make one thread for the documents and use the setthread key on the trigger and use something like this

Code: Select all

main:

level.docs_in_possession = 0
level.targets_to_destroy = 1
... bla ...
... bla ...

end

objectives: 

local.player = parm.other

if (local.player.dmteam == allies)//check the team 
{ 
$(self.target) hide // trigger targets the document

level.docs_in_possession++ //That will add to level.docs_in_possession
 
} 

end 


allies_win_bomb: 

// win only if both are completed

while(level.targets_destroyed < level.targets_to_destroy && level.docs_in_possession < 3) 
waitframe 

teamwin allies 
end 
You need to have the triggers target the documents for this to work and use key: setthread value: objectives

Posted: Sun Jul 31, 2005 1:52 pm
by Goldeneye090
Thanks bdbodger but the objectives work now...

The only things that dont work are the messages that come up after each objective is completed...

Code: Select all

 bomb_obj_done:

if(level.point_added !=1)
{
level.point_added = 1
println "the bomb has exploded" 
level.obj_done++ 
thread win_status
}

Code: Select all

objective1: 


if (parm.other.dmteam == allies)//chose the team 
{ 
$document1 hide 
$document1 playsound pickup_papers1
level.obj_done++ //That will add 1 point 
println "A document has been stolen"
} 

thread win_status

end 

Code: Select all

objective2: 



if (parm.other.dmteam == allies)//chose the team 
{ 
$document2 hide 
$document2 playsound pickup_papers1
level.obj_done++ //That will add 1 point
println "A document has been stolen"
} 

thread win_status

end

Code: Select all

objective3: 


if (parm.other.dmteam == allies)//chose the team 
{ 
$document3 hide 
$document3 playsound pickup_papers1
level.obj_done++ //That will add 1 point
println "A document has been stolen" 
} 

thread win_status

end
:\ I want the console to tell the players that a document has been stolen after each document is stolen...and the bomb one doesn't show up either that says it exploded.

Posted: Sun Jul 31, 2005 5:05 pm
by agentmad007
println comand will only show up in console.This comand is generaly used to debug the script and see what works what does not.

If you want the message to print on screens use :

Code: Select all

iprintln "your message"
or

Code: Select all

iprintlnbold "your message"

Posted: Mon Aug 01, 2005 7:17 am
by Bjarne BZR
A "Real world example" should help.

This is the script for the map Vemork Factory from The Rjukan Project, it has 3 objectives: one bomb + 2 documents:

Code: Select all

// obj_vemork_12
// ARCHITECTURE: Bjarne Gr?nnevik
// SCRIPTING: Bjarne Gr?nnevik
// LINK: http://members.chello.se/bjarne.gronnevik/
// VERSION: 1.2
main:

	setcvar "g_obj_alliedtext1" "[  ]Smash the distillers"
	setcvar "g_obj_alliedtext2" "[  ]Steal wall documents"
	setcvar "g_obj_alliedtext3" "[  ]Steal desk documents"
	setcvar "g_obj_axistext1"   "Defend the heavy water"
	setcvar "g_obj_axistext2"   "production plant from"
	setcvar "g_obj_axistext3"   "the allied assault."
	
	setcvar "g_scoreboardpic" "vemork_factory_small"

	// Haze
	$world farplane_color "0.3 0.3 0.3"
	level.fogplane = 5500
	$world farplane level.fogplane

	level waittill prespawn
	exec global/DMprecache.scr
	level.script = maps/obj/vemork_factory_small.scr
	exec global/ambient.scr m6l1a
	thread global/exploder.scr::main // Initialize the exploder subsystem

	level waittill spawn
	level.defusing_team = "axis" // Axis like the bombs unplanted
	level.planting_team = "allies" // Allies will try to plant the bombs
	level.targets_to_destroy = 3
	level.bomb_damage = 200 // Default damage of the bomb
	level.bomb_explosion_radius = 2048 // Default radius of bomb blast
	level.dmrespawning = 0 // 1 or 0 (0=no respawn)
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = axis // set to axis, allies, kills, or draw
	
	level waittill roundstart
	
	thread print_message
	$distiller_bomb thread global/obj_dm.scr::bomb_thinker
	$distiller_bomb thread bomb_writer
	thread allies_win_check // Start the win check thread for allies
	$distiler_bomb thread axis_win_timer // Start the win check thread for axis
	$desk_document_trigger thread document_check
	$wall_document_trigger thread document_check
end

/******************************************************************
 * Allies victory test ( Win by acieving all the 3 objectives or
 * eradication of opposing force )
 */
allies_win_check:
	while( level.targets_destroyed < level.targets_to_destroy ) {
		waitframe
	}
	teamwin allies
end

/******************************************************************
 * Axis victory test ( Win by timeout or eradication of opposing
 * force )
 */
axis_win_timer:
	level waittill axiswin // At the end Axis win
end

/******************************************************************
 * Checks the "document check-box" in the score board when a
 * document is stolen. And informs the exploder system that another
 * ojective has been stolen ( it actually thinks it has been blown
 * :) ).
 */
document_check:
	while(1) {
		self waittill trigger
		if(parm.other.dmteam == allies) { // parm.other is the triggerer
			if( self == $wall_document_trigger) {
				iprintlnbold_noloc "Wall documents have been stolen!"
				setcvar "g_obj_alliedtext2" "[X]Steal wall documents"
				println ("Wall documents stolen.")
			} else {
				if (self == $desk_document_trigger) {
					iprintlnbold_noloc "Desk documents have been stolen!"
					setcvar "g_obj_alliedtext3" "[X]Steal desk documents"
					println ("Desk documents stolen.")
				}
			}
			self playsound steal_heavy_water_document
			self.target hide
			level.targets_destroyed ++
			break // out of while loop
		}
		waitframe // protection
	}
end

/******************************************************************
 * Checks the "bomb check-box" in the score board when the bomb
 * is blown.
 */
bomb_writer:
	while(self.exploded != 1) {
		waitframe
	}
	iprintlnbold_noloc "Destillers have been destoyed!"
	setcvar "g_obj_alliedtext1" "[X]Smash the distillers"
end

/******************************************************************
 * Level start message. Printed randomly 10% of the time.
 */
print_message:
	if (randomint(10) == 0) {
		iprintlnbold_noloc "Norsk Hydro's heavy water"
		iprintlnbold_noloc "production plant at Vemork"
		iprintlnbold_noloc "in Rjukan, Norway, feb 1943."
	}
end