Ok, once again time for my random troubles.
I have been trying for the past few months to get a animation of a door to go up and block off a passage when you destory a panel, and to go back down when you fix the panel. (I know that my animation works because I can use FC to run the command PlayAnimation("") in game)
Here is my scirpt:
---------------------------------------------------------------------------
-- ScriptInit
---------------------------------------------------------------------------
function ScriptInit()
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "panel1" then
PlayAnimation("wdown")
end
end
)
killobjc = OnObjectKill(
function(object, killer)
if killer and IsCharacterHuman(killer) and GetEntityName(object) == "panel1" then
AddAssaultDestroyPoints(killer)
end
end
)
ReadDataFile("dc:Load\\common.lvl")
The names of the Animations and objects are as follows:
wup: Animation to raise the door up.
wdown: Animation to lower the door.
panel1: Panel object.
I looked at Mav's "Trigger animation on destruction of object?" topic on the FAQ, and that is where I got the scripting for this.
I figured I would work out the acctual work of the panel and animation before I added in the animation reseting script work.
I am pretty sure I messed up the input of the object/animation names or added all the LUA work to the wrong section of the script. Any help?
Re: Scriptied Animation
Posted: Sun Jan 06, 2013 10:21 pm
by AQT
Your functions should go before function ScriptInit().
Re: Scriptied Animation
Posted: Sun Jan 06, 2013 11:47 pm
by Loopy53
they are before script init try script poastload see if that works.
Re: Scriptied Animation
Posted: Sun Jan 06, 2013 11:58 pm
by AQT
No, they are currently afterfunction ScriptInit(). And being after function ScriptPostLoad() is the same thing as being before function ScriptInit().
Re: Scriptied Animation
Posted: Mon Jan 07, 2013 12:00 pm
by Bonecrusher16O
Alright, now it just crashes after about a second of loading.
Error Log:
Hidden/Spoiler:
[code]Opened logfile BFront2.log 2013-01-07 1057
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy english 0
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: No custom_gc_5.lvl
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: No custom_gc_10.lvl
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_GetGCButtonList()
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawl.mvs
shell_interface: Opening movie: movies\shell.mvs
shell_interface: Leaving
Mission Checker: Entered addme
Mission Checker: addme: Now listening in on AddDownloadableContent() calls
Mission Checker: Exited addme
addme.lua too old: read version 4.0; expected at least 5.0
prev = none iLastPage = nil
prev = texture iLastPage = 1
prev = texture iLastPage = 2
prev = texture iLastPage = 3
ifs_legal.Exit
Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\GameMovie.cpp(399)
Unable to find open movie segment shell_main
ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadFileList
ifs_saveop_DoOps LoadProfile
ifs_saveop_DoOps LoadProfile
ifs_sp_campaign: Input_Accept(): Entered: _tab_instant
missionlist_ExpandMapList()
ifs_missionselect_pcMulti_fnSetMapPreview(): Defaulting index to 1
this.CurButton = nil
cur_button = nil
DoubleClicked
custom_AddMapNew()
custom_printTable(): table: 04B1116C
The key, value is: mode_eli_c 1
The key, value is: era_g 1
The key, value is: mode_con_c 1
The key, value is: isModLevel 1
The key, value is: bSelected 1
The key, value is: mode_1flag_c 1
The key, value is: era_c 1
The key, value is: mode_con_g 1
The key, value is: mode_eli_g 1
The key is mapluafile, the formated value is: AAH<A>_<B>
custom_printTable(): Returning
custom_printTable(): table: 04B1672C
The key, value is: key mode_con
The key, value is: subst con
The key, value is: showstr modename.name.con
The key, value is: descstr modename.description.con
The key, value is: icon mode_icon_con
custom_printTable(): Returning
this.CurButton = nil
cur_button = nil
this.CurButton = nil
cur_button = nil
this.CurButton = check_mode6
cur_button = nil
Checkbox for check_era7 clicked
this.CurButton = check_era7
cur_button = nil
custom_AddMapNew()
custom_printTable(): table: 04D1ECBC
The key, value is: blue 0
The key, value is: mode_eli_g 1
The key, value is: isModLevel 1
The key, value is: bSelected 1
The key, value is: era_g 1
The key, value is: green 0
The key is mapluafile, the formated value is: SAM<A>_<B>
The key, value is: mode_eli_w 1
The key, value is: era_w 1
The key, value is: red 225
custom_printTable(): Returning
custom_printTable(): table: 04B167AC
The key, value is: key mode_eli
The key, value is: subst eli
The key, value is: showstr modename.name.hero-assault
The key, value is: descstr modename.description.elimination
The key, value is: icon mode_icon_eli
custom_printTable(): Returning
gMapEras.key = era_g Era = era_g subst = g
Adding map: SAMg_eli idx: 1
this.CurButton = _map_add
cur_button = nil
this.CurButton = Launch
cur_button = nil
(none):0: attempt to call global `OnObjectKill' (a nil value)[/code]
Re: Scriptied Animation
Posted: Mon Jan 07, 2013 1:25 pm
by Locutus
When using a conquest script make sure your functions go after conquest:Start() but before the PostLoad end.
You script should look like this:
function ScriptPostLoad()
--Stuff like CP setup or whatever
conquest:Start()
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "panel1" then
PlayAnimation("wdown")
end
end
)
killobjc = OnObjectKill(
function(object, killer)
if killer and IsCharacterHuman(killer) and GetEntityName(object) == "panel1" then
AddAssaultDestroyPoints(killer)
end
end
)
end
---------------------------------------------------------------------------
--
---------------------------------------------------------------------------
function ScriptInit()
Re: Scriptied Animation
Posted: Mon Jan 07, 2013 1:51 pm
by Bonecrusher16O
But the map is not Conquest, it is Eli/Assault.
Re: Scriptied Animation
Posted: Mon Jan 07, 2013 7:45 pm
by Loopy53
@AQT My bad, I read your post wrong. Sorry.
Re: Scriptied Animation
Posted: Mon Jan 07, 2013 7:51 pm
by Marth8880
The same goes with any game mode, so the stuff must go after conquest:Start(), or ctf:Start(), or TDM:Start() in your case.
Re: Scriptied Animation
Posted: Mon Jan 07, 2013 8:49 pm
by Bonecrusher16O
Yeah, I put it behind that..
Re: Scriptied Animation
Posted: Mon Jan 07, 2013 8:53 pm
by Dreadnot9
Post your entire lua.
Re: Scripted Animation
Posted: Tue Jan 08, 2013 8:14 pm
by Bonecrusher16O
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- Mos Eisley Hero Deathmatch (uses Space Assault rules)
-- First team to reach 100 kills wins
--
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "panel1" then
PlayAnimation("wdown")
end
end
)
killobjc = OnObjectKill(
function(object, killer)
if killer and IsCharacterHuman(killer) and GetEntityName(object) == "panel1" then
AddAssaultDestroyPoints(killer)
end
end
)
---------------------------------------------------------------------------
-- ScriptInit
---------------------------------------------------------------------------
function ScriptInit()
ReadDataFile("dc:Load\\common.lvl")
StealArtistHeap(1536*1024)
-- Designers, these two lines *MUST* be first!
SetPS2ModelMemory(2097152 + 65536 *
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",1144) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",500) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",400) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",88) -- should be ~1x #combo
ReadDataFile("ingame.lvl")
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- Mos Eisley Hero Deathmatch (uses Space Assault rules)
-- First team to reach 100 kills wins
--
animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "panel1" then
PlayAnimation("wdown")
end
end
)
killobjc = OnObjectKill(
function(object, killer)
if killer and IsCharacterHuman(killer) and GetEntityName(object) == "panel1" then
AddAssaultDestroyPoints(killer)
end
end
)
--and add it here AFTER your functions (just like I said )
---------------------------------------------------------------------------
-- ScriptInit
---------------------------------------------------------------------------
function ScriptInit()
ReadDataFile("dc:Load\\common.lvl")
StealArtistHeap(1536*1024)
-- Designers, these two lines *MUST* be first!
SetPS2ModelMemory(2097152 + 65536 *
SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",1144) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",500) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",500) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",400) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",88) -- should be ~1x #combo
ReadDataFile("ingame.lvl")
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2
It still doesn't work. When I destory the panel (correctly named) the animation does not play..
(Thx for the info on the "end" though, I can't believe I missed that.)
Re: Scripted Animation
Posted: Sat Jan 12, 2013 2:49 am
by AQT
Please post a screenshot of your animation's settings in ZE. Also, please post a screenshot of the panel in ZE with its name and object type displayed.
Re: Scripted Animation
Posted: Sat Jan 12, 2013 3:35 pm
by Bonecrusher16O
Umm how? When I save an image on Zero Edit it shows the objects but not the any of the tool bars. And Print Screen button only works for SWBF2 ingame.
Re: Scripted Animation
Posted: Sat Jan 12, 2013 4:13 pm
by CressAlbane
PrntScrn just copies your current display to the clipboard.
Re: Scripted Animation
Posted: Sat Jan 12, 2013 4:27 pm
by Bonecrusher16O
Not for me... (Or am is it because I am trying to paste it off the clipboard?)
Re: Scripted Animation
Posted: Sat Jan 12, 2013 5:39 pm
by Loopy53
here is an easier way. search snipping tool in the start menu. Open it, drag around ZE, save as .png, and upload to dropbox.