OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: WELSH ASSASSIN on 08 Aug 2004, 14:13:00

Title: STREET LAMPS
Post by: WELSH ASSASSIN on 08 Aug 2004, 14:13:00
How do I switch on standard street lamps?

Thanks
Title: Re:STREET LAMPS
Post by: Planck on 08 Aug 2004, 14:19:25
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
Title: Re:STREET LAMPS
Post by: WELSH ASSASSIN on 08 Aug 2004, 15:07:04
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?
Title: Re:STREET LAMPS
Post by: macguba on 08 Aug 2004, 16:00:56
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.
Title: Re:STREET LAMPS
Post by: Pellejones on 08 Aug 2004, 17:29:17
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.
Title: Re:STREET LAMPS
Post by: WELSH ASSASSIN on 08 Aug 2004, 19:34:28
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?

Title: Re:STREET LAMPS
Post by: Pellejones on 08 Aug 2004, 19:49:55
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
Title: Re:STREET LAMPS
Post by: WELSH ASSASSIN on 08 Aug 2004, 19:51:53
You cant get an ID from an object inserted into a map, only existing objects.  Any other ideas?
Title: Re:STREET LAMPS
Post by: macguba on 08 Aug 2004, 20:16:28
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.
Title: Re:STREET LAMPS
Post by: WELSH ASSASSIN on 08 Aug 2004, 20:47:53
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.
Title: Re:STREET LAMPS
Post by: Planck on 08 Aug 2004, 21:34:07
I recommend instead:

LAMP inflame true

or

this inflame true

And use a different model


Planck
Title: Re:STREET LAMPS
Post by: olseric on 08 Aug 2004, 21:45:23
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.