OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: WELSH ASSASSIN on 08 Aug 2004, 14:13:00
-
How do I switch on standard street lamps?
Thanks
-
From the Command Reference:
lamppost switchLight mode
e.g.
nearestObject [player, "StreetLamp"] switchLight "Off"
or
object 159582 switchlight "on"
Object ID's can been seen in the editor when you zoom in very close and have 'Show Id's selected (Resistance only). Only for objects that are part of the island, it will not work for objects placed with the editor.
Mode may be "ON", "OFF", "AUTO". "AUTO" is default, lampost is on only during night time.
If the Lamp is 'fire' based simulation then:
this inflame true
Planck
-
sorry dude.
You'll ave to tell me exactly where to put this line of text because I'm having some problems....lol
Ive put the streetlamp2 into my map. Located it in my Mission.sqm.......What next?
-
Code can go in the init field of a unit, in a script or other file, waypoint, trigger .... where it goes is up to you and depends on the particular circumstances.
Read Abuu's Editing Tutorial and Johan Gustafsson's Scripting Tutorial.
-
ok here's an example.
Say that your lamp has ID 58834.
Just do the following:
1) Add a trigger with these specs. (leave everything else as it is on the trigger)
Axis a: 10000
Axis b: 10000
Activation: anyone
On Activation: (object 58834) switchlight "ON"
That way the trigger is big enough to cover the entire map, and the "Activation: Anyone" tells you that any player/AI in the game will trigger the trigger ("activate it")
The "On Activation:" field tells you what will happen when the trigger is activated (when someones enters the triggers area). This will happen automatically because the trigger covers the entire map.
So, this little example will turn on the lamp, and it will always be on. I suppose you can change the On Activation: (object 58834) switchlight "ON" to "AUTO" instead, and that way it will turn itself on when the time is right (when darkness comes crawling).
Another way to do it is this:
1) On your players INIT field, place this:
On Activation: (object 58834) switchlight "ON"
The AUTO instead of ON works on this one as well.
The nice thing about the first way (the trigger way) is that you can choose when the light will go on. If you make the trigger, say 20x20, and place it near a house. The light (let's say that the street light is next to the house) will turn on when you go near the house.
I hoped this helped.
-
thanks for your help guys. Still not working. I got the ID from the mission SQM.
That didnt work, so i tried the trigger version. that didnt work.
Anything else?
-
thanks for your help guys. Still not working. I got the ID from the mission SQM.
That didnt work, so i tried the trigger version. that didnt work.
Anything else?
Try getting the ID from within the editor (just press the SHOW ID button and zooooooom in alot) then try it again
-
You cant get an ID from an object inserted into a map, only existing objects. Any other ideas?
-
If its an object you placed yourself then use whatever name you gave it.
If its an addon streetlight it might try
objectName inflame true
like a fireplace.
-
Right, I called the object LAMP and typed the following into the INIT:
LAMP switchlight "AUTO"
The light came on, but appeared halfway down the post. I know u can set heights on individual objects but not characteristics of an object. Plus, the editor doesnt appear to like the script.....it crashes to desktop when u try to continue editing.
Thanks.
-
I recommend instead:
LAMP inflame true
or
this inflame true
And use a different model
Planck
-
The streetlamps that are extracted from the editorupdate have an error in them that does that.
There is one out there that works correctly using the inflame command, however, off the top of my head, I don't know which one.
Also, there is a streetlight add-on available that uses the inflame command.