Page 1 of 1

Animation on Destruction of Object [Solved]

Posted: Wed Jan 22, 2014 8:15 am
by LukeBenVader1
I am making a Bespin map with those floating platforms and I was thinking that when I destroy a platform with objects on it, the objects will fall. But does anyone know how to edit the script so the animation would play on the destruction of the platform?

Re: Animation on Destruction of Object

Posted: Wed Jan 22, 2014 8:39 am
by AQT

Re: Animation on Destruction of Object

Posted: Thu Jan 23, 2014 2:58 pm
by LukeBenVader1
Tried that, but the game would crash. Here's what I put in the script:
Hidden/Spoiler:
...conquest:Start()

EnableSPHeroRules()

end

animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "bes1_bldg_gas_platform1" then
PlayAnimation("fall")
end
end
)

killobjc = OnObjectKill(
function(object, killer)
if killer and IsCharacterHuman(killer) and GetEntityName(object) == "bes1_bldg_gas_platform1" then
AddAssaultDestroyPoints(killer)
end
end
)...
and the error log:
Hidden/Spoiler:
Opened logfile BFront2.log 2014-01-23 1336
shell_interface: Entered
shell_interface: Reading in custom strings
ifs_era_handler - Entered
ifs_era_handler - Exited
custom_GetSPMissionList()
custom_GetMPMissionList()
custom_EraButtonList(): Building era button table
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Building era table
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Building game mode table
custom_GetGMapModes(): Finished building game mode table Known Modes: 38
custom_GetMPGameModeList(): Building game mode list table
custom_GetMPGameModeList(): Finished building game mode list table List Length: 39
custom_SetMovieLocation()
custom_AddEraBoxes()
custom_SetMovieLocation()
custom_AddEraBoxes()
ingame stream movies\crawl.mvs
shell_interface: Opening movie: movies\shell.mvs
shell_interface: Leaving
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_missionselect_pcMulti_fnSetMapPreview(): Defaulting index to 1
this.CurButton = check_mode1
cur_button = nil
Checkbox for check_era7 clicked
this.CurButton = check_era7
cur_button = nil
custom_AddMapNew()
custom_printTable(): table: 0583118C
The key, value is: mode_xl_g 1
The key, value is: era_g 1
The key, value is: mode_eli_g 1
The key is mapluafile, the formated value is: BSR<A>_<B>
The key, value is: mode_con_g 1
The key, value is: bSelected 1
The key, value is: isModLevel 1
custom_printTable(): Returning
custom_printTable(): table: 058366CC
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
gMapEras.key = era_g Era = era_g subst = g
Adding map: BSRg_con idx: 1
this.CurButton = _map_add
cur_button = nil
this.CurButton = nil
cur_button = nil
this.CurButton = Launch
cur_button = nil
(none):0: attempt to call global `OnObjectKill' (a nil value)

Re: Animation on Destruction of Object

Posted: Thu Jan 23, 2014 5:30 pm
by AQT
You need to put those two functions before the end in red instead:
LukeBenVader1 wrote:
Hidden/Spoiler:
...conquest:Start()

EnableSPHeroRules()

end

animateobja = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "bes1_bldg_gas_platform1" then
PlayAnimation("fall")
end
end
)

killobjc = OnObjectKill(
function(object, killer)
if killer and IsCharacterHuman(killer) and GetEntityName(object) == "bes1_bldg_gas_platform1" then
AddAssaultDestroyPoints(killer)
end
end
)...
That end is the one that closes off function ScriptPostLoad().

Re: Animation on Destruction of Object

Posted: Fri Jan 24, 2014 8:11 am
by LukeBenVader1
Thanks a million! Animation is now working.