Page 1 of 1

Scripting with documents and bombs

Posted: Wed Apr 09, 2003 6:12 pm
by Faceball
I saw the tut on these and had some questions so i have been talking to the creator of the tuts personally. He asked me to post a few questions i had along with the responses for others to see to help others who may have the same questions.
Bjarne BZR wrote:Q: I used your tut perfectly when making a control panel. When i tried using the flak model it didn't work. Will the tut work when using just the flak cannon model or do you have to create an obj from brushes each time? I tried the tut and it wouldn't let me set the bomb.

A: There should be no difference... the undestroyed flak should have targetname = exploder instead of the panel.
But if you cant set the bomb there is probably someting wrong in the exploder setup ( such as wrong value of the bombs $trigger_name ). Write logfile 1 ( to start a new logfile ) or logfile 2 ( to keep writing in the old one ) on the consol, to get a text file in main that will contain any errors...
Bjarne BZR wrote:Q:When scripting more than one document to steal do each need a specific name? (ie desk/wall)

A:Each document objective must have a unique targetname, and the same goes for the triggers.

Bjarne, i cannot thank you enough for making such an easy to follow tut for us new guys trying to learn. For anyone learning to script bombs i HIGHLY recommend using his tut's( they are both in the MP tut section)

Posted: Wed Apr 09, 2003 8:13 pm
by Bjarne BZR
Glad to help.

And there is also a tutorial on putting together multiple objectives of multiple types here( follows after my blow and doc objective tutorials )

Posted: Wed Apr 09, 2003 10:24 pm
by Faceball
Is there a way to script in messages to pop up and say that the bomb has exploded and msg for each document to let players know which docs have been stolen?

I have seen scripts using methods to do this, but the scripting is different from this tut.

Thx for any help.

Posted: Wed Apr 09, 2003 11:50 pm
by Bjarne BZR

Code: Select all

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
The line you want is the iprintlnbold_noloc "Desk documents have been stolen!", it prints a text in the same way as the allied breach in "The Hunt" map.
The line println ("Desk documents stolen.") prints a message in the consol.
The line setcvar "g_obj_alliedtext2" "[X]Steal wall documents" updates the text in the status screen ( it was "[ ]Steal wall documents" before ).

This is almost exactly how my script for Vemork factory OBJ looks, download it and look at the scripting if you like...

Posted: Wed Apr 09, 2003 11:55 pm
by Bjarne BZR
Oh right, you asked about the bomb too:

Code: Select all

bomb_writer:
	while(self.exploded != 1) {
		waitframe
	}
	iprintlnbold_noloc "Destillers have been destoyed!"
	setcvar "g_obj_alliedtext1" "[X]Smash the distillers"
end
And they are started like this:
$desk_document_trigger thread document_check
$wall_document_trigger thread document_check
$distiller_bomb thread bomb_writer

( the first aggument becomes the 'self' in the methods by starting the threads like this)

Posted: Sun Apr 13, 2003 7:01 pm
by Faceball
AWESOME!!!!!! Worked like a charm. Thanks again for all you help.