Jump to content
Sign in to follow this  
blakord

setTriggername?

Recommended Posts

Hiya

I can make a trigger by script with almost all values like

Trigger Activation

Trigger Area

Trigger Statements

Trigger Text

Trigger Timeout

Trigger Type

But there no way to give a unique name to the trigger (setTriggername or anything), any one know how make named trigger by script?

Thanks

Share this post


Link to post
Share on other sites

This is an example of one of the classes that were automatically created in a mission.sqm file that I was working on a while back.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Item0

{

position[]={12597.251953,19.876329,6629.867676};

a=5.000000;

b=5.000000;

activationBy="ALPHA";

repeating=1;

interruptable=1;

age="UNKNOWN";

name="t1";

expActiv="[p1, ""Small""] exec ""IED.sqs""; trig2 = true";

class Effects

{

};

};

Directly under age="unknown" is the name="t1" tag. This is the name of the trigger in the mission as I know because T1 would trigger T2 and so on...

Just drop in the name="TriggerName" in your mission.sqm along with all the other info..or in your script...should work the same.

Edit: Ah, I see what you mean now. You're working on an SQF file? What about adding the _name variable to the array in the class?

ala Kronzky's Mine Field Script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// trig values

_cosdir=cos(_areadir*-1);

_sindir=sin(_areadir*-1);

// size

_areasize = getMarkerSize _areamarker;

_sizeX = _areasize select 0;

_sizeY = _areasize select 1;

// position

_centerpos = getMarkerPos _areamarker;

_centerX = abs(_centerpos select 0);

_centerY = abs(_centerpos select 1);

Could you just add a _name="TriggerName" to the trigger?

Share this post


Link to post
Share on other sites
But there no way to give a unique name to the trigger (setTriggername or anything), any one know how make named trigger by script?

Thanks

Ehm, why would you want to do that?

You have the variable right when you create it

trigger = createTrigger [type, position];

where trigger will be the "name"

Same goes with all other created stuff in this game, except for markers, I'll return to those later.

Example vehicles:

The name field in the editor will be that vehicles "variable"

or "variable name" if you so like.

same goes if you script create the vehicle

jeep = "HMMWV" createVehicle (position);

Again, jeep will be the "name"

You don't see any setVehicleName commands either.

Markers do use a name, and is set during the creation(scripted)

marker = createMarker ["Marker1", position]

The thing here is now you can access this created marker by using two ways

either:

marker setMarkerColor "colorGreenAlpha";

or

"Marker1" setMarkerColor "colorGreenAlpha";

I haven't tried script-creating markers with the same name, but it "shouldn't" work.

Markers need to be unique, thus they have a "name".

But, all other things needs to be unique too, like try to place two vehicles with the name in the editor

"variable name in use"

jeep = "HMMWV" createVehicle (position);

jeep = "HMMWV" createVehicle (position);

will create two vehicles, but you can only "access" the last one, the first one doesn't have a "name"

Did this make any sense at all?

Share this post


Link to post
Share on other sites

That made sense to me Taurus. Thanks! I'll give that stuff a try when I get off work, haven't done that stuff before but I'd like to try it out.

Basically, every object has a name before its creation and that name must be unique, yes?

As well, the reason for giving triggers names is so that you can trigger another trigger, by the deactivation of the first trigger. Used with an IED script per se, you make pseudo carpet bombing, chain reaction anti-personell mines...anything that may use a "chain reaction" type execution, can be used this way.

smile_o.gif

Share this post


Link to post
Share on other sites
That made sense to me Taurus. Thanks! I'll give that stuff a try when I get off work, haven't done that stuff before but I'd like to try it out.
Excellent! smile_o.gif
Basically, every object has a name before its creation and that name must be unique, yes?

Yes, the editor wouldn't allow you to put the same name in the name field.

If you put

MyCar = this;

in the first car's init-field

and then

MyCar = this;

in the second car's init-field

MyCar will be a reference(or variable name, or "name") of the second car.

i.e.

MyCar setDammage 1; will blow up the second car.

As well, the reason for giving triggers names is so that you can trigger another trigger, by the deactivation of the first trigger. Used with an IED script per se, you make pseudo carpet bombing, chain reaction anti-personell mines...anything that may use a "chain reaction" type execution, can be used this way.

smile_o.gif

Now you used a abbreviation I don't know what it means IED?

But, if you want to trigger other triggers, aren't it made by playing with booleans true or false?

Or do you want to use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

{

//do stuff

}forEach list myOtherTrigger;

or in the "statment" of the second trigger put something like

check if something is in myOtherTrigger

in the first case it's rather simple, just use the variable(name)

in the second case...

confused_o.gif

Maybe

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_triggerOnAct = format["""check if something is in %1""",myOtherTrigger];

...

newTrigger setTriggerStatements[_triggerOnAct, "hint ""Hello""", ""];

Will work? (may be one too many or too less " for that code above to work)

Haven't tried it with variables other than strings, like

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_myString = "Rackanishu";

_triggerOnAct = format["hint ""%1""",_myString];

...

newTrigger setTriggerStatements["this", _triggerOnAct, ""];

That one does work, and will hint "Rackanishu"

[edit1]

I'll experiment with this as soon as Norton has scanned my computer. CPU@100% and reading from disk = choppy Arma

Share this post


Link to post
Share on other sites

Whoa. LOL. You lost me at Boolean. I know what it is, but not it's syntax or structure  rofl.gif

I follow, but I always create my triggers in the editor, not via script because I'm a newbie! LOL. I suck with syntax! haha

I'm gonna have a look at what you have there, and play with it until I can get my head around it. Thanks!

IED is an acronym for improvised explosive device, a script in ArmA that is used to (camcreate or createvehicle(?) ) fire an explosive round at the coordinates of the implicated unit.

smile_o.gif

Share this post


Link to post
Share on other sites
Whoa. LOL. You lost me at Boolean. I know what it is, but not it's syntax or structure rofl.gif

Neither do I, I just pretend I do wink_o.gif

I follow, but I always create my triggers in the editor, not via script because I'm a newbie! LOL. I suck with syntax! haha

Don't be so hard on yourself, only the BIS-developers can call themselves true masters of scripting.

I was talking about this

Say you have three triggers, created in the editor.

Trigger1:

condition: this

onAct: myCheck1 = true;

Trigger2:

condition: myCheck1

onAct: myCheck2 = true;

Trigger3:

condition: myCheck2

onAct: myCheck1 = false; myCheck2 = false;

This is what you want to accomplish, but with scripting right?

IED is an acronym for improvised explosive device, a script in ArmA that is used to (camcreate or createvehicle(?) ) fire an explosive round at the coordinates of the implicated unit.

Cool!

Never heard of it before.

[edit]

Norton still scanning...

1262000 + files and still isn't done sad_o.gif

Share this post


Link to post
Share on other sites
I was talking about this

Say you have three triggers, created in the editor.

Trigger1:

condition: this

onAct: myCheck1 = true;

Trigger2:

condition: myCheck1

onAct: myCheck2 = true;

Trigger3:

condition: myCheck2

onAct: myCheck1 = false; myCheck2 = false;

This is what you want to accomplish, but with scripting right?

IED is an acronym for improvised explosive device, a script in ArmA that is used to (camcreate or createvehicle(?) ) fire an explosive round at the coordinates of the implicated unit.

Cool!

Never heard of it before.

[edit]

Norton still scanning...

1262000 + files and still isn't done sad_o.gif

Yep that's what I was gonna look into doing only with scripting. I am not really sure what Blackord was going for, but I imagine something close to that(?)

IED Script

Jeevz' IED Script

~great for everything! Use your creativeness and you can use it for fake artillery, anti-personell mines, car-bombs!

If you open the IED.sqs included in the download, you can tweak this area to be any ammo you want:

Quote[/b] ]

; Deterimine the ordinance used to create the explosion

? (_theExplosion == "Small") : _ammoType = "R_57mm_HE"

? (_theExplosion == "Medium") : _ammoType = "M_Sidewinder_AA"

? (_theExplosion == "Large") : _ammoType = "M_Sidewinder_AA"

? (_theExplosion == "Huge") : _ammoType = "Bo_GBU12_LGB"

I used the script, firing small 30mm rounds (G_30mm_HE), executed by sucessive triggers like the ones you outlined,  to effectively create an ambush on both sides of a street. Seemed to simulate the old hawkin's mine scene, in Saving Private Ryan pretty well.  biggrin_o.gif

Cool stuff

<span style='color:olive'>edit: typos/errors hehe</span>

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×