Cardia on 12/5/2013 at 17:11
Does anyone knows how to add a lamp in Garrett´s inventory, and with the option to turn it on/off just like in the contest mission "The sinkhole"?
R Soul on 12/5/2013 at 20:13
One of the NewDark features is that the AnimLight property has a 'dynamic light' checkbox, so perhaps you could use the NVFrobToggle script on the lamp (design note: NVFrobToggleTDest="[me]").
You could also open the mission in Dromed and see how the author did it...
Cardia on 14/5/2013 at 14:36
i can´t manage to set this lamp properly to turn off and on, its been a long time i haven´t used dromed object settings that i am somehow rusty.
i wonder if someone could set me that lamp to work properly in my mission?
Catman on 15/5/2013 at 03:51
I don't know how it was done in The Sinkhole, but I played around for while and found a solution. NVFrobToggle won't turn the light on and off while held in the inventory, but if you drop the light after turning it on, it's lit and stays lit when you pick it up. Same holds true when you turn it off. Obviously, that's not particularly useful, but it was clear that getting the light out of inventory and back in was a necessary step.
Here's the set up:
* Add these Scripts: IllumeBearer, AnimLight, NVFrobToggle, and NVItemGiver.
* Set Engine Features/FrobInfo for World Action to Move and Inv Action to Script.
* Set the Renderer/AnimLight to minimum brightness, set some value for the maximum brightness (say 125), and check the Dynamic Light box.
* If the light already has Renderer/Light, delete that.
* Set the Inventory/Item Type to Item.
* Add Editor/Design Note NVGiveWhat="[Me]"; NVFrobToggleTDest="[Me]"
* ControlDevice link the light to itself.
Once you've set this all up, you should see that DromEd has added a Dynamic Light set to 0 and Has Refs set to TRUE. You don't need to change these.
Basically, NVItemGiver removes the light from inventory and puts it back in, giving the desiired on/off effect.
LarryG on 15/5/2013 at 05:07
Wouldn't it be simpler to give the lantern the equivalent of the LightFlare script, but with a LitLantern object?
Quote:
LightFlare
gen.osm G/2
On FrobInvEnd, creates a LitFlare and adds a Contains link from the frobber to the new object.
Then to turn it off a 2nd FrobInvEnd could slay the LitLantern object. This should be possible with judicious use of NV scripts. I suggest adding and removing metaprops. One metaprop deals with lighting the lantern, removing itself when the lantern is lit, and adding the other metaprop. The 2nd deals with shuttering the lantern, removing itself when the lantern is shuttered, and adding back the first metaprop.
Note the scripts on LitFlare:
Quote:
IllumeBearer
gen.osm G/2
Illuminates the container of the object. The container is lit when the object is added to the container. The effect is reversed when the object is removed, or Slain. The container is illuminated by copying the Renderer\Dynamic Light and Renderer\LightColor properties from this object. In Thief 2, if the M-Invisible meta-property is set, then the Light rating and Level of AI\State\Current visibility are set to the value of Renderer\Dynamic Light, and a Visible message is sent to the container. To un-illuminate the container, the Renderer\Dynamic Light and Renderer\LightColor properties are removed; Thief 2 sends an Invisible message to the container.
InstantiateSuspicious
gen.osm 2
Make sure that the Engine Features\Suspicious property is on the concrete object. Activates on BeginScript.
And the Delete Tweq. That's what makes flare burn out. Your lantern could run out of fuel, but not as fast as a flare ...
Cardia on 15/5/2013 at 11:23
Quote Posted by LarryG
Wouldn't it be simpler to give the lantern the equivalent of the LightFlare script, but with a LitLantern object?
Then to turn it off a 2nd FrobInvEnd could slay the LitLantern object. This should be possible with judicious use of NV scripts. I suggest adding and removing metaprops. One metaprop deals with lighting the lantern, removing itself when the lantern is lit, and adding the other metaprop. The 2nd deals with shuttering the lantern, removing itself when the lantern is shuttered, and adding back the first metaprop.
Note the scripts on LitFlare:
And the Delete Tweq. That's what makes flare burn out. Your lantern could run out of fuel, but not as fast as a flare ...
Thanks both of you, the flare seems a very suitable object to iluminate, how could i turn it on/off?
LarryG on 15/5/2013 at 13:20
This is just off the top of my head, but in general this is what you need to do:
1. You need to make a new archetype called LitLantern. Basically copy everything from LitFlare (Physical > Tulz > FlareTypes > LitFlare) except the delete tweq and the shape. You might want to look at EngineFeatures > FrobInfo too, depending on whether you want to allow the lantern to be dropped or thrown while lit. If so, you will need to think about what should happen if that is done (Thrown => minor explosion? set things on fire? what?). You should also put NVSlayMe on the LitLantern with a custom message used instead of TurnOn, maybe "Suicide" LOL. The LitLantern object model (the .bin) should be identical to the Lantern object model, just with the glass material having the illumination property on, so that it looks like the lantern is lit.
2. After you have the archetype figured out for LitLantern, you need to create two new MetaProperties, call them "M-LanternOn" and "M-LanternOff".
3. M-LanternOn will add LitLantern to your inventory when your Lantern object gets a FrobInvEnd message. It will also add M-LanternOff to the lantern object and remove itself. To do these tricks you should read up on NVCreateAndLink and NVMetaTrap. Hint: you'll need to have NVCreateAndLink do what the LitFlare script does and add a Contains link to the player, and you'll need 2 NVMetaTrap scripts on each metaproperty.
4. M-LanternOff will slay LitLantern to turn it off. To do this it will send a "Suicide" message to the LitLantern (TDest="*LitLantern"), then add M-LanternOn to the lantern object and remove M-LanternOff.
5. Add M-LanternOn to your Lantern object via its archetype.
I think that's pretty much it.
LarryG on 15/5/2013 at 17:56
Thinking more about it, I have come up with what may be a better approach. This approach eliminates the need for the MetaProperties and makes for a more natural user interface for turning the lantern on and off.
The general idea is that when the Lantern object is frobbed in inventory the LitLantern is created, Contains linked to the player, and the Lantern object is slain. Similarly, when the LitLantern is frobbed in inventory the Lantern is created, Contains linked to the player, and the LitLantern is slain.
So Lantern gets the NVCreateAndLink and NVSlayMeTrap added to it. The trick is to make sure that the Lantern does not get slain until the LitLantern is created and linked. I think that if you have NVCreateAndLink before NVSlayMeTrap in the list of scripts that should do it.
LitLantern similarly gets the NVCreateAndLink and NVSlayMeTrap scripts added.
The key is proper setting of the FrobInfo property so that a frob in inventory is sent to Scripts and an esc key press in inventory drops the lantern (lit or not). I just forget what the right settings are for that.
Cardia on 19/5/2013 at 16:45
i´m using a lit flare, and set its inventory type to "Item", also deleted its tweq delet state, still i don´t know how to make it turn on/off, any suggestions?
LarryG on 19/5/2013 at 18:39
Don't use the LitFlare archetype. Create a new archetype.
Here, tell you what, I'll create a demo mission for you. Stay tuned.