Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Frigate Destruction

Page: 1 of 1
 esteroth12
03-25-2006, 2:19 PM
#1
I'm having trouble making a frigate's turrets go away when the frigate does. I have tried both ways in the examples, and it didn't work... can anyone help?

ex1:

function SetupFrigateDeaths()
local PlayFrigateDeathAnim = function ( aObj )
local objName = GetEntityName( aObj )
-- kill turrets
for i=1,2 do
local turName = objName .. "_tur" .. i
KillObject( turName )
--~ DeleteEntity( turName )
SetProperty( turName, "IsVisible", 0) --so you don't see the turrets anymore
SetProperty( turName, "IsCollidable ", 0) --so you don't crash into them
SetProperty( turName, "PhysicsActive", 0) --?
SetProperty( turName, "Team", 0) --so they don't get shot at
end
end

OnObjectKillName(PlayFrigateDeathAnim, "imp_frig1");
OnObjectKillName(PlayFrigateDeathAnim, "imp_frig2");
OnObjectKillName(PlayFrigateDeathAnim, "imp_frig3");
OnObjectKillName(PlayFrigateDeathAnim, "all_frig1");
OnObjectKillName(PlayFrigateDeathAnim, "all_frig2");
end

(interestingly, this is only used once. the other cmn .lua files use ex2's method)

ex2:

function SetupFrigDeathAnims()
-- callback function--plays listing procedural anim
local callbackfn = function( aObj )
local objName = GetEntityName( aObj )

-- kill the turrets on the ship
for i=1,3 do -- does the 1,3 mean that it will do 1, 2, 3, or will it just do
local turName = objName .. "_tur" .. i --1 and 3?
KillObject( turName )
--~ DeleteEntity( turName )
SetProperty( turName, "IsVisible", 0)
SetProperty( turName, "IsCollidable ", 0)
SetProperty( turName, "PhysicsActive", 0) --see aboe for effects
SetProperty( turName, "Team", 0)
end
end

-- setup the callbacks for each of the frigates
local frigList = {
"all_frig1", --whats with the list?
"all_frig3",
"imp_frig1",
"imp_frig3",
}

for i, frig in pairs( frigList ) do
OnObjectKillName(callbackfn, frig);
end
end

i don't understand method 2, either... the "for i, frig in pairs" part at the end confuzzles me

the comments up there (denoted by a double hyphen, "--",) ask questions of you, and explain things for those who don't understand, so that they may be able to answer my question
 zerted
03-25-2006, 2:50 PM
#2
The list in part two is the frigates. Instead of writing out all the OnObjectKill lines like in ex1, the programmer decided to put them in a list and loop through them. I think "for i, frig in pairs" mean "for each string in frigList that contains 'frig' do..."

Try uncommenting DeleteEntity and commenting KillObject.

Turrets slowly repair themselves after they blow up. If you remove this auto-repair, they shouldn't pop-up again.
 esteroth12
03-25-2006, 7:32 PM
#3
yeah, I know they repair. I just copied this from assets ;)

and... it didnt work... I'm going to try something else...

also: I was wondering what "frigate in pairs" meant... I knew it was a list of the frigates
 Mercury Noodles
03-26-2006, 3:56 PM
#4
You go through all of that? O_o I haven't tried this with multiple frigates (per side) yet, but I simply added this to my XXXx_ass.lua under "function SetupDestroyables()":

frigateLinkageIMP = LinkedDestroyables:New{ objectSets = {{"imp_bldg_frigateturret", "imp_bldg_frigateturret1", "imp_bldg_frigateturret2", "imp_bldg_frigateturret3", "imp_bldg_frigateturret4", "imp_bldg_frigateturret5"}, {"imp-frigate"}} }
frigateLinkageIMP:Init()
 esteroth12
03-26-2006, 5:02 PM
#5
yeah, I was going to do that. its just that the bases of the turrets are still there (and one of my frigates has the ship guns on it XD I was making the Acclamator more realistic (SW:EAW))
 Mercury Noodles
03-26-2006, 6:46 PM
#6
I found this in spa1_prop_all_shipturret.odf:

DestroyedGeometryName = "spa1_all_shipturret_dam1"

All you should have to do is remove this line from your corresponding heavy turret odf, use the LinkedDestroyables script, and you'll get the results you want. You really should've mentioned that you were using heavy turrets on the Acclamators before.
 esteroth12
03-26-2006, 10:01 PM
#7
I found this in spa1_prop_all_shipturret.odf:

DestroyedGeometryName = "spa1_all_shipturret_dam1"

All you should have to do is remove this line from your corresponding heavy turret odf, use the LinkedDestroyables script, and you'll get the results you want. You really should've mentioned that you were using heavy turrets on the Acclamators before.

I'll try that. thanks I was just thinking that then, destroyed turrets eeverywhere will disappear when killed... i'll probably use the CIS turret, assuming its different
 Mercury Noodles
03-27-2006, 9:57 PM
#8
It seems like you're planning this, from my interpretation of your reply, but I'll post this just to be thorough. You could use a heavy turret that isn't utilized by the two factions' capital ships in your battle. (like the Alliance heavy turret in a Clone Wars battle) Well, that's assuming your battle is for only one era. It may or may not look odd (depending on what you do to the odfs), but you could have the normal turrets on the motherships, and still have completely destroyable turrets for your destroyable ships, since each faction's heavy turret has it's own set of odfs.
 esteroth12
03-28-2006, 6:08 PM
#9
ok, I made an ion turret, so it shouldn't be too hard to make a new, invisible when dead one. I also noticed that there is a special autoturret that doesn't respawn, aptly named (faction is xxx) "xxx_frigateturret" XD (maybe I should have looked harder). also, I noticed that there are no CW era heavy turrets

thanks for the help
 Mercury Noodles
03-28-2006, 9:50 PM
#10
All four factions do, in fact, have a heavy turret odf, along with other assets.

cis_prop_shipturret.odf
cis_prop_shipturret_2.odf
rep_prop_shipturret.odf
spa1_prop_all_shipturret.odf
spa1_prop_imp_shipturret.odf

On the other hand, the CW era heavy turrets share the weapon odfs with those of the GCW era. The shared weapon odfs are named after the GCW factions.
Page: 1 of 1