--DESCRIPTION: Press E or Q to loop the animations set --DESCRIPTION: how close the player needs to be to change animation --DESCRIPTION: [DIST=300] --DESCRIPTION: [ANGLE=45] --DESCRIPTION: [@Anim1=1(0=AnimSetList)] --DESCRIPTION: [@Anim2=2(0=AnimSetList)] --DESCRIPTION: [@Anim3=3(0=AnimSetList)] --DESCRIPTION: [@Anim4=4(0=AnimSetList)] --DESCRIPTION: [@Anim5=5(0=AnimSetList)] --DESCRIPTION: [@Anim6=6(0=AnimSetList)] --DESCRIPTION: [@Anim7=7(0=AnimSetList)] --DESCRIPTION: [@Anim8=8(0=AnimSetList)] --DESCRIPTION: [@Anim9=9(0=AnimSetList)] master_interpreter_core = require "scriptbank\\masterinterpreter" U = require "scriptbank\\utillib" g_animation_checker = {} g_animation_checker_behaviour = {} epressed = false qpressed = false function animation_checker_properties(e, dist, angle, anim1, anim2, anim3, anim4, anim5, anim6, anim7, anim8, anim9) local ac = g_animation_checker[e] ac.bycfilename = "scriptbank\\smallg_max\\animation_checker.byc" g_animation_checker_behavior_count = master_interpreter_core.masterinterpreter_load (ac, g_animation_checker_behaviour ) ac.dist = dist ac.angle = angle ac.anim1 = anim1 ac.anim2 = anim2 ac.anim3 = anim3 ac.anim4 = anim4 ac.anim5 = anim5 ac.anim6 = anim6 ac.anim7 = anim7 ac.anim8 = anim8 ac.anim9 = anim9 ac.currentanim = 1 ac.oldanim = 0 end function animation_checker_init(e) g_animation_checker[e] = {} end function animation_checker_main(e) local ac = g_animation_checker[e] if U.PlayerLookingNear( e, ac.dist, ac.angle ) == true then if g_KeyPressE == 1 then if not epressed then ac.currentanim = ac.currentanim + 1 if ac.currentanim > 9 then ac.currentanim = 1 end epressed = true end else epressed = false end if g_KeyPressQ == 1 then if not qpressed then ac.currentanim = ac.currentanim - 1 if ac.currentanim < 1 then ac.currentanim = 9 end qpressed = true end else qpressed = false end PromptLocal(e,"currently playing animation : "..ac.currentanim..", frame : "..GetAnimationFrame(e)) end if ac.oldanim ~= ac.currentanim then local ca = g_animation_checker_behaviour[ac.currentanim].actionparam1 if ca == nil then return end local isdlua = string.find(ca,"=") if isdlua == nil then return end local dluavarname = string.sub(ca,2) actionparam1value = ac[dluavarname] tusethisanim = "=" .. tostring(actionparam1value) SetAnimationName(e,tusethisanim) LoopAnimation(e) ac.oldanim = ac.currentanim end end