Page 1 of 1

FLyer Splines don't work correctly [Solved]

Posted: Sat May 30, 2015 5:39 am
by thelegend
Hey all,
I just wanted to add a simple flyer spline which leads all imperial ships from the Star Destroyer Hangar down to the ground. I added a spline in ZeroEditor and added some properties. I also changed the name of the spline in all vehicle odf's and added this into my lua but the flyers still crash into the walls:

Code: Select all

EnableFlyerPath(tiefighters,1)
Here is a copy of the spline path from CMW_GCW_era.pth:
Hidden/Spoiler:
[code]

Path("tiefighters")
{
Data(0);
PathType(0);
PathSpeedType(0);
PathTime(0.000000);
OffsetPath(0);
Layer(3);
SplineType("Hermite");

Properties(2)
{
MaxEntities(10);
speed(2.000000);
}

Nodes(2)
{
Node()
{
Position(357.557495, 643.637573, -482.926117);
Knot(0.000000);
Data(0);
Time(1.000000);
PauseTime(0.000000);
Rotation(1.000000, 0.000000, 0.000000, 0.000000);
Properties(0)
{
}
}

Node()
{
Position(285.187347, 533.434692, -357.005707);
Knot(0.000000);
Data(1);
Time(1.000000);
PauseTime(0.000000);
Rotation(1.000000, 0.000000, 0.000000, 0.000000);
Properties(1)
{
direction(1.000000);
}
}

}

}

[/code]
And here is a part of the vehicle odf (Tie-Fighter):
Hidden/Spoiler:
[code]

// PathFollower Attributes
PathFollowerClass = "tiefighters"
PathFollowerClass_CTF = "imp_flag"
PathFollowerBranchPaths = "6"
PathFollowerBranchMaxAngle = "60"
PathFollowerMinBranchDist = "190.0"
PathFollowerBranchRange = "1500"

[/code]
And here is the entire .lua file:
Hidden/Spoiler:
[code]
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveSpaceAssault")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("LinkedDestroyables")
ScriptCB_DoFile("LinkedTurrets")
ScriptCB_DoFile("LinkedShields")


-- Empire Attacking (attacker is always #1)
local ALL = 2
local IMP = 1
-- These variables do not change
local ATT = 1
local DEF = 2



function ScriptPostLoad()

SetupShields()
SetupDestroyables()
SetupTurrets()


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp6 = CommandPost:New{name = "cp6"}
cp7 = CommandPost:New{name = "cp7"}
cp8 = CommandPost:New{name = "cp8"}
cp9 = CommandPost:New{name = "cp9"}



--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)
conquest:AddCommandPost(cp8)
conquest:AddCommandPost(cp9)


conquest:Start()
SetUberMode(1);
EnableSPHeroRules()
AddDeathRegion("deathregion_1")
AddDeathRegion("deathregion_2")

EnableFlyerPath(tiefighters,1)
end

function SetupDestroyables()

--Coruscant Adverts
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s1"}, {"ad1","ad2"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s2"}, {"ad3","ad4","ad5"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s3"}, {"ad6"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s4"}, {"ad7"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s5"}, {"ad8"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s6"}, {"ad9"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s7"}, {"ad10"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s8"}, {"ad11"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s9"}, {"ad12","ad13"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s10"}, {"ad14","ad15"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s11"}, {"ad16","ad17"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s12"}, {"ad18"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s13"}, {"ad19","ad20","ad21"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s14"}, {"ad22","ad23","ad24"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s15"}, {"ad25"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s16"}, {"ad26"}} }
lifeSupportLinkageALL:Init()
lifeSupportLinkageALL = LinkedDestroyables:New{ objectSets = {{"s17"}, {"ad27"}} }
lifeSupportLinkageALL:Init()



end
function SetupShields()
-- Coruscant Shield Turret
local linkedShieldObjectsIMP = { "turret_console_mili"}
shieldStuffIMP = LinkedShields:New{objs = linkedShieldObjectsIMP, controllerObject = "Coruscant_Prop_Generator"}
shieldStuffIMP:Init()

function shieldStuffIMP:OnAllShieldsDown()
ShowMessageText("level.spa.hangar.shields.atk.down", IMP)
ShowMessageText("level.spa.hangar.shields.def.down", ALL)
end

function shieldStuffIMP:OnAllShieldsUp()
ShowMessageText("level.spa.hangar.shields.atk.up", IMP)
ShowMessageText("level.spa.hangar.shields.def.up", ALL)
end
end


--Coruscant Turrets

function SetupTurrets()
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "turret_console_mili",
turrets = {"auto_turret_1", "auto_turret_2", "auto_turret_3", "auto_turret_4", "auto_turret_5", "auto_turret_6", "auto_turret_7", "auto_turret_8", "auto_turret_9", "roofgun_1", "roofgun_2", "roofgun_3", "roofgun_4", "roofgun_5", "roofgun_6", "roofgun_7", "roofgun_8", "roofgun_9"} }
turretLinkageIMP:Init()

function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", ALL)
ShowMessageText("level.spa.hangar.mainframe.def.down", IMP)

end

--Empire Turrets
turretLinkageIMP = LinkedTurrets:New{ team = IMP, mainframe = "imp_defense",
turrets = {"imp_auto_tur_1","imp_auto_tur_2","imp_auto_tur_3","imp_auto_tur_4","imp_auto_tur_5","imp_auto_tur_6","imp_auto_tur_7"} }
turretLinkageIMP:Init()

function turretLinkageIMP:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

end

--Alliance Turrets
turretLinkageALL = LinkedTurrets:New{ team = ALL, mainframe = "all_defense",
turrets = {"all_tur01","all_tur02","all_turr_3","all_turr_4"} }
turretLinkageALL:Init()

function turretLinkageALL:OnDisableMainframe()
ShowMessageText("level.spa.hangar.mainframe.atk.down", IMP)
ShowMessageText("level.spa.hangar.mainframe.def.down", ALL)

end
end

---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------

function ScriptInit()
ReadDataFile("dc:Load\\common.lvl")
ReadDataFile("ingame.lvl")



SetMaxFlyHeight(1350)
SetMaxPlayerFlyHeight (1350)
SetMinFlyHeight(-500)
SetMinPlayerFlyHeight (-500)


SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo


ReadDataFile("sound\\myg.lvl;myg1gcw")
ReadDataFile("dc:sound\\cmw.lvl;cmwgcw")

ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_rifleman_urban",
"all_inf_rifleman_local",
"all_inf_rocketeer_urban",
"all_inf_sniper_urban",
"all_inf_engineer_urban",
"all_inf_officer",
"all_inf_wookiee",
"all_inf_jettrooper",
"all_hero_hansolo_tat",
"all_hero_luke_jedi",
"all_hover_combatspeeder",
"all_fly_awing",
"all_fly_falcon",
"all_fly_ywing_sc",
"all_fly_xwing_sc",
"all_fly_gunship_sc",
"all_fly_battleship",
"all_inf_pilot" )

ReadDataFile("dc:SIDE\\imp.lvl",
"imp_inf_rifleman",
"imp_inf_rifleman_local",
"imp_inf_rocketeer",
"imp_inf_engineer",
"imp_inf_sniper",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_inf_commander",
"imp_hero_emperor",
"imp_hero_darthvader",
"imp_fly_tiefighter_sc",
"imp_fly_tieinterceptor",
"imp_fly_tiebomber_sc",
"imp_walk_atst",
"imp_hover_fightertank",
"imp_fly_trooptrans",
"imp_inf_pilot" )

ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_spa_rep_chaingun",
"tur_bldg_spa_all_beam",
"tur_bldg_spa_all_recoilless",
"tur_bldg_spa_imp_chaingun",
"tur_bldg_spa_imp_recoilless",
"tur_bldg_chaingun_roof",
"tur_bldg_chaingun_roof_heavy",
"tur_bldg_predator_turret",
"tur_bldg_laser" )

SetupTeams{
all = {
team = ALL,
units = 60,
reinforcements = 500,
soldier = { "all_inf_rifleman_urban",15, 25},
assault = { "all_inf_rocketeer_urban",5,10},
engineer = { "all_inf_engineer_urban",5,10},
sniper = { "all_inf_sniper_urban",5,10},
officer = { "all_inf_pilot",5,10},
special1 = { "all_inf_officer",5,10},
special2 = { "all_inf_wookiee",5,10},
special3 = { "all_inf_jettrooper",5,10},
special4 = { "all_hero_hansolo_tat",1,1},

},
imp = {
team = IMP,
units = 60,
reinforcements = 500,
soldier = { "imp_inf_rifleman",15, 25},
assault = { "imp_inf_rocketeer",5,10},
engineer = { "imp_inf_engineer",5,10},
sniper = { "imp_inf_sniper",5,10},
officer = { "imp_inf_pilot",5,10},
special1 = { "imp_inf_officer",5,10},
special2 = { "imp_inf_dark_trooper",5,10},
special3 = { "imp_inf_commander",5,10},
special4 = { "imp_hero_emperor",1,1},
},
}

SetHeroClass(ALL, "all_hero_luke_jedi")
SetHeroClass(IMP, "imp_hero_darthvader")

SetTeamName (3, "Empire")
AddUnitClass (3, "imp_inf_rifleman_local", 5,10)
SetUnitCount (3, 10)
AddAIGoal(3, "Deathmatch", 100)

SetTeamName (4, "Alliance")
AddUnitClass (4, "all_inf_rifleman_local", 5,10)
SetUnitCount (4, 10)
AddAIGoal(4, "Deathmatch", 100)

SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsEnemy(DEF,3)
SetTeamAsEnemy(3,DEF)

SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)

SetTeamAsEnemy(3,4)
SetTeamAsEnemy(4,3)

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 2) -- 1x2 (1 pair of legs)
AddWalkerType(2, 2) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)

local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 64)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("CommandWalker", 1)
SetMemoryPoolSize("CommandFlyer", 4)
SetMemoryPoolSize("EntityRemoteTerminal", 20)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntityWalker", 3)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:CMW\\CMW.lvl", "CMW_conquest","CMW_GCW")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)


OpenAudioStream("dc:sound\\cmw.lvl", "cmwcw_music")
OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\spa.lvl", "spa")
OpenAudioStream("sound\\spa.lvl", "spa")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(1, "allleaving")
SetOutOfBoundsVoiceOver(2, "impleaving")

SetAmbientMusic(ALL, 1.0, "all_myg_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_myg_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2,"all_myg_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_myg_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_myg_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2,"imp_myg_amb_end", 2,1)

SetVictoryMusic(ALL, "all_myg_amb_victory")
SetDefeatMusic (ALL, "all_myg_amb_defeat")
SetVictoryMusic(IMP, "imp_myg_amb_victory")
SetDefeatMusic (IMP, "imp_myg_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.974338, -0.222180, 0.035172, 0.008020, -82.664650, 23.668301, 43.955681);
AddCameraShot(0.390197, -0.089729, -0.893040, -0.205362, 23.563562, 12.914885, -101.465561);
AddCameraShot(0.169759, 0.002225, -0.985398, 0.012916, 126.972809, 4.039628, -22.020613);
AddCameraShot(0.677453, -0.041535, 0.733016, 0.044942, 97.517807, 4.039628, 36.853477);
AddCameraShot(0.866029, -0.156506, 0.467299, 0.084449, 7.685640, 7.130688, -10.895234);
end

[/code]
I were very grateful if you knew how to fix this.
Thanks in advance.

Re: FLyer Splines don't work correctly

Posted: Sat May 30, 2015 8:15 am
by Marth8880
Hmm, are they following the splines *at all*? :o

Re: FLyer Splines don't work correctly

Posted: Sat May 30, 2015 8:19 am
by Locutus
Your path is labeled incorrectly.
You need to add the attribute "entitypath" when creating it. In the pth file it will then look like this:

Code: Select all

Path("type_entitypath tiefighters")

Re: FLyer Splines don't work correctly

Posted: Sat May 30, 2015 9:05 am
by thelegend
Thank you Locutus. Now the tie fighters follow the path but when they arrived at the last node they fly back and crash into the hangar. Even the rebel fighters follow this path although I didn't put the name of the path into their odf files..? I still will play around with the flyer pathing. If I remember correctly you had that problem too (Locutus) on your map. But I am not sure.

Edit: Oh I forgot the question: Is there a way to prevent them from flying back, because I through the "direction" property would force them to follow any direction until they got hit by other vehicles (or any ordnances).

Re: FLyer Splines don't work correctly

Posted: Sat May 30, 2015 12:51 pm
by Locutus
If you want only certain units to follow your path you need to define a class for that path. This class needs to be specified in your unit odf.
Example:
Path("type_EntityPath entitypath_tau_302h_1")
{
Data(0);
PathType(0);
PathSpeedType(0);
PathTime(0.000000);
OffsetPath(0);
Layer(2);
SplineType("Hermite");

Properties(3)
{
class("tau");
direction(1);
}

Nodes(6)
{
Node()
[...]
thelegend wrote:Is there a way to prevent them from flying back, because I through the "direction" property would force them to follow any direction until they got hit by other vehicles (or any ordnances).
I've had trouble with this as well... It didn't work always for me but make sure that there are other paths which the flyers can follow after leaving the first one.

Re: FLyer Splines don't work correctly

Posted: Sat May 30, 2015 1:06 pm
by thelegend
ah ok. Thank you very much. Now I got it working.