PDA

View Full Version : More than one trigger



Groundhog
Apr-12-2013, 07:26
Hi Guys,

I have searched everywhere for an answer to this simple problem with no luck.

I am not any kind of programmer but reading the tutorials I have managed to get a trigger working which gives a message when the primary target is destroyed by bombers.
I would now like to add another trigger to give a message when the secondary target is destroyed.
I know how to create the new trigger but don't know how you add another trigger to the script .cs document.
Do you just add it at the bottom ?
I assume you need to insert it somehow within the brackets but have no clue of the correct layout.

please help.

Groundhog

bolox
Apr-12-2013, 09:33
yes you will need to put the statement in the correct place within the brackets. should look something like this

public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);



if (GamePlay.gpGetTrigger("land").Active)
{
lnd = ++lnd; //increement lnd counter

//GamePlay.gpHUDLogCenter("land:"+lnd);
}
if (GamePlay.gpGetTrigger("mis").Active)
{
end = true;
//GamePlay.gpHUDLogCenter("!"); // define reached mission objective
}
}

the 'public override void' part has a set of brackets {} which contains everything in this part of the script. the 2 trigger statements go inside these brackets.

If you are starting to mess with scripts I highly recommend notepad++ instead of notepad supplied with windows. One of it's great features is it highlights bracket pairs in scripts

Groundhog
Apr-12-2013, 10:10
Thanks for the help.

Will try this out.

cheers

GH

Groundhog
Apr-12-2013, 12:21
It's working fine now.

Thanks again for the help.


GH