Mary Magdalene 0 Posted September 9, 2015 Hello, i would like to ask if there's a function where your damage / skill damage will be depending on your distance with the target? Thank you! Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted September 9, 2015 This function is for Skills? Quote Share this post Link to post Share on other sites
0 Mary Magdalene 0 Posted September 9, 2015 (edited) Well I'm actually trying to make a passive skill wherein your damage increases as you go near your target, so I'm asking if there's already an existing function of it so i could have some reference to use. EDIT: If there's none then I'll try making my own. Edited September 9, 2015 by Mary Magdalene Quote Share this post Link to post Share on other sites
0 fxfreitas 102 Posted September 9, 2015 Well, the skill RL_SLUGSHOT the accuracy depends of distance, try to make something like it. Quote Share this post Link to post Share on other sites
0 Mary Magdalene 0 Posted September 10, 2015 Well, the skill RL_SLUGSHOT the accuracy depends of distance, try to make something like it. Hey thank you very much for the reply, i'll see that! Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted September 10, 2015 The skill Charge Attack of Knight increment the damage by distance, try check in Battle.c this: case KN_CHARGEATK: { int k = (flag-1)/3; //+100% every 3 cells of distance if( k > 2 ) k = 2; // ...but hard-limited to 300%. skillratio += 100 * k; } break; Quote Share this post Link to post Share on other sites
0 Mary Magdalene 0 Posted September 13, 2015 The skill Charge Attack of Knight increment the damage by distance, try check in Battle.c this: case KN_CHARGEATK: { int k = (flag-1)/3; //+100% every 3 cells of distance if( k > 2 ) k = 2; // ...but hard-limited to 300%. skillratio += 100 * k; } break; Thanks for the reply, but i don't understand this formula: int k = (flag-1)/3; Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted September 15, 2015 (edited) Thanks for the reply, but i don't understand this formula: int k = (flag-1)/3; I don't understand much this, I assimilate that this refers to the damage of KN_CHARGEATK: int k = (flag-1)/3; //+100% every 3 cells of distance if( k > 2 ) k = 2; // ...but hard-limited to 300%. skillratio += 100 * k; k = 1 every 3 cells, if k > 2, k always be = 2. Finally, skillratio (damage) is 100% * k. Eg: if Charge Attack is on 6 cells of distance "k = 2", so skillratio is 200%. Try apply this on your passive skills ~ Edited September 15, 2015 by Easycore Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 15, 2015 (edited) It's pretty simple if you look at it this way: Let's take this situation per example: x0000t00 Where x is player and t is target. Usually distance between two entities is calculated from one of them, in this case player stands on cell 0, target stands on cell 5. So distance will return 5. But we need to know amount of cells between for skill, in this case it'll be (5-1), or 4. Next, we get extra 100% damage per every 3 cells between, so we need to find out how many times 3 is included in the number we have above. Here "/" stands for integer division, pretty much "how many times something fits into our number fully". In this case we'll have (4/3) = 1. So there you have it, result of this operations in our case is 1. If there were 7 cells between players, result would be 2 and damage would increase by another 100%. Where did I get that flag is distance? By reviewing where the call came from. In this case it comes from skill.c: unsigned int dist = distance_bl(src, bl);skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, dist);/* int skill_attack(int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) */battle->calc_attack(attack_type,src,bl,skill_id,skill_lv,flag&0xFFF);/* struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int count) */battle->calc_weapon_attack(bl,target,skill_id,skill_lv,count)/* struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag) */battle->calc_skillratio(BF_WEAPON, src, target, skill_id, skill_lv, skillratio, wflag)/* int battle_calc_skillratio(int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int skillratio, int flag) */ Edited September 15, 2015 by Garr Quote Share this post Link to post Share on other sites
0 Mary Magdalene 0 Posted September 15, 2015 Thanks for the replies but i made it much more simple tho the only problem is i dunno how to make it as a passive skill. So what i did is: battle.c if (sc){ if(sc->data[SC_CUSTOMSKILL] ) { int range = distance_bl(src, target); int skilllv = sc->data[SC_CUSTOMSKILL]->val1; if(range == 1){ ATK_ADDRATE(skilllv * 10); } } } So it clearly states when you're 1 cell apart from your enemy, you'll get additional bonus of custom skill level * 10 damage. Quote Share this post Link to post Share on other sites
0 Easycore 31 Posted September 15, 2015 Why not makes this skill similar of Blitz Beat? (Autocast) In skill.c switch(skill_id) { case 0: { // Normal attacks (no skill used) if( attack_type&BF_SKILL ) break; // If a normal attack is a skill, it's splash damage. [Inkfish] if(sd) { // Automatic trigger of Blitz Beat if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=pc->checkskill(sd,HT_BLITZBEAT))>0 && rnd()%1000 <= sstatus->luk*3 ) { rate = sd->status.job_level / 10 + 1; skill->castend_damage_id(src,bl,HT_BLITZBEAT,(temp<rate)?temp:rate,tick,SD_LEVEL); } Add: if((temp=pc->checkskill(sd,CS_CUSTOMSKILL))>0 && rnd()%1000 <= sstatus->luk*3 ) {skill->castend_damage_id(src,bl,CS_CUSTOMSKILL,temp,tick,0);} rnd()%1000 <= sstatus->luk*3: This is the chance of autocast, there chance aument of luk*3. Change this as you wish. Quote Share this post Link to post Share on other sites
0 Mary Magdalene 0 Posted September 15, 2015 (edited) Why not makes this skill similar of Blitz Beat? (Autocast) In skill.c switch(skill_id) { case 0: { // Normal attacks (no skill used) if( attack_type&BF_SKILL ) break; // If a normal attack is a skill, it's splash damage. [Inkfish] if(sd) { // Automatic trigger of Blitz Beat if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=pc->checkskill(sd,HT_BLITZBEAT))>0 && rnd()%1000 <= sstatus->luk*3 ) { rate = sd->status.job_level / 10 + 1; skill->castend_damage_id(src,bl,HT_BLITZBEAT,(temp<rate)?temp:rate,tick,SD_LEVEL); } Add: if((temp=pc->checkskill(sd,CS_CUSTOMSKILL))>0 && rnd()%1000 <= sstatus->luk*3 ) {skill->castend_damage_id(src,bl,CS_CUSTOMSKILL,temp,tick,0);} rnd()%1000 <= sstatus->luk*3: This is the chance of autocast, there chance aument of luk*3. Change this as you wish. This is a good idea, with just small modifications like making it 100% chance. I'll be trying this one, Thank you! EDIT: Ah nah, i don't think that's gonna work well since it won't auto-cast if I'm gonna use a skill. And by the way it's some sort of a buff skill not an attack skill XD Edited September 15, 2015 by Mary Magdalene Quote Share this post Link to post Share on other sites
Hello, i would like to ask if there's a function where your damage / skill damage will be depending on your distance with the target?
Thank you!
Share this post
Link to post
Share on other sites