Page 1 of 1

Turrets being killed and respawned via LUA [Solved]

Posted: Sun Jan 02, 2011 9:27 pm
by CressAlbane
Here's the situation:
I have three turrets for each team, called "team(teamnumber)_turret(turretnumber)"
or "team1_turret1", "team1_turret2", etc.
I have two destructible objects called team1_turrets and team2_turrets.
I want the turrets to be destroyed and revived along with the objects.
Here's my code:
Hidden/Spoiler:
OnObjectKillName(KillObject("team1_turret1"), "team1_turrets")
OnObjectKillName(KillObject("team1_turret2"), "team1_turrets")
OnObjectKillName(KillObject("team1_turret3"), "team1_turrets")
OnObjectKillName(KillObject("team2_turret1"), "team2_turrets")
OnObjectKillName(KillObject("team2_turret2"), "team2_turrets")
OnObjectKillName(KillObject("team2_turret3"), "team2_turrets")
OnObjectRespawnName(RespawnObject("team1_turret1"), "team1_turrets")
OnObjectRespawnName(RespawnObject("team1_turret2"), "team1_turrets")
OnObjectRespawnName(RespawnObject("team1_turret3"), "team1_turrets")
OnObjectRespawnName(RespawnObject("team2_turret1"), "team2_turrets")
OnObjectRespawnName(RespawnObject("team2_turret2"), "team2_turrets")
OnObjectRespawnName(RespawnObject("team2_turret3"), "team2_turrets")

Re: Turrets being killed and respawned via LUA

Posted: Mon Jan 03, 2011 4:36 pm
by bobfinkl
I don't know too much about the subject myself having never actually used it, but after a quick look in the space template lua and the LinkedDestroyables.lua, it looks like your error is that you can only really use that special .lua to get it working. I suggest you go take a look at how the shields work in the space template assault lua and copy how it works.

Re: Turrets being killed and respawned via LUA

Posted: Mon Jan 03, 2011 4:42 pm
by CressAlbane
The thing is, I want the turrets to be invincible.
Is there any other way to accomplish this?
I got it to work using the LinkedTurrets script with the object as the "mainframe."
I can also add text and such with this method as well. Thanks for the tip Bobfinkl!

Re: Turrets being killed and respawned via LUA

Posted: Mon Jan 03, 2011 4:47 pm
by bobfinkl
Use the same script then add:

Code: Select all

            SetProperty("turret1", "MaxHealth", 9999999999) 
            SetProperty("turret1", "CurrentHealth", 9999999999)
for each turret. (just an FYI that script may not be written 100% correct you may have to respell things or add a few "" marks here and there, I wrote this off the top of my head)

Edit:
via the kamino campaign script:

Code: Select all

            SetProperty("transport1", "MaxHealth", 999999999)
            SetProperty("transport1", "CurHealth", 999999999) 
that's the exact proper way it should be written except "transport1" should be changed to whatever your turrets are named in ZE.

Re: Turrets being killed and respawned via LUA

Posted: Mon Jan 03, 2011 4:52 pm
by CressAlbane
Oh, I already set the turrets to have a very high max health.
Hidden/Spoiler:
you'd have to edit the curhealth in that script though

Re: Turrets being killed and respawned via LUA [SOLVED]

Posted: Mon Jan 03, 2011 8:07 pm
by AQT
Off-topic: While setting the health of object to an incredibly high value may make it impossibly hard to destroy, it still is not truly invincible. So if your situation, whatever it may be, calls for an object to not even lose the slightest bit of health, then use the value 1e+37 instead (as seen in the stock Kashyyyk campaign script).

Re: Turrets being killed and respawned via LUA [SOLVED]

Posted: Mon Jan 03, 2011 8:48 pm
by CressAlbane
I find that infantry normally do not have the time to chip away 99999 health while a hectic close-quarters battle is being played. So, this works for now.
But I was wondering what 1e+37 did. Thanks!