L2Tower Discord
Let's keep the community alive with discord.
Discussions about plugins and scripts
L2Tower Discord
Thread Rating:
- 0 Vote(s) - 0 Average
- 1
- 2
- 3
- 4
- 5
Which skill a User is casting ?
|
Author |
Message |
eJelly
Expired VIP Member
 
Posts: 4
Joined: Aug 2014
Reputation: 0
Version:
1.4.2.142
|
Which skill a User is casting ?
Is it possible to find out which skill a User is casting ?
The User data struct, does not seem to have a method which returns now_casting skill, just a bool IsUsingMagic()
What I want to achieve is making a function that waits until a skill is done, and
I thought the following way :
Code:
function CastAndWaitFinish( skill )
UseSkillRaw(skill, false, false);
while( GetMe():XXX() == skill ) do
Sleep(5);
end;
end;
Where XXX() returns the Skill ID a user is casting.
(This post was last modified: 01-15-2015 01:12 AM by eJelly.)
|
|
01-15-2015 01:08 AM |
|
eJelly
Expired VIP Member
 
Posts: 4
Joined: Aug 2014
Reputation: 0
Version:
1.4.2.142
|
RE: Which skill a User is casting ?
(01-15-2015 07:55 AM)TheQQmaster Wrote: in plugins
LUA Programming
function OnMagicSkillLaunched(user, target, skillId)
--Event called when some npc/player/user casted magic skill on someone other.
--For AOE skills this event will be called for every target.
end;
function OnMagicSkillUse(user, target, skillId)
--Event called when some npc/player/user start cast magic skill on someone other.
end;
Thanks but, is there any other way (eg. by iterating through the player list and checking each player)?
This is when a specific packet is received.
(This post was last modified: 01-15-2015 12:54 PM by eJelly.)
|
|
01-15-2015 12:52 PM |
|
Vinter
Expired VIP Member
 
Posts: 299
Joined: Sep 2013
Reputation: 109
Version:
1.4.1.128
|
RE: Which skill a User is casting ?
I see no use for that, really.
But onmagicskilluse is the best way you can do it, you don't need to check each player because onmagicskilluse checks the packet itself, which contains the data.
User, target, skillid, skillvl. You just need to put a filter inside the function to be called only when your requirements are met.
|
|
01-15-2015 16:10 PM |
|
eJelly
Expired VIP Member
 
Posts: 4
Joined: Aug 2014
Reputation: 0
Version:
1.4.2.142
|
RE: Which skill a User is casting ?
(01-15-2015 16:10 PM)Vinter Wrote: I see no use for that, really.
But onmagicskilluse is the best way you can do it, you don't need to check each player because onmagicskilluse checks the packet itself, which contains the data.
User, target, skillid, skillvl. You just need to put a filter inside the function to be called only when your requirements are met.
What I want to achieve is, a function that casts a skill and returns only after the skill has completed casting (or interrupted). Not like UseSkillRaw which casts the skill (in fire-and-forget fashion) and returns immediately. I do not like that I have to do Sleep(1000); for all skills when using UseSkillRaw (what if a skill takes more than that to complete cast, something possible with different kind of buffs). I want something that does that for me automatically.
And to account for both cases (casting completed success or interrupted) I thought the best way to do it is check if GetMe():IsCastingSkill( skill ) and loop around it (and even better, return false in case cast was not completed successfully AKA interrupt)
Maybe someone else has solved that problem and wants to share.
Thanks
(This post was last modified: 01-15-2015 17:00 PM by eJelly.)
|
|
01-15-2015 16:59 PM |
|
User(s) browsing this thread: