L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Which skill a User is casting ?
Author Message
eJelly Offline
Expired VIP Member
**

Posts: 4
Joined: Aug 2014
Reputation: 0
Version: 1.4.2.142
Post: #1
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
Find all posts by this user Quote this message in a reply
TheQQmaster Offline
Trolling the Trolls
*****

Posts: 1,532
Joined: Jun 2012
Reputation: 640
Version: 1.4.2.133
Post: #2
RE: Which skill a User is casting ?

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;


PUSH [Image: knUu53] IF HELPED
01-15-2015 07:55 AM
Visit this user's website Find all posts by this user Quote this message in a reply
eJelly Offline
Expired VIP Member
**

Posts: 4
Joined: Aug 2014
Reputation: 0
Version: 1.4.2.142
Post: #3
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
Find all posts by this user Quote this message in a reply
Vinter Offline
Expired VIP Member
**

Posts: 299
Joined: Sep 2013
Reputation: 109
Version: 1.4.1.128
Post: #4
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
Find all posts by this user Quote this message in a reply
eJelly Offline
Expired VIP Member
**

Posts: 4
Joined: Aug 2014
Reputation: 0
Version: 1.4.2.142
Post: #5
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
Find all posts by this user Quote this message in a reply
Vinter Offline
Expired VIP Member
**

Posts: 299
Joined: Sep 2013
Reputation: 109
Version: 1.4.1.128
Post: #6
RE: Which skill a User is casting ?

OnMagicSkillLaunched calls when you finish casting a skill, unlike OnMagicSkillUse that calls when you start casting a skill.

You could always create a coroutine inside the plugin and use useskill instead of useskillraw.
01-15-2015 21:21 PM
Find all posts by this user Quote this message in a reply
 Reputed by : geb222(+2)
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Question Skill ID, How to get it cyberu2 6 6,159 05-15-2015 05:05 AM
Last Post: cyberu2
  Othel Rogue Skill Help sfbengtson 1 2,042 07-07-2014 16:07 PM
Last Post: Fox
  Skill id AStark 4 3,260 05-16-2014 16:31 PM
Last Post: kerberos464
  Feoh - Shadow Snare Skill Snapper 3 4,387 04-18-2014 08:31 AM
Last Post: Hevenspo
  Any have id skill augment for god? lilou100 0 2,535 08-31-2013 19:30 PM
Last Post: lilou100



User(s) browsing this thread: 1 Guest(s)