Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
onAnimation
#1
How can I actually trigger something by using an animation, for example "S_1HATTACK" to print whenever it is used?
[Image: ?ip=193.70.2.209&port=27960&obrazek=4f73...e608b8.jpg]
Reply
#2
onAnimation + getAnimationName()
Reply
#3
function onAnimation()
{

local anim = getAnimationName();
if (anim == S_1HATTACK)
{
print("HIT");
}

}

doesnt seem to work
[Image: ?ip=193.70.2.209&port=27960&obrazek=4f73...e608b8.jpg]
Reply
#4
Why doesn't it work? Do you get an error-message? In any case: It should be "S_1HATTACK". You're probably missing the quotationmarks.
Reply
#5
Of course he missing "" and onAnimation body has argument aniId.
Reply
#6
Well yes I was missing it but I tried with quotations mark before, ok so I need animation ID. To get it I should use getAnimationID yup?
so, for instance

function onCommand(cmd, params)
{
if(cmd == "use")
{
local anim = getAnimationID("T_LEGSHAKE");
print(anim);
}
}

why this command shows me, depending on what I do, different values?


...........................................................EDIT ALERT


I dont know if this function works correctly so I made timer

setTimer(function()
{
local aniID = getAnimationID();
print(aniID);

}, 200, true);

and it shows me that the ID is 68
however

function onAnimation()
{
local aniID = getAnimationID();
if (aniID == 68)
{
print("HIT");
}
}
is not working
[Image: ?ip=193.70.2.209&port=27960&obrazek=4f73...e608b8.jpg]
Reply
#7
Squirrel Script
  1. function onAnimation(aniId)
  2. {
  3. local ani = getAnimationName();
  4. if (ani == "SOME_ANI")
  5. {
  6. print("HIT");
  7. }
  8. }


or better
Squirrel Script
  1. function onAnimation(aniId)
  2. {
  3. if (aniId == 68)
  4. {
  5. print("HIT");
  6. }
  7. }



Please use [code].
Reply
#8
solved, thank you.
[Image: ?ip=193.70.2.209&port=27960&obrazek=4f73...e608b8.jpg]
Reply
#9
Bimbol. you are sure that the animation work? I tried to show getPlayerAni (pid) or getPlayerAni (heroId) and it does not work playAni (string) also I have the latest version of the client and the server .... translated by google Smile


ehh ok if he runs again, it means that I have something wrong
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)