On and off trigger script

Post your scripting questions / solutions here

Moderator: Moderators

bodybagger
Sergeant
Posts: 52
Joined: Mon Jan 06, 2003 5:27 pm

On and off trigger script

Post by bodybagger »

Can someone help me with a small script?
I have a plane that does a bomb run. there is a radio with a trigger use and targetnamed bombertrigger.
Now i want the allies to activate the trigger and call an air strike and the axis to be able to de-activate it,
Could some please help,
Thanks
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Just a few variables will do it, but you can't use a 'bombertrigger' in this case, for it doesn't allow a team check. Give the trigger a key 'setthread' with value for example 'airstriketrigger'.

In your script, type something like this:

Code: Select all

airstriketrigger:
    local.triggerer = parm.other
    if(local.triggerer.dmteam == axis)
    {
        // deactivate the trigger
        $<triggername> nottriggerable
    }
    else
    {
        // must be allies
        // airstrike code here (or use script to trigger a $bombertrigger)
    }
end
Image
bodybagger
Sergeant
Posts: 52
Joined: Mon Jan 06, 2003 5:27 pm

Post by bodybagger »

I am still having problems, nothing seams to happen!!!
I have the trigger set up as follows:
$triggername airstrike
$setthread airstriketrigger
Which trigger should i use. I tried bot trigger_use and trigger_multiple
Here's my code:

Code: Select all

/////////////////////////////
////  airstrike         ////
////////////////////////////
airstriketrigger: 
    local.triggerer = parm.other 
    if(local.triggerer.dmteam == axis) 
    { 
        // deactivate the trigger 
        $airstike nottriggerable
        iprintlnbold_noloc "The Axis have called of the air strike!" 
    } 
    else 
    { 
        // must be allies 
        thread callairstrike 
    	iprintlnbold_noloc "The Allies have called an air strike!!"
    } 
end 

//////////////////////
/// call air stike///
/////////////////////
callairstrike:

	wait 1.0
	thread global/bomber.scr::bomb 40
	wait (randomint(50) +20)
	
goto callairstrike
end
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

$setthread should be setthread and $triggername should be targetname ;)
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

more

Post by tltrude »

I think you need to explain better what you want to happen. Do you want the bombs to drop until the axis turn it off, or do you want there to be a timer the axis can turn off before the airstrike begins?

Here is what I have so far, but I'm not sure it is what you want.

Code: Select all

//////////////////////////// 
////  airstrike         ////
////////////////////////////
 
airstriketrigger:

level.airstriketimer = 0
level.controllingteam = "axis"

while (1)  // This line has been changed....
	{
	$airstrike waittill trigger 
	local.player = parm.other 
	if ((local.player.dmteam == "axis") && (level.controllingteam == "allies"))
		{
		iprintlnbold_noloc "The Axis have aborted the air strike!!"
		goto airstriketrigger
		break
		} 
	if ((local.player.dmteam == "allies") && (level.controllingteam == "axis"))
		{
		iprintlnbold_noloc "The Allies have called an air strike!!"
		level.controllingteam = "allies" 
		}
	if (level.airstriketimer >= 60) 
		{
		thread callairstrike 
		iprintlnbold_noloc "Bombers on the way!!"
		$airstrike nottriggerable
		break
		}
	level.airstriketimer ++
	iprintln ("60 second timer = " + level.airstriketimer)
	wait 1
	}
	waitframe
 
end 

////////////////////// 
/// call air stike/// 
///////////////////// 
callairstrike: 

   wait 1.0 
   thread global/bomber.scr::bomb 40 
   wait (randomint(50) +20) 
    
goto callairstrike 
end
You should take out the "setthread" from the trigger_use, and put "thread airstriketrigger" under "level waittill prespawn" for the above script to work.
Last edited by tltrude on Mon May 05, 2003 1:51 pm, edited 6 times in total.
Tom Trude,

Image
bodybagger
Sergeant
Posts: 52
Joined: Mon Jan 06, 2003 5:27 pm

Post by bodybagger »

Tom, yeah i like your idea of having a timer, never thought of that.
I will try it out later.
I want the allied to call an airstrike which randomly happens with re-peat bombing and the axis have to switch of the airstrike radio.

Just some questions, when ever the game starts or re-starts the trigger some how activates depending on which side you are on without doing anything. Thats what i got from using the script that i posted above.
The other q? is which would be the right trigger to use?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

re-read

Post by tltrude »

I have been updating the script while you were posting, so re-copy it. Use a trigger_use (no setthread) and targetname it "airstrike". And, put "thread airstriketrigger" under "level waitill prespawn".

key: targetname
value: airstrike

And, check my spelling in the script because I keep misspelling airstrike!!! LOL!

Is this an objective in an objective match?
Tom Trude,

Image
bodybagger
Sergeant
Posts: 52
Joined: Mon Jan 06, 2003 5:27 pm

Post by bodybagger »

cool, thanks. i am gonna try it now.
Its not an objective, but its aimed at making the objectives harder to achive for both sides
bodybagger
Sergeant
Posts: 52
Joined: Mon Jan 06, 2003 5:27 pm

Post by bodybagger »

I have tried the cript and am getting a script complie error which says:
Bad Tolken
Right braket tolken line 104 which points to the last right bracket in the script you wrote.

Help me!! :)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

if (level.airstriketimer >= 60)

should be

if (level.airstriketimer >= 60) {
Image
bodybagger
Sergeant
Posts: 52
Joined: Mon Jan 06, 2003 5:27 pm

Post by bodybagger »

ok great fixed that, But....now i get this error
Unknown command: brake
brake line what ever
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Hehe didn't even see that :)

All 'brake's should be 'break'.
Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

lol spelling mustakes like these mistakes will effect MoH, so be careful to speel corecctly each time you try to scipt.
Live to map, not map to live.
-mohaa_rox, .map
moderator
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Exacly ;)
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Never

Post by tltrude »

I never make mistakes!! look at the script again. It must be your eyes. LOL.
Tom Trude,

Image
Post Reply