Jump to content
Ninja

(script commands) OnPCSkillUseEvent + getskillname

Recommended Posts

Hi rAthena,

 

I've seen a lot of (old) posts that wanted to have skill detection through scripts. I'm releasing these stuff for scripters to munch on :)

Hope it helps expand the scripting scene and hope you guys release your work here in rAthena too.

 

Credits to Playtester for helping me find the entry point of skill usage.

 

working on Rev: 100644

OnPCSkillUseEventOnPCSkillUseEvent.diff

Detects when a player uses a skill returns:

@skillused_id - the id of the skill used

@skillused_lv - the level of the skill used

 

getskillnamegetskillname.diff

Gets the skill name of a skill_id

 

Sample Script

-	script	Test	-1,{

OnPCUseSkillEvent:
announce "You have used level"[email protected]_lv+" "+getskillname(@skillused_id),bc_self;
end;

}

I intentionally separated these so that getskillname can be used independently since I haven't really seen any script command that shows the "english" name of a skill.

post-7005-0-72174900-1458554963_thumb.jpg

post-7005-0-02321500-1458554969_thumb.jpg

post-7005-0-16235000-1458554977_thumb.jpg

post-7005-0-71713300-1458555001_thumb.jpg

post-7005-0-71997400-1458555015_thumb.jpg

Edited by Ninja
  • Upvote 3
Link to comment
Share on other sites

Wow, very nice!! Thank you a lot , Ninja!

 

That's a great work indeed!!

 

You're welcome ;)

Link to comment
Share on other sites

Thank you :)

nice release

 

But show error in the last rev of rA about a "npc use item"

Edited by Namine210
Link to comment
Share on other sites

this one 

pc.c: In function ‘pc_useitem’:
pc.c:4920:23: error: ‘NPCE_ITEMUSE’ undeclared (first use in this function)
  npc_script_event(sd, NPCE_ITEMUSE);
                       ^
pc.c:4920:23: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [obj/pc.o] Error 1
 
 
can you share also OnPCUseItemEvent?
Edited by jawbreaker
Link to comment
Share on other sites

 

this one 

pc.c: In function ‘pc_useitem’:
pc.c:4920:23: error: ‘NPCE_ITEMUSE’ undeclared (first use in this function)
  npc_script_event(sd, NPCE_ITEMUSE);
                       ^
pc.c:4920:23: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [obj/pc.o] Error 1
 
 
can you share also OnPCUseItemEvent?

 

 

NPCE_ITEMUSE - > NPCE_SKILLUSE change

Link to comment
Share on other sites

I can't seems to get this work XD

i have the same error jawbreaker mention

and change NPCE_ITEMUSE -> NPCE_SKILLUSE

and came out with no error

but still it doesnt work for me 😕

 

On 3/21/2016 at 6:02 PM, Ninja said:

Hi rAthena,

 

I've seen a lot of (old) posts that wanted to have skill detection through scripts. I'm releasing these stuff for scripters to munch on :)

Hope it helps expand the scripting scene and hope you guys release your work here in rAthena too.

 

Credits to Playtester for helping me find the entry point of skill usage.

 

working on Rev: 100644

OnPCSkillUseEventOnPCSkillUseEvent.diff

  Reveal hidden contents

 

Detects when a player uses a skill returns:

@skillused_id - the id of the skill used

@skillused_lv - the level of the skill used

 

 

getskillnamegetskillname.diff

 

  Reveal hidden contents

 

Gets the skill name of a skill_id

 

 

 

Sample Script

  Reveal hidden contents

 


-	script	Test	-1,{

OnPCUseSkillEvent:
announce "You have used level"+@skillused_lv+" "+getskillname(@skillused_id),bc_self;
end;

}

I intentionally separated these so that getskillname can be used independently since I haven't really seen any script command that shows the "english" name of a skill.

post-7005-0-72174900-1458554963_thumb.jpg

post-7005-0-02321500-1458554969_thumb.jpg

post-7005-0-16235000-1458554977_thumb.jpg

post-7005-0-71713300-1458555001_thumb.jpg

post-7005-0-71997400-1458555015_thumb.jpg

Quoting, waiting for your response :)

Link to comment
Share on other sites

@eezclide Hey man, I just got back from my hiatus. I'm still catching up with a lot of stuff here in rA. I'll try to get back to you as soon as I get my environment up and running again. Cheers.

Link to comment
Share on other sites

script.cpp: In function 'int buildin_getskillname(script_state*)':
script.cpp:24755:29: error: no match for 'operator[]' (operand types are 'SkillDatabase' and 'uint16 {aka short unsigned int}')
  memcpy(skill_name, skill_db[skill_get_index(skill_id)]->desc, SKILL_DESC_LENGTH);

Link to comment
Share on other sites

@Ninja hehehe its been a while and I'm about to practice more here in rathena again XD.

I remember why I need your diff here.

coz with this I can call out the wav files while using skills custom and easier for newbies.

like when using LORD of VERMILLION - the character is shouting the skills.

I just got back on developing again all my old files are gone now starting new hehehe

 

by the way I have this error here. using the latest revision.

 

/**
* Jezznar
* getskillname (skillid);
**/
BUILDIN_FUNC(getskillname)
 {
    int skill_id;
    char *skill_name;
        //get input skill_id
        if (!script_hasdata(st, 2)) {
        script_pushconststr(st, "null");
        return SCRIPT_CMD_SUCCESS;
        
    }
        skill_id = script_getnum(st, 2);
    
        if (!skill_get_index(skill_id)) {
        ShowError("script:conv_str: Unknown skill_id supplied.\"\n");
        script_pushconststr(st, "null");
        return SCRIPT_CMD_SUCCESS;
        
    }
    skill_name = (char *)aMalloc(SKILL_NAME_LENGTH * sizeof(char));
    memcpy(skill_name, skill_db[skill_get_index(skill_id)]->desc, SKILL_DESC_LENGTH);
    script_pushstr(st, skill_name);
    
        return SCRIPT_CMD_SUCCESS;
    }image.png.ed16f7a9141741446b6ff7ef3683beee.png

 

Anyways thanks for this. I cant make the skill name appear but, The skillused_id is what I need for skills shout. thank you

Edited by eezclide
added question and realize alternative
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.