KillObject() CommandArmedAnimatedBuilding possible? [Solved]

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
User avatar
Dasher
Private Third Class
Posts: 49
Joined: Fri Aug 04, 2017 1:46 pm
Projects :: Loronar Jade Moon
xbox live or psn: No gamertag set

KillObject() CommandArmedAnimatedBuilding possible? [Solved]

Post by Dasher »

As the title implies I tried to kill an object labeled "CommandArmedAnimatedBuilding" via LUA command KillObject(), but without success. I've also tried SetProperty to set CurHealth=0 but did't succeed either. All these commands worked when I labeled the object "ArmedBuilding", the problem is I need it to be "CommandArmedAnimatedBuilding" for the weapon animation to work when the object is killed, since this isn't the case as long as the object is an "ArmedBuilding". Any ideas? Help is greatly appreciated.
Last edited by Dasher on Mon Sep 18, 2017 7:04 am, edited 2 times in total.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Post by Marth8880 »

What do you mean when you say you "labeled" these objects? Are you talking about the ClassLabel in their associated ODF? If so, that's not what you need to reference in the Lua script; instead, you need to reference the object's unique name that's set in Zero Editor.

References:
https://github.com/marth8880/SWBF2-Lua- ... clua#L1443
User avatar
Dasher
Private Third Class
Posts: 49
Joined: Fri Aug 04, 2017 1:46 pm
Projects :: Loronar Jade Moon
xbox live or psn: No gamertag set

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Post by Dasher »

I know, this is how I set up my LUA
Hidden/Spoiler:
DeactivateShield = OnFinishCapture(function(post,holding)
if GetCommandPostTeam("cp3") == 2 and IsObjectAlive("dur1_shield") == 1 then
KillObject("dur1_shield")
end
end
)

ActivateShield = OnFinishCapture(function(post,holding)
if GetCommandPostTeam("cp3") == 1 and IsObjectAlive("dur1_shield") == 0 then
RespawnObject("dur1_shield")
end
end
)
It only kills the object when I change the ClassLabel to "ArmedBuilding", but then the weapon effect that is displayed when the shield's turning off doesn't work
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Post by Marth8880 »

The CommandArmedAnimatedBuilding class might be broken. Why do you need to use it? What are you trying to do with it?

Related resources:
http://www.secretsociety.com/forum/down ... meters.txt
http://www.secretsociety.com/forum/down ... erence.jpg
http://www.secretsociety.com/forum/down ... erence.jpg
User avatar
Dasher
Private Third Class
Posts: 49
Joined: Fri Aug 04, 2017 1:46 pm
Projects :: Loronar Jade Moon
xbox live or psn: No gamertag set

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Post by Dasher »

I'm trying to set up a shield that is switched on/off depending on the team controlling a certain CP. The problem is that the turn on animation/effect works fine, but when the object is killed via player or LUA (provided it's class label is "ArmedBuilding") there is no turn off animation/effect, the shield simply disappears, the object is still on the map though with it's current health on 0.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Post by Marth8880 »

Oh, you don't need to kill the object to do that, you can just animate it to hide itself with procedural animation.

Resources:
https://sites.google.com/site/swbf2modt ... ation-mode
http://www.gametoast.com/viewtopic.php?f=27&t=5865
http://www.gametoast.com/viewtopic.php?f=27&t=12473
User avatar
Dasher
Private Third Class
Posts: 49
Joined: Fri Aug 04, 2017 1:46 pm
Projects :: Loronar Jade Moon
xbox live or psn: No gamertag set

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Post by Dasher »

The object is simply a cube, which has the "CommandAnimatedArmedBuilding" ClassLabel, it has a weapon which is the fambaa shield, so we're not talking about a solid object type of shield, but about an actual weapon. So in other words it is a fambaa with deployable shield, my bad should of clarified that:

The object ODF:
Hidden/Spoiler:
[GameObjectClass]

ClassLabel = "ArmedBuilding"
GeometryName = "dur1_prop_shield_on.msh"


[Properties]
MaxHealth = "200.0"
RespawnTime = "60000.0"
GeometryName = "dur1_prop_shield_on"




BUILDINGSECTION ="BODY"
MapTexture ="hud_dest_icon"
MapScale =0.0

BUILDINGSECTION = "TURRET1"

PilotType = "self"
Controllable = "0"
AutoFire = "1"


TurretNodeName = "hp_fire"
PitchLimits = "0.0 0.0"
YawLimits = "0.0 0.0"
MaxTurnSpeed = "0.0"
MaxPitchSpeed = "0.0"

WeaponName = "dur_weap_shield"
WeaponAmmo = 2
the weapon ODF:
Hidden/Spoiler:
[WeaponClass]

ClassLabel = "shield"

[Properties]

RoundsPerClip = "1"
ShotDelay = "0.1"
ReloadTime = "0.0"

LockOnRange = "0.0"
LockTime = "0.1"
MinSpread = "0.0"
MaxSpread = "0.2"
AutoAimSize = "5.0"
TriggerSingle = 0

TargetPerson = "1"
TargetAnimal = "0"
TargetDroid = "0"
TargetVehicle = "1"
TargetBuilding = "0"

MaxShield = 2000
AddShield = 200

ShieldRadius = "90.0 65.0"

FireSound = ""
FireEmptySound = ""
FireLoopSound = ""
ReloadSound = ""
ChargeSound = ""
ChangeModeSound = ""
WeaponChangeSound = ""

ShieldEffect = "fambaa_shield"
So again the issue is this:

Class Label: ArmedBuilding | CommandArmedAnimatedBuilding
PlaysEffect: only on turn on | on turn on and turn off
CanBeKilledviaLUA: yes | no


EDIT:
So I finally got it working the "CommandArmedAnimatedBuilding" class isn't broken, it can be killed via KillObject and respawned via CreateEntity
Post Reply