Ninja Posted March 21, 2016 Posted March 21, 2016 (edited) 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"+@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. Edited March 21, 2016 by Ninja 3 Quote
Ninja Posted March 21, 2016 Author Posted March 21, 2016 Thank you You're welcome. feel free to use and extend it. Quote
Fratini Posted March 27, 2016 Posted March 27, 2016 Wow, very nice!! Thank you a lot , Ninja! That's a great work indeed!! Quote
Ninja Posted March 28, 2016 Author Posted March 28, 2016 Wow, very nice!! Thank you a lot , Ninja! That's a great work indeed!! You're welcome Quote
Helly Posted April 22, 2016 Posted April 22, 2016 (edited) Thank you nice release But show error in the last rev of rA about a "npc use item" Edited April 22, 2016 by Namine210 Quote
Ninja Posted April 25, 2016 Author Posted April 25, 2016 @Namine210 can you post the error here? Thanks Quote
jawbreaker Posted June 9, 2016 Posted June 9, 2016 (edited) 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 June 9, 2016 by jawbreaker Quote
acdse Posted June 17, 2016 Posted June 17, 2016 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 Quote
eezclide Posted April 15, 2017 Posted April 15, 2017 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. Quoting, waiting for your response Quote
Ninja Posted May 10, 2017 Author Posted May 10, 2017 @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. Quote
AdrianoGC Posted February 12, 2020 Posted February 12, 2020 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); Quote
eezclide Posted February 29, 2020 Posted February 29, 2020 (edited) @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; } 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 March 1, 2020 by eezclide added question and realize alternative Quote
Forshaken Posted January 23, 2023 Posted January 23, 2023 (edited) Tried to update this mod to latest rev. You can also try use easycore's (getskillname(<skill id>)/getskillname("<skill name>")) src mod.OnPCSkillUseEvent.diff Edited January 23, 2023 by Forshaken 1 1 Quote
casper Posted March 13, 2023 Posted March 13, 2023 (edited) On 1/23/2023 at 9:45 PM, Forshaken said: Tried to update this mod to latest rev. You can also try use easycore's (getskillname(<skill id>)/getskillname("<skill name>")) src mod.OnPCSkillUseEvent.diff - script Test -1,{ OnPCUseSkillEvent: announce "You have used level"+ ?????????????? end; } getskillname.diff Tried to update this mod to latest rev. plz Edited March 13, 2023 by casper Quote
Forshaken Posted March 16, 2023 Posted March 16, 2023 On 3/13/2023 at 7:33 PM, casper said: - script Test -1,{ OnPCUseSkillEvent: announce "You have used level"+ ?????????????? end; } getskillname.diff Tried to update this mod to latest rev. plz Post your error if you have any Quote
Theesco Posted March 22, 2023 Posted March 22, 2023 - script Skills_KG -1,{ OnPCUseSkillEvent: // ====================== Susanoo ====================== if(lskillid == 157) { if(getequipcardid(EQI_HEAD_MID,0) == 30094 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1482; } if(getequipcardid(EQI_HEAD_MID,0) == 30098 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1482; } if(getequipcardid(EQI_HEAD_MID,0) == 30095 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1483; } if(getequipcardid(EQI_HEAD_MID,0) == 30099 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1483; } if(getequipcardid(EQI_HEAD_MID,0) == 30096 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } if(getequipcardid(EQI_HEAD_MID,0) == 30100 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } if(getequipcardid(EQI_HEAD_MID,0) == 30135 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } if(getequipcardid(EQI_HEAD_MID,0) == 30136 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } AddTimer 30000, "FOME_SHARSKILL2::OnHPSHARSKILL22"; end; } A script corresponde?? Quote
Forshaken Posted March 23, 2023 Posted March 23, 2023 (edited) 19 hours ago, Theesco said: - script Skills_KG -1,{ OnPCUseSkillEvent: // ====================== Susanoo ====================== if(lskillid == 157) { if(getequipcardid(EQI_HEAD_MID,0) == 30094 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1482; } if(getequipcardid(EQI_HEAD_MID,0) == 30098 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1482; } if(getequipcardid(EQI_HEAD_MID,0) == 30095 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1483; } if(getequipcardid(EQI_HEAD_MID,0) == 30099 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1483; } if(getequipcardid(EQI_HEAD_MID,0) == 30096 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } if(getequipcardid(EQI_HEAD_MID,0) == 30100 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } if(getequipcardid(EQI_HEAD_MID,0) == 30135 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } if(getequipcardid(EQI_HEAD_MID,0) == 30136 ) { set @visu,getlook(LOOK_HEAD_MID); setlook LOOK_HEAD_MID,1484; } AddTimer 30000, "FOME_SHARSKILL2::OnHPSHARSKILL22"; end; } A script corresponde?? Use this mod of easycore to get the skill name of a skill. Edited March 23, 2023 by Forshaken Quote
Theesco Posted March 23, 2023 Posted March 23, 2023 4 horas atrás, Forshaken disse: Use este modo de easycore para obter o nome de uma habilidade. Irei adicionar minha duvida em imagens, para ter uma resolução mais efetiva. Quote
doogoo Posted September 13, 2024 Posted September 13, 2024 Hi everyone, I have a question about this custom event OnPcUseSkillEvent, it works well except for one detail: It triggers even if the skill fails (out of ammo, not enough SP, etc.). Does anyone know how to make it only trigger if the skill was successful? Thanks! Doo Quote
RumbleRO Posted December 8, 2024 Posted December 8, 2024 (edited) On 3/23/2023 at 2:22 PM, Forshaken said: Use this mod of easycore to get the skill name of a skill. script.cpp:4901:31: error: ‘buildin_getskillname’ was not declared in this scope; did you mean ‘buildin_getguildname’? 4901 | #define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args, nullptr } | ^~~~~~~~ ../custom/script_def.inc:13:1: note: in expansion of macro ‘BUILDIN_DEF’ 13 | BUILDIN_DEF(getskillname,"v"), | ^~~~~~~~~~~ Have this error on this diff. Edited December 8, 2024 by RumbleRO Code boxed. Quote
TBlazeWarriorT Posted April 3 Posted April 3 (edited) On 9/13/2024 at 10:29 AM, doogoo said: Hi everyone, I have a question about this custom event OnPcUseSkillEvent, it works well except for one detail: It triggers even if the skill fails (out of ammo, not enough SP, etc.). Does anyone know how to make it only trigger if the skill was successful? Thanks! Doo Here's my suggested code for clif_parse_UseSkillToPosSub. // SKILLUSE MODIFIED CODE int32 skill_success; int32 skill_src_type = 1; if( sd.skillitem == skill_id ) { if( skill_lv != sd.skillitemlv ) skill_lv = sd.skillitemlv; skill_success = unit_skilluse_pos(&sd.bl, x, y, skill_id, skill_lv); skill_src_type = 2; } else { int32 lv; sd.skillitem = sd.skillitemlv = 0; if( (lv = pc_checkskill(&sd, skill_id)) > 0 ) { if( skill_lv > lv ) skill_lv = lv; skill_success = unit_skilluse_pos(&sd.bl, x, y, skill_id,skill_lv); } } if (skill_success == 1) { pc_setreg(&sd, add_str("@skillused_id"), skill_id); pc_setreg(&sd, add_str("@skillused_lv"), skill_lv); pc_setreg(&sd, add_str("@skillused_src"), skill_src_type); npc_script_event(sd, NPCE_SKILLUSE); } // I'll likely be using this or something similar for myself. I even added @skillused_src to know if it was used through an item, since I needed that for my use case. If you don't need it, you can save a few lines. Note that the single target skill code needs to be changed similarly, it uses a more annoying format but the logic is the same. Also to be noted that the single-target code was moved to clif_parse_skill_toid, it seems. Example with this: announce "You have used level "+@skillused_lv+" skill "+@skillused_id+" via "+@skillused_src,bc_self; Edited April 3 by TBlazeWarriorT clarity Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.