Page 1 of 1

Delete Attached Odfs via LUA?

Posted: Fri Dec 14, 2007 10:49 pm
by Ace_Azzameen_5
I've worked out a system of odfs and code to create a control panel which you can activate with 'E' to lock and unlock the door. It involves two turrets using the dea1_prop_panel's geometry. When the panel is accessed, aside from the lock/ unlock code, the turret is actually deleted from the game, and a new one is spawned at its formed location. Why? The two turrets' odfs differ slightly, one has a green light (For unlocked) and the other a red light ( for locked). The lights are attached odfs:
AttachOdf = "dea1_light_panel_red"
AttachToHardPoint = "hp_light"//this is the odf code.
So whenever a panel is deleted, the light stays behind. So, after 'E'ing the turret 10 times fast, it is surrounded by a massive FPS hitting orange blob.

So, how do I delete an attached object?
What are their names? Does anybody know?

If they can't be accessed directly, I'm open to suggestions for work-arounds.

Thanks for reads/replies.

Re: Delete Attached Odfs via LUA?

Posted: Fri Dec 14, 2007 10:59 pm
by Maveritchell
To the best of my knowledge, you can't delete lights/effects once they've been attached to objects. I've tried modifying the properties with SetClassProperty in addition to animating them. Neither works (animating moves the object but not the effect). I ended up just having to switch out translucent meshes, but that's obviously not going to work for most effects or even for lights.

I might consider either:
a) Having no light (you probably don't want this since it seems like you use the light to indicate being open or closed)
b) Creating a small, semitransparent mesh (I might suggest scaling down the grenade mesh and enabling it for transparency) that you can alternate between full health and no health (Geometry and DestroyedGeometry), and having the change sync up to the door changing states.

Re: Delete Attached Odfs via LUA?

Posted: Sat Dec 15, 2007 12:31 am
by [RDH]Zerted
I haven't used these much. They might help you:

CreateEffect()
RemoveEffect()
IsEffectActive()
GetEffectMatrix()
SetEffectMatrix()
SetEffectActive()
AttachEffectToMatrix()
AttachEffectToObject()

Re: Delete Attached Odfs via LUA?

Posted: Sat Dec 15, 2007 11:48 am
by Ace_Azzameen_5
The light is an odf and not an .fx, but, maybe I'll try RemoveEffect(ObjectWiththeOdfAttached)

A couple of those I've used for adding a light .fx for for the bespin street lamp during night mode.