Jump to content
  • 0

Custom Passive Skills


Leehalt

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   0
  • Joined:  04/26/12
  • Last Seen:  

First note : http://rathena.org/wiki/Adding_new_skills has data on making Active / Casted skills. After reading through some of the source codes, I found close to nothing about the creation of permanent passive skills.

 

• Second note : Passive weapon damage augment skills like Sword mastery, Two Hand Sword mastery, etc are empty skill ids, the only thing they do is have an ID and have a skill level which is then taken to battle.c to be processed like below

		case W_FIST:
			if((skill = pc_checkskill(sd,TK_RUN)) > 0)
				damage += (skill * 10);
			// No break, fallthrough to Knuckles
		case W_KNUCKLE:
			if((skill = pc_checkskill(sd,MO_IRONHAND)) > 0)
				damage += (skill * 3);
			break;
		case W_MUSICAL:
			if((skill = pc_checkskill(sd,BA_MUSICALLESSON)) > 0)
				damage += (skill * 3);
			break; 

case w_fist means unarmed so its using tk_run "mastery" for damage increase, and if my understanding is correct, it will also increase knuckle damage o.o... but yeah, that's how it gets calculated, no informative data in skill.c at all, just an ID.

 

• The request : So how do we add a passive skill that heals you 100 x skill level per X second? [ a passive form of tension relax that is always on. a skill version of bonus2 bHPRegenRate,n,x; item script ] The actual skill effect looks like this

[PASSIVE] Max level 10
- permanent endure effect
- +100% move speed
- +50% attack speed
- recover 100 x skill level hp per 500 ms
- reflect 3 x skill level of melle damage
- reflect 4 x skill level of range damage
- reduce damage taken by 3 x skill level [class_all]
- heal 50% of your hp if HP falls under 1 x skill level [10% at max leve]
- 2 x skill level chance of getting item id 30050 whenever you kill a monster / player
- 2 x skill level chance of charming enemies when hit [voice of siren effect]

• Adding this data to the wiki would be extremely informative as it does not include information about passive skills.

 

• The skill is meant to be put on a custom class for GM events, most of these effects can be replicated through item scripts but the goal here is to make a passive skill, that way we can just switch to a class and not need to prepare items that have the special effects.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

First note : http://rathena.org/wiki/Adding_new_skills has data on making Active / Casted skills. After reading through some of the source codes, I found close to nothing about the creation of permanent passive skills.

 

• Second note : Passive weapon damage augment skills like Sword mastery, Two Hand Sword mastery, etc are empty skill ids, the only thing they do is have an ID and have a skill level which is then taken to battle.c to be processed like below

		case W_FIST:
			if((skill = pc_checkskill(sd,TK_RUN)) > 0)
				damage += (skill * 10);
			// No break, fallthrough to Knuckles
		case W_KNUCKLE:
			if((skill = pc_checkskill(sd,MO_IRONHAND)) > 0)
				damage += (skill * 3);
			break;
		case W_MUSICAL:
			if((skill = pc_checkskill(sd,BA_MUSICALLESSON)) > 0)
				damage += (skill * 3);
			break; 

case w_fist means unarmed so its using tk_run "mastery" for damage increase, and if my understanding is correct, it will also increase knuckle damage o.o... but yeah, that's how it gets calculated, no informative data in skill.c at all, just an ID.

 

• The request : So how do we add a passive skill that heals you 100 x skill level per X second? [ a passive form of tension relax that is always on. a skill version of bonus2 bHPRegenRate,n,x; item script ] The actual skill effect looks like this

[PASSIVE] Max level 10
- permanent endure effect
- +100% move speed
- +50% attack speed
- recover 100 x skill level hp per 500 ms
- reflect 3 x skill level of melle damage
- reflect 4 x skill level of range damage
- reduce damage taken by 3 x skill level [class_all]
- heal 50% of your hp if HP falls under 1 x skill level [10% at max leve]
- 2 x skill level chance of getting item id 30050 whenever you kill a monster / player
- 2 x skill level chance of charming enemies when hit [voice of siren effect]

• Adding this data to the wiki would be extremely informative as it does not include information about passive skills.

 

• The skill is meant to be put on a custom class for GM events, most of these effects can be replicated through item scripts but the goal here is to make a passive skill, that way we can just switch to a class and not need to prepare items that have the special effects.

 

It is not mentioned in the wiki because it should be quite self-explainatory. It's about the same as adding an active skill, except leaving anything related to actually using the skill out and just check for those conditions in the code where the skill is actually checked and does something. For example when auto-attacking and using sword mastery passive. So you add the skill into the skill.h, skill db and skill tree. Then you go looking for the HP regen function (pc.c or something) and while calculating the HP regen you also check for the passive skill and apply its effect.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   0
  • Joined:  04/26/12
  • Last Seen:  

- Nice idea, not quite as self explanatory as you think it is, i mean, if it was, wed have something more informative, not just data, since the data will always be there, just needs some processing. By the sound of it, you're not even sure if what you suggested works or will work.

 

- Anyways, I'll go ahead and test your theory, thanks for the input! Logically, it should work, but... stuff happens.

 

- Fun tid bit of information I found while investigating and experimenting your theory

/*==========================================
 * Update selling value by skills
 *------------------------------------------*/
int pc_modifysellvalue(struct map_session_data *sd,int orig_value)
{
	int skill,val = orig_value,rate = 0;
	if((skill=pc_checkskill(sd,MC_OVERCHARGE))>0)	//OverCharge
		rate = 5+skill*2-((skill==10)? 1:0);
	if(rate)
		val = (int)((double)orig_value*(double)(100+rate)/100.);
	if(val < 0) val = 0;
	if(orig_value > 0 && val < 1) val = 1;

	return val;
}

- Means some passives really need to BE made and coded. Not just addendum to functions.

 

- Also, according to rule # 3 of this sections forum rules, in order for you to reply.... 

 

 

You may only answer to topics of this area if you provide source code concerning the request or if you post a productive question, for instance asking for more details if they are missing. [Xynvaroth]

 

- In all technicalities, you're telling me that its so self explanatory that it invalidates all logic of me requesting a source code for said passive skill. Was that not the point of requesting here in source requests?

 

- I realize I sound like a huge A-Hole, and I apologize. The point I'm trying to get across is if you don't have a tested way of implementing this, don't post. Test it, post an example source code and we can experiment from there. Thanks again for the input. It sort of helped, but no progress from there on end.

Edited by Leehalt
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

You did not state that I was wrong in any case, you just confirmed my given input.

I will provide the src edit for your skill, you still need to do the DB work, but this should be as stated in the Wiki.

Also this patch is really dirty and hardcoded, but it's because this passive skill is actually so strong and I was too lazy adding an extra SC for it, etc.

 

Edit: Using the new Pastebin: Paste: 9yf2sxdzew

Edited by Jonne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   0
  • Joined:  04/26/12
  • Last Seen:  

- Yeah, I didn't state that you were wrong, since I was yet to test it. It was highly constructive but without the requisite of the source code.

 

- The reason why the passive was so strong is because I had to include multiple instances of skill types that were to be made passive. It would then be easier to understand and reproduce using the code from this skill as a reference. Thanks for your efforts in making the passive though. It's a really good reference.

 

- Note: I've tested ASPD, reflect, and damage reduction yesterday, thanks for the hp/sp regen, walkspeed, voice of siren addition. I will test those today.

 

- Thanks again for the reference, they're wonderful.

 

 

[Edit]

 

- Siren doesn't work, it procs when I attack them and nothing happens, is this what you meant by creating the SC? Doesn't VOS already have it's own? Ill try and fix this tomorrow after I get off work.

 

- Things to test / make: Endure effect, HP recovery/s [non percentile], auto 50% heal when under 10% hp, monster drop custom item id

Edited by Leehalt
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

 

- Siren doesn't work, it procs when I attack them and nothing happens, is this what you meant by creating the SC? Doesn't VOS already have it's own? Ill try and fix this tomorrow after I get off work.

 

- Things to test / make: Endure effect, HP recovery/s [non percentile], auto 50% heal when under 10% hp, monster drop custom item id

No, because I use the SC of Siren:

if (skill = pc_checkskill(sd, NPC_GMPOWER)) {
+            int tick;
+            rate = skill*2 * 100;
+            tick = skill_get_time2(status_sc2skill(SC_VOICEOFSIREN), skill);
+            status_change_start(src, bl, SC_VOICEOFSIREN, rate, skill, 0, 0, 0, tick, 0);
+        }

 

Auto Attacks cancel the SC, maybe that's the case?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   0
  • Joined:  04/26/12
  • Last Seen:  

if (skill = pc_checkskill(sd, NPC_GMPOWER)) {
+            int tick;
+            rate = skill*2 * 100;
+            tick = skill_get_time2(status_sc2skill(SC_VOICEOFSIREN), skill);
+            status_change_start(src, bl, SC_VOICEOFSIREN, rate, skill, 0, 0, 0, tick, 0);
+        }

Auto Attacks cancel the SC, maybe that's the case?

 

 

- By the looks of it, since it was added as int skill_additional_effect I'm guessing that it would naturally proc on both but as observed, would only last skill*2*100, which only lasted something like 0.2 seconds in the client, it was gone as soon as it casted, at lvl 10 to boot. For some weird reason, x*skill only does x*1? Did we miss calling some stuff?

 

- I just noticed, since youre calling get_time2 for SC_VOICEOFSIREN, maybe that's the skill level its checking for?

Edited by Leehalt
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

 

if (skill = pc_checkskill(sd, NPC_GMPOWER)) {
+            int tick;
+            rate = skill*2 * 100;
+            tick = skill_get_time2(status_sc2skill(SC_VOICEOFSIREN), skill);
+            status_change_start(src, bl, SC_VOICEOFSIREN, rate, skill, 0, 0, 0, tick, 0);
+        }

Auto Attacks cancel the SC, maybe that's the case?

 

 

- By the looks of it, since it was added as int skill_additional_effect I'm guessing that it would naturally proc on both but as observed, would only last skill*2*100, which only lasted something like 0.2 seconds in the client, it was gone as soon as it casted, at lvl 10 to boot. For some weird reason, x*skill only does x*1? Did we miss calling some stuff?

 

- I just noticed, since youre calling get_time2 for SC_VOICEOFSIREN, maybe that's the skill level its checking for?

 

 

1. It procs for AA after the AA, just like SK card and so on.

2. The time is exactly the time of the skill Voice of Siren. I use skill_get_time2 with the skill level of the GM skill.

If it does occur, either increase the "skill(level)" in skill_get_time2 or increase "tick" before giving it as parameter in the status_change_start call (better option). A second is 100.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   0
  • Joined:  04/26/12
  • Last Seen:  

- Got to test this yesterday, our intended effect was for it to proc when we get hit not when we attack, any idea on how to restrict that?

 

- Also, I just gave tick a 10 second duration, but it still doesn't kick in, I've no idea why.

 

- Is this by any chance, the endure effect? I've yet to test this

 

@@ -6176,6 +6185,8 @@ static unsigned short status_calc_dmotion(struct block_list *bl, struct status_c
        return 0;
    if( sc->data[sC_RUN] || sc->data[sC_WUGDASH] )
        return 0;

    if ((pc_checkskill((TBL_PC*)bl, NPC_GMPOWER)) > 0)
        return 0;
Edited by Leehalt
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

 

- Got to test this yesterday, our intended effect was for it to proc when we get hit not when we attack, any idea on how to restrict that?

 

- Also, I just gave tick a 10 second duration, but it still doesn't kick in, I've no idea why.

 

- Is this by any chance, the endure effect? I've yet to test this

 

@@ -6176,6 +6185,8 @@ static unsigned short status_calc_dmotion(struct block_list *bl, struct status_c

        return 0;

    if( sc->data[sC_RUN] || sc->data[sC_WUGDASH] )

        return 0;

    if ((pc_checkskill((TBL_PC*)bl, NPC_GMPOWER)) > 0)

        return 0;

 

-Ah i thought when you hit something. I can change that, but not today, because I'm busy with university assigments.

-Yes, that's the endure effect

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   0
  • Joined:  04/26/12
  • Last Seen:  

- Endure effect tested, doesn't work.

 

- Further testing done on siren effect. Skill casts but no effect gets tagged upon the mob/player getting hit / tagged by said effect.

 

- Going to test auto heal when under 10% hp next.

 

- Also, is there any way to directly add the item to player inventory? Like MVP reward item thing... for this code:

+			if (skill = pc_checkskill(sd, NPC_GMPOWER))
+				if (rnd()%10000 < 200 * skill)
+					mob_item_drop(md, dlist, mob_setdropitem(30050, 1), 0, 200 * skill, homkillonly);
Edited by Leehalt
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
Answer this question...

×   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...