Animations are stopping ai from spawning?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Squirrel7Hunter

Animations are stopping ai from spawning?

Post by Squirrel7Hunter »

Ok, I have just now started animating objects! woohoo! I have no clue what any ofthe stuff in the my lua is cause I just copied it from the Utapau map, ( the hovering rep gunship) I added that to my map, anyway, for some reason my units arnt spawning, but the animations work. here is my lUa if anyone can help. thnks!


--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

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

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


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",
isUberMode = true,
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);

EnableSPHeroRules()

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 ScriptPostLoad()

SetProperty("LAATAttack", "MaxHealth", 150)
SetProperty("LAATAttack", "CurHealth", 150)

SetProperty("LAATRider", "MaxHealth", 150)
SetProperty("LAATRider", "CurHealth", 150)

laanim = 1
lranim = 2
la_anim()
lr_anim()

-- This is the LAAT Callback info
la_death = OnObjectKillName(la_anim, "LAATAttack");
lr_death = OnObjectKillName(lr_anim, "LAATRider");

la_timer = CreateTimer("la_timer")
SetTimerValue(la_timer, 20)
StartTimer(la_timer)

OnTimerElapse(
function(timer)
KillObject("LAATAttack")
end,
la_timer
)

lr_timer = CreateTimer("lr_timer")
SetTimerValue(lr_timer, 20)
StartTimer(lr_timer)

OnTimerElapse(
function(timer)
KillObject("LAATRider")
end,
lr_timer
)
end

function la_anim()
if laanim == 1 then
PauseAnimation("LA03");
RewindAnimation("LA01");
PlayAnimation("LA01");
EntityFlyerTakeOff("LAATAttack")
laanim = 2


elseif laanim == 2 then
PauseAnimation("LA01");
RewindAnimation("LA02");
PlayAnimation("LA02");
EntityFlyerTakeOff("LAATAttack")
laanim = 3


elseif laanim == 3 then
PauseAnimation("LA02");
RewindAnimation("LA03");
PlayAnimation("LA03");
EntityFlyerTakeOff("LAATAttack")
laanim = 1
end

SetTimerValue(la_timer, 30)
StartTimer(la_timer)
end

function lr_anim()
if lranim == 1 then
PauseAnimation("LR03");
RewindAnimation("LR02");
PlayAnimation("LR02");
EntityFlyerTakeOff("LAATRider")
lranim = 2


elseif lranim == 2 then
PauseAnimation("LR01");
RewindAnimation("LR03");
PlayAnimation("LR03");
EntityFlyerTakeOff("LAATRider")
lranim = 3


elseif lranim == 3 then
PauseAnimation("LR02");
RewindAnimation("LR01");
PlayAnimation("LR01");
EntityFlyerTakeOff("LAATRider")
lranim = 1
end

SetTimerValue(lr_timer, 30)
StartTimer(lr_timer)
end

function Backup()
SetProperty("LAATDrop01", "MaxHealth", 1250)
SetProperty("LAATDrop01", "CurHealth", 1250)
EntityFlyerTakeOff("LAATDrop01")
EntityFlyerInitAsLanded("LAATAttack")
KillObject("LAATAttack")
KillObject("LAATRider")
DestroyTimer(lr_timer)
DestroyTimer(la_timer)
ReleaseObjectKill(la_death)
ReleaseObjectKill(lr_death)
DeactivateRegion(backup_region)
PauseAnimation("LA01");
PauseAnimation("LA02");
PauseAnimation("LA03");
PauseAnimation("LR01");
PauseAnimation("LR02");
PauseAnimation("LR03");
PauseAnimation("drop-hide");

RewindAnimation("LA-hide");
PlayAnimation("LA-hide");
RewindAnimation("LR-hide");
PlayAnimation("LR-hide");

RewindAnimation("Backup");
PlayAnimation("Backup");

end

function Helpers()
SetProperty("LAATDrop01", "MaxHealth", 1250)
SetProperty("LAATDrop01", "CurHealth", 1250)
SetProperty("LAATDrop02", "MaxHealth", 1250)
SetProperty("LAATDrop02", "CurHealth", 1250)
EntityFlyerTakeOff("LAATDrop01")
EntityFlyerTakeOff("LAATDrop02")
EntityFlyerInitAsLanded("LAATAttack")
EntityFlyerInitAsLanded("LAATRider")
DeactivateRegion(helpers_region)

PauseAnimation("hide02");
PauseAnimation("Backup");
RewindAnimation("backup2");
PlayAnimation("backup2");
EntityFlyerTakeOff("LAATDrop01")
EntityFlyerTakeOff("LAATDrop02")

end

function ScriptInit()

ReadDataFile("ingame.lvl")

SetMaxFlyHeight(500)
SetMaxPlayerFlyHeight (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\\mus.lvl;mus1cw")
ReadDataFile("sound\\yav.lvl;yav1cw")
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_fly_assault_dome",
"rep_fly_gunship_sc",
"uta1_fly_ride_gunship",
"uta1_prop_gunship",
"rep_fly_arc170fighter_sc",
"rep_fly_anakinstarfighter_sc",
"rep_inf_ep4_marine",
"rep_inf_ep3_jettrooper",
"rep_walk_atxt",
"rep_walk_oneman_atst",
"rep_walk_atte",
"rep_hover_fightertank",
"rep_hero_obiwan",
"rep_hover_barcspeeder")

etc.....etc.....
Qdin
Old School Staff
Posts: 2059
Joined: Wed Feb 23, 2005 9:54 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

RE: Animations are stopping ai from spawning?

Post by Qdin »

aren't you supposed to place the LAAT's in the manp, and then name it sometihng and THEN call it in the .lua? :o

Copying is not how you do :wink:

If I'm not mistaken, there's more than just the script :o you haave the .msh, .odf and .tga files etc.? :o and animations and all that?
Squirrel7Hunter

Post by Squirrel7Hunter »

yes. I have all the msh. odf. , and laat is in themap as a vehicle spawn point, the animations work, but no ai spawn. I dont understand any of that fly spline stuff in the documentation so I just tried it on my own.
Qdin
Old School Staff
Posts: 2059
Joined: Wed Feb 23, 2005 9:54 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Post by Qdin »

no - I meant: don't you have to place it in ZE as an object? :o
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Post by [RDH]Zerted »

Yeah, you shouldn't just copy code from one map into another without understanding what you are copying. In your case, you copied too much.

In your Lua, you have two ScriptPostLoad() functions. The first one setups all your spawn points and the second one setups your animations. You can never have two functions with the same name. It is like saying x = 5, then putting x = 7 and then assuming both x - 5 = 0 and x - 7 = 0 are true. The second ScriptPostLoad() overrides the first one, so the Conquest game mode is never setup or started.

To fix it, delete what I have in red:
EnableSPHeroRules()

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 ScriptPostLoad()


SetProperty("LAATAttack", "MaxHealth", 150)
Big_rich

Post by Big_rich »

--->Qdin, in this case it needs to be a vehicle spawn, cause it kills the object , via a timer to get rid of it at the end of the animation. If it's placed as an object it can't replay in diff animations, it's basically useing the same vehicle(s) for diff animations.

The easiest thing for you to do is remake the animations in ZE, name everything, (your own names), and rescript it using the uta one as a guide. You prob don't need anything as fancy as this script anyways. if you do need multiple animations, at diff times then yes, you will need a vehicle spawn, or multiple obj/animations.
Post Reply