Delete Attached Odfs via LUA?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Delete Attached Odfs via LUA?

Post 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.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Delete Attached Odfs via LUA?

Post 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.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Delete Attached Odfs via LUA?

Post by [RDH]Zerted »

I haven't used these much. They might help you:

CreateEffect()
RemoveEffect()
IsEffectActive()
GetEffectMatrix()
SetEffectMatrix()
SetEffectActive()
AttachEffectToMatrix()
AttachEffectToObject()
Ace_Azzameen_5
Jedi
Jedi
Posts: 1119
Joined: Sat Apr 23, 2005 8:52 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Delete Attached Odfs via LUA?

Post 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.
Post Reply