Page 1 of 1

Flying path?

Posted: Wed Nov 12, 2008 6:15 am
by jedi_pilot
I have a couple of questions:

-Is there a way to make an aircraft fly on a certain path?

-Can you make the aircraft start in midair with gunners inside of it?

Thank's.

Re: Flying path?

Posted: Wed Nov 12, 2008 6:48 am
by computergeek
For the first one- They're called flyer spline paths, read the doc for it (read the whole thing)

Re: Flying path?

Posted: Wed Nov 12, 2008 12:50 pm
by Frisbeetarian
Depends on what you actually want for the second. In actuality, I don't believe you can do exactly what you said, but if you want to just have something flying around shooting, then you could rig something. I believe you could just animate objects that consist of a ship and some auto-turrets.

Re: Flying path?

Posted: Wed Nov 12, 2008 4:37 pm
by jedi_pilot
computergeek wrote:For the first one- They're called flyer spline paths, read the doc for it (read the whole thing)
And what doc would that be :wink: ???

Re: Flying path?

Posted: Wed Nov 12, 2008 4:48 pm
by Maveritchell
jedi_pilot wrote:
computergeek wrote:For the first one- They're called flyer spline paths, read the doc for it (read the whole thing)
And what doc would that be :wink: ???
I bet if you opened the documentation folder it would be pretty obvious, wink. :roll:

Re: Flying path?

Posted: Sat Nov 22, 2008 6:34 am
by jedi_pilot
Well, I read trough the doc. But I'm a bit confused on how you make the aircraft not playable, and how you get it to take off and fly to the spline path. The doc isn't to specific on that point :lol: ...

Re: Flying path?

Posted: Sat Nov 22, 2008 11:54 am
by computergeek
The AI will automatically find the nearest spline path and follow it. You have to name the path "entitypath insertwhaeverhere" in ZE and then copy EXACTLY what you put in ZE into your lua like this

Code: Select all

EnableFlyerPath("entitypath cisflyout", "entitypath repstrafe", "entity cisnocrash", "entity repfly", "entity cisstrafe", 1);
The different names are all individual paths. You must name the path "entitypath *" or else it will not work
Put the EnableFlyerPath after

Code: Select all

    conquest:AddCommandPost(cp4)
    
    conquest:Start()
Here's my lua for an example
Hidden/Spoiler:
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("tele_veh")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
AmbushTeam = 5
ATM = AmbushTeam


function ScriptPostLoad()


--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"}



--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:Start()

SetUberMode(1);
SetGroundFlyerMap(1);
EnableFlyerPath("entitypath cisflyout", "entitypath repstrafe", "entity cisnocrash", "entity repfly", "entity cisstrafe", 1);

EnableSPHeroRules(1)
SetupAmbushTrigger("ambushregion", "ambushpath", 6, 5)

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode")
end,
"TeleportRegion")
ActivateRegion("TeleportRegion")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"cis-telepath")
end,
"cis-tele")
ActivateRegion("cis-tele")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"Snipernode")
end,
"TeleportSniper")
ActivateRegion("TeleportSniper")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"arctele")
end,
"arcgun"
)
ActivateRegion("arcgun")

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(320)
SetMaxPlayerFlyHeight (300)

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("dc:sound\\efx.lvl;efxcw")
ReadDataFile("sound\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\n1.lvl",
"all_fly_n1")
ReadDataFile("dc:SIDE\\dwarfspider.lvl",
"cis_walk_dwarfspider")
ReadDataFile("dc:SIDE\\gar.lvl",
"gar_inf_soldier",
"gar_inf_temple_vanguard",
"gar_inf_pilot",
"gar_inf_temple_soldier",
"gar_inf_vanguard")
ReadDataFile("dc:SIDE\\vehicles.lvl",
"all_fly_bwing",
"all_fly_virago",
"bes_fly_cloudcar",
"all_hover_hovernaut",
"imp_fly_tiephantom",
"all_fly_kwing",
"rep_fly_v19",
"rep_fly_obiwanstarfighter",
"all_fly_moldy_crow",
"all_fly_falcon",
"rep_fly_arc_gunship")
ReadDataFile("dc:SIDE\\all.lvl",
"all_fly_snowspeeder",
"all_fly_xwing_sc",
"all_fly_awing",
"all_fly_ywing_sc",
"all_hover_bos_combatspeeder")
ReadDataFile("dc:SIDE\\imp.lvl",
"imp_walk_atat",
"imp_fly_tiefighter_sc",
"imp_walk_atst_jungle",
"imp_fly_tieinterceptor",
"imp_fly_trooptrans",
"imp_fly_tiebomber_sc",
"imp_hover_fightertank",
"imp_hover_speederbike")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_hover_fightertank",
"rep_hover_barcspeeder",
"rep_fly_arc170fighter_sc",
"rep_fly_jedifighter_sc",
"rep_fly_gunship",
"rep_fly_vwing",
"rep_walk_oneman_atst",
"rep_inf_clone_commando",
"rep_walk_atte",
"rep_inf_ep2_rocketeer",
"rep_fly_ebonhawk_sc")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hover_aat",
"cis_fly_droidfighter_sc",
"cis_fly_tridroidfighter",
"cis_fly_greviousfighter",
"cis_fly_maf",
"cis_fly_droidgunship",
"cis_tread_hailfire",
"cis_tread_snailtank",
"cis_walk_spider",
"cis_hover_mtt")


ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_built_chaingun",
"tur_bldg_tower")

SetupTeams{
rep = {
team = REP,
units = 175,
reinforcements = 500,
soldier = { "rep_inf_ep3_rifleman",15, 100},
assault = { "rep_inf_ep3_rocketeer",10, 15},
engineer = { "rep_inf_ep3_engineer",10, 15},
sniper = { "rep_inf_ep3_sniper",10, 15},
officer = {"rep_inf_ep3_officer",10, 15},
special = { "rep_inf_ep3_jettrooper",10, 15},

},
cis = {
team = CIS,
units = 215,
reinforcements = 500,
soldier = { "cis_inf_rifleman",15, 100},
assault = { "cis_inf_rocketeer",10, 15},
engineer = { "cis_inf_engineer",10, 15},
sniper = { "cis_inf_sniper",10, 15},
officer = {"cis_inf_officer",10, 15},
special = { "cis_inf_droideka",10, 15},
},
atm = {
team = ATM,
units = 6,
reinforcements = -1,
soldier = { "cis_inf_rifleman", 6, 6},
},
}

SetTeamName (3, "CIS")
AddUnitClass (3, "cis_inf_rifleman", 10,15)
AddUnitClass (3, "cis_inf_rocketeer", 10,15)
AddUnitClass (3, "cis_inf_officer", 10,15)
SetUnitCount (3, 15)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsEnemy(DEF,3)
SetTeamAsEnemy(3,DEF)

SetTeamName (4, "GAR")
AddUnitClass (4, "gar_inf_soldier", 10,15)
AddUnitClass (4, "gar_inf_temple_vanguard", 10,15)
AddUnitClass (4, "gar_inf_temple_soldier", 10,15)
AddUnitClass (4, "gar_inf_vanguard", 10,15)
SetUnitCount (4, 15)
AddAIGoal(4, "Deathmatch", 100)
SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsEnemy(DEF,4)
SetTeamAsEnemy(4,DEF)

SetTeamAsEnemy(REP,5)
SetTeamAsEnemy(5,REP)
SetTeamAsEnemy(CIS,5)
SetTeamAsEnemy(5,CIS)
ClearAIGoals(ATM)
AddAIGoal(5, "Deathmatch", 100)
SetTeamName(ATM, CIS)

SetHeroClass(CIS, "rep_inf_ep2_rocketeer")
SetHeroClass(REP, "rep_inf_clone_commando")

-- Level Stats
-- ClearWalkers()
AddWalkerType(0, 4) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)
local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 225)
SetMemoryPoolSize("AmmoCounter", 1624)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", 1624)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityWalker", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 276)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 450)
SetMemoryPoolSize("UnitController", 620)
SetMemoryPoolSize("Weapon", 1622)
SetMemoryPoolSize("CommandWalker", 32)
SetMemoryPoolSize("CommandFlyer", 32)
SetMemoryPoolSize("CommandHover", 32)
SetMemoryPoolSize("WalkerBlendUnit", 105)
SetMemoryPoolSize("WalkerLegPair", 15)
SetMemoryPoolSize("SoldierAnimation", 600)

SetSpawnDelay(10.0, 0.25)
--ReadDataFile("dc:DTM\\DTM.lvl", "DTM_conquest")
ReadDataFile("dc:DTM\\DTM.lvl", "DTM_conquest")
SetDenseEnvironment("false")




-- Sound

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)

OpenAudioStream("dc:sound\\efx.lvl", "efxcw_music")
OpenAudioStream("sound\\global.lvl", "global_vo_quick")
OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\yav.lvl", "yav1")
OpenAudioStream("sound\\yav.lvl", "yav1")
OpenAudioStream("sound\\yav.lvl", "yav1_emt")

SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

SetOutOfBoundsVoiceOver(2, "cisleaving")
SetOutOfBoundsVoiceOver(1, "repleaving")

SetAmbientMusic(REP, 1.0, "rep_kam_amb_start", 0,1);
--SetAmbientMusic(REP, 0.8, "rep_kam_amb_middle", 1,1);
--SetAmbientMusic(REP, 0.2,"rep_kam_amb_end", 2,1);
SetAmbientMusic(CIS, 1.0, "cis_kam_amb_start", 0,1);
--SetAmbientMusic(CIS, 0.8, "cis_kam_amb_middle", 1,1);
--SetAmbientMusic(CIS, 0.2,"cis_kam_amb_end", 2,1);

SetVictoryMusic(REP, "rep_kam_amb_victory")
SetDefeatMusic (REP, "all_tat_amb_defeat")
SetVictoryMusic(CIS, "cis_kam_amb_victory")
SetDefeatMusic (CIS, "imp_tat_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("BirdScatter", "birdsFlySeq1")
--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")


--OpeningSateliteShot
AddCameraShot(0.982625, -0.182699, -0.032146, -0.005977, 96.469330, 72.024132, 271.092987);

AddCameraShot(0.524712, -0.190674, -0.779762, -0.283357, 26.373480, 136.596024, 123.809837);
AddCameraShot(0.982625, -0.182699, -0.032146, -0.005977, 96.469330, 72.024132, 271.092987);
AddCameraShot(0.625107, 0.089237, 0.767639, -0.109584, -267.856293, 61.895550, 533.912292);
AddCameraShot(0.404225, -0.068854, -0.899114, -0.153151, -51.290764, 101.753174, 294.500275);


end
function MoveEntityToNode(entIn,pathIn,nodeIn)
if not entIn then
print("Warning!: Entity not specified for move")
return false
elseif not pathIn then
print("Warning!: Path not specified for Entity " .. entIn .. " move")
return false
end

local node
if nodeIn then
node = nodeIn
else
node = 0
end

local locDest = GetPathPoint(pathIn,node)
local charUnit = GetCharacterUnit(entIn)
local charVeh = GetCharacterVehicle(entIn)
if charVeh then
SetEntityMatrix(charVeh,locDest)
elseif charUnit then
SetEntityMatrix(charUnit,locDest)
return true
end
return false
end

Re: Flying path?

Posted: Sat Nov 22, 2008 1:41 pm
by Maveritchell
I honestly don't think you need to put them in your .lua (or at the least calling for them is redundant). In my experience, putting them in there generates an unnecessary Sev 3 error in the log and not calling them in your .lua has no effect - as long as they're named "entitypath whatevernamehere" the AI flyers will follow them.

Re: Flying path?

Posted: Sat Nov 22, 2008 1:49 pm
by computergeek
Oh, ok thanks Mav
I thought you needed to (atleast that's what the doc led me to believe)

Re: Flying path?

Posted: Sat Nov 22, 2008 1:51 pm
by Maveritchell
computergeek wrote:I thought you needed to (atleast that's what the doc led me to believe)
No, you're right, that's exactly what the doc said to do. I think it's just a mistake (or like I said, maybe a redundant aspect) on the part of the devs.

Re: Flying path?

Posted: Sun Nov 23, 2008 3:15 pm
by jedi_pilot
Ok, that's what I figured :yes: . But is there a way you can make the aircraft spawn in middair(like the campaign mission on kamino) so that the human can't fly the aircraft???

Re: Flying path?

Posted: Sun Nov 23, 2008 4:53 pm
by Maveritchell
No, and those "flyers" in campaign Kamino aren't really flyers, either. They're animated turrets.

Re: Flying path?

Posted: Sun Nov 23, 2008 5:04 pm
by Aman/Pinguin
Maveritchell wrote:No, and those "flyers" in campaign Kamino aren't really flyers, either. They're animated turrets.
Of course you can. Just make them auto piloted and place the vehicle spawns in mid air.

Re: Flying path?

Posted: Sun Nov 23, 2008 5:06 pm
by Maveritchell
Aman/Pinguin wrote:Of course you can. Just make them auto piloted and place the vehicle spawns in mid air.
They still have to take off, though, they can't just be spawned flying.

Re: Flying path?

Posted: Sun Nov 23, 2008 5:08 pm
by Aman/Pinguin
Maveritchell wrote:
Aman/Pinguin wrote:Of course you can. Just make them auto piloted and place the vehicle spawns in mid air.
They still have to take off, though, they can't just be spawned flying.
Well thats true, but not a problem. I used that method often.

Re: Flying path?

Posted: Sun Nov 23, 2008 5:14 pm
by Sky_216
Aman/Pinguin wrote:
Maveritchell wrote:
Aman/Pinguin wrote:Of course you can. Just make them auto piloted and place the vehicle spawns in mid air.
They still have to take off, though, they can't just be spawned flying.
Well thats true, but not a problem. I used that method often.
Well yeah but since they're autopiloted and you can't use them anyway just muck around with TakeOffHeight/Speed/Time so they'll just go straight forward after a second.

Oh and this thread was real useful BTW.

Re: Flying path?

Posted: Mon Nov 24, 2008 12:25 pm
by jedi_pilot
Aman/Pinguin wrote:Of course you can. Just make them auto piloted and place the vehicle spawns in mid air.
How do you make them auto piloted :? ???

Re: Flying path?

Posted: Mon Nov 24, 2008 12:31 pm
by Aman/Pinguin
Put

Code: Select all

Pilottype       = "self"
into the ODF

Re: Flying path?

Posted: Mon Nov 24, 2008 3:53 pm
by jedi_pilot
Ok :) . Does this work with the turrets on the aircraft as well???