OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Binary on 06 Jul 2008, 14:49:57

Title: Destroying ID's with radio
Post by: Binary on 06 Jul 2008, 14:49:57
Hello :)

I've tried doing quite a few searches so far - but haven't found a thread that answered my question accurately enough.
What I'm trying to do, is via a radio command, turn off the lights in a village. I'm trying to do this with triggers/gamelogics and the nearestObject command - but i keep running into syntax problems..
I supose this could be done via a script - but it needs to be MP compatible.

ID's of the lightposts:
67175
67305
67304
67245
67307
67306
67244
67308

Any thoughts on this would be great :)
Title: Re: Destroying ID's with radio
Post by: schuler on 06 Jul 2008, 15:16:55
i am not sure if this works with Arma , not tested
Code: [Select]
{(object _x) setdamage 4} forEach [1251,2003,28419,28420,28424,28664,32938,37326,66997,66998,67026,90863]just change the obj in this code and ad to a trigger , with radio
cheers schuler
Edit,,, posted code with,,, lights off, not setdamage    opps  :whistle:
changed  :D
Title: Re: Destroying ID's with radio
Post by: Binary on 06 Jul 2008, 15:46:35
Using the example you gave schuler - i get this error.

(http://img365.imageshack.us/img365/6595/errorpz8.jpg)

 ???
Title: Re: Destroying ID's with radio
Post by: schuler on 06 Jul 2008, 16:03:18
sorry i think some of the code is wrong,,, its in OFP not testing in Arma , but dont worry one of the member with fix it for you sortly  ;)
cheers schuler
ps note where it says name in the trigger ,,, if you type-  set off IED  or what ever you like in that box, it will be show on the radio, after you get the right code!
Title: Re: Destroying ID's with radio
Post by: Spooner on 06 Jul 2008, 17:02:34
i am not sure if this works with Arma , not tested
Code: [Select]
{(object _x) setdamage 4} forEach [1251,2003,28419,28420,28424,28664,32938,37326,66997,66998,67026,90863]

The object command doesn't work in ArmA, thus try:
Code: (radio trigger activation) [Select]
{([0, 0, 0] nearestObject _x) switchLight "ON"} forEach [1251,2003,28419,28420,28424,28664,32938,37326,66997,66998,67026,90863];
Title: Re: Destroying ID's with radio
Post by: Binary on 06 Jul 2008, 17:34:59
Simpy amazing Spooner  :good:

Although - switchLight "OFF" seemed to work better for killing the lights  :D

Problem solved, thanks a lot :)
Title: Re: Destroying ID's with radio
Post by: Spooner on 06 Jul 2008, 18:38:36
I always miss the easy stuff like remembering you want to turn the lights off, not on ;P
Title: Re: Destroying ID's with radio
Post by: Mandoble on 06 Jul 2008, 18:38:46
You may also try this for a more generic solution:
Title: Re: Destroying ID's with radio
Post by: bedges on 06 Jul 2008, 19:47:45
For completeness, you could also check out the scripts accompanying this demomission (http://www.ofpec.com/FAQ/faq_obj.php#lights). It was made for OFP, but the principle is the same - get the classnames of all possible streetlamps and you can add a 'lightswitch' to them all.