Page 1 of 1

KillObject() CommandArmedAnimatedBuilding possible? [Solved]

Posted: Tue Sep 05, 2017 2:51 pm
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.

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Posted: Tue Sep 05, 2017 6:10 pm
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

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Posted: Wed Sep 06, 2017 5:27 am
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

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Posted: Wed Sep 06, 2017 6:28 pm
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

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Posted: Thu Sep 07, 2017 8:23 am
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.

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Posted: Fri Sep 08, 2017 1:57 pm
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

Re: KillObject() on CommandArmedAnimatedBuilding possible?

Posted: Mon Sep 11, 2017 10:00 am
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