Caught up in a design workflow fork, the route I'm considering involves multiple destruction's. Done some searching and know a bit about structure; but knowing if the following works with a link or example would be awesome:
Is it possible via LUA (or otherwise) to Transform an Object into a Different Object, with health, on destruction with an animated effect.
The idea is a Prop or Building is partially destroyed but has health remaining to be destroyed more. This is a popular effect; glass cups to fortifying barriers.
Figure it's possible. Not sure. No rush.
Thanks in advance!
Destroying an Object Multiple Times
Moderator: Moderators
-
- Recruit Womprat Killer
- Posts: 9
- Joined: Sat Apr 22, 2017 4:58 am
- Projects :: SWBFII- ARC ACTS- CTF CTG TMK PPD TFK
- xbox live or psn: N/A
- Location: United States
- Contact:
-
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Destroying an Object Multiple Times
You might be able to do this via Lua scripting with the OnObjectDamage event handler. It'd look something like this:
Parts of this might be wrong, but otherwise that's the basis of what would the code block might look like.
Refer to Battlefront2_scripting_system.doc for more information.
Code: Select all
propDamage = OnObjectDamageName(
function(object, damager)
if GetObjectHealth(object) < 100 then
SetProperty(object, "GeometryName", "new_msh_file_name")
end
end,
"object_class_name"
)
Refer to Battlefront2_scripting_system.doc for more information.
-
- Recruit Womprat Killer
- Posts: 9
- Joined: Sat Apr 22, 2017 4:58 am
- Projects :: SWBFII- ARC ACTS- CTF CTG TMK PPD TFK
- xbox live or psn: N/A
- Location: United States
- Contact:
Re: Destroying an Object Multiple Times
Awesome. Thanks. Stuck on binary; was looking for "destroy" or "dest".
-
- Lieutenant General
- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
Re: Destroying an Object Multiple Times
I agree with Marth but maybe the code needs to extend a bit.
IMPORTANT: your object needs to be instead of "prop". Props can't be destroyed ingame or via LUA.
Try this:
Finally your destructable building needs a destroyed geometry and chunks, that add more realism. Hope help you.
IMPORTANT: your object needs to be
Code: Select all
ClassLabel = "destructablebuilding"
Try this:
Code: Select all
objectName = "my_object_name" -- You need specify what object
OnObjectDamage(
function(object, damager) --
if GetObjectHealth(objectName) < 1000 then -- Set a number near the max health. First destruction.
SetProperty(objectName, "GeometryName", "new_msh_file_name") -- First change of geometry
KillObject(objectName) --Object dissapears...
RespawnObject(objectName) -- ...and respawn in les than eye closes! :D
SetProperty(objectName, "MaxHealth", 999)
SetProperty(objectName, "CurHealth", 999)
elseif GetObjectHealth(objectName) < 700 then -- Set a number near the second max health. second destruction.
SetProperty(objectName, "GeometryName", "second_msh_file_name") -- second change of geometry
KillObject(objectName) --Object dissapears...
RespawnObject(objectName) -- ...and respawn in les than eye closes! :D
SetProperty(objectName, "MaxHealth", 699)
SetProperty(objectName, "CurHealth", 699)
elseif GetObjectHealth(objectName) < 500 then -- Set a number near the third max health. Third destruction.
SetProperty(objectName, "GeometryName", "second_msh_file_name") -- Third change of geometry
KillObject(objectName) --Object dissapears...
RespawnObject(objectName) -- ...and respawn in les than eye closes! :D
SetProperty(objectName, "MaxHealth", 499)
SetProperty(objectName, "CurHealth", 499)
-- If you need more destructions copy from "elseif" to the line above and set new values
end
)
-
- Recruit Womprat Killer
- Posts: 9
- Joined: Sat Apr 22, 2017 4:58 am
- Projects :: SWBFII- ARC ACTS- CTF CTG TMK PPD TFK
- xbox live or psn: N/A
- Location: United States
- Contact:
Re: Destroying an Object Multiple Times
As soon as I test it; BOOM video example/confirmation. I'll let you know.
Was asking early on because I can do the multi-part destruction when doing the binary destruction; saves time (a lot, actually, and looks better). Thanks so much for that.
Was asking early on because I can do the multi-part destruction when doing the binary destruction; saves time (a lot, actually, and looks better). Thanks so much for that.