Jump to content
  • 0
Alayne

Add skills through scripts

Question

Hi guys,

 

here's a simple question, but I can't find the correct answer.

I know you can add skills to a player throught the "skill" command.

Here's my script line:

 

skill .@skillIds[.@i], 1, 4;

 

SkillIds containing a list of skills id (no way!!!), copied from another array:

 

setarray $faction1_1SkillsIds[0], 98, 99, ...

 

I've already checked that the skillIds are well filled.

But I don't know why, no matter the flag I give to the command, the given skills won't appear in my skll window...

 

Any idea why it would happens?

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

OnPCStatCalcEvent Rocks !!!

 

simply patch it

 

and I have tested with this script

prontera,155,185,5	script	kjdshfkdjsf	1_F_MARIA,{//	addjobskill = 0;	mes "select the type of skills you want to learn";	next;	addjobskill = select( "swordsman", "mage", "acolyte" );	mes "your skills will be added the next time you adjust your equipment !";	close;OnPCStatCalcEvent:	switch ( addjobskill ) {	case 1:		skill "SM_BASH", 10;		skill "SM_PROVOKE", 10;		skill "SM_MAGNUM", 10;		break;	case 2:		skill "MG_FIREBOLT", 10;		skill "MG_LIGHTNINGBOLT", 10;		skill "MG_COLDBOLT", 10;		break;	case 3:		skill "AL_HEAL", 10;		skill "AL_INCAGI", 10;		skill "AL_BLESSING", 10;		break;	default:	}	end;}
add skills permanently to the player

oh if you want them temporary until player logout, then just use the temporary player variable

 

remember that the type has to be 1, (well it was default to 1 when no flag given)

because this OnPCStatCalcEvent runs as if the player has equipped the item

.


.

seriously, I start to get sick of having to update this patch every ......

meh ... I just repeated what I have said long time ago

https://rathena.org/board/topic/77230-onpcstatcalcevent/

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

try this

-	script	give skill	-1,{	setarray .@skill_ids, 98, 99;	setarray .@skill_lvl,  1,  1;	for (.@i = 0; .@i < getarraysize(.@skill_ids); .@i++) {		skill .@skill_ids[.@i], .@skill_lvl[.@i], 0;	}	end;}

and you need to read the complete documentation of *skill or *addtoskill to get what you want, 98 is BS_DAGGER if the player is Black Smith and have maxed this skill level and you give him BS_DAGGER skill level lower than skill max level it would never appear, not tested yet though just a theory of mine

*skill <skill id>,<level>{,<flag>};*skill "<skill name>",<level>{,<flag>};*addtoskill <skill id>,<level>{,<flag>};*addtoskill "<skill name>",<level>{,<flag>};These commands will give the invoking character a specified skill. This is also used for item scripts.Level is obvious. Skill id is the ID number of the skill in question as per 'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give a character a monster's skill, but you're welcome to try with the numbers given in 'db/(pre-)re/mob_skill_db.txt'.Flag is 0 if the skill is given permanently (will get written with the character data) or 1 if it is temporary (will be lost eventually, this is meant for card item scripts usage.).  The flag parameter is optional, and defaults to 1 in 'skill' and to 2 in 'addtoskill'.Flag 2 means that the level parameter is to be interpreted as a stackable additional bonus to the skill level. If the character did not have that skill previously, they will now at 0+the level given.// This will permanently give the character Stone Throw // (TF_THROWSTONE,152), at level 1.    skill 152,1,0;Flag 3 is the same as flag 0 in that it saves to the database. However, these skills are ignored when any action is taken that adjusts the skill tree (reset/job change).
Edited by Litro

Share this post


Link to post
Share on other sites
  • 0

Actually, I'm trying to add those skills to a custom class I've made, so that's not a question of already knowing the skills.

I've already tried the "0" flag, but I'll give it another chance.

Share this post


Link to post
Share on other sites
  • 0

to make the skill permanently given to your custom class you've made

you also need to add entry to your dbskill_tree.conf

 

and maybe the client file ... dunno which path, what lua stuff <-- client noob

Share this post


Link to post
Share on other sites
  • 0

Well actually I don't want all of them to get it.

There's a...let's called that "group selection" made, and according to the group they choose, they obtain a new bunch of skills.

That's why I need to add them this way, and not directly in db and client (as I've made for the other skills, that any player of this new class will have).

Share this post


Link to post
Share on other sites
  • 0

In fact, look great for me.

Thanks, I'll try that, and get back to say if it worked.



Good point for you AnnieRuru.

I'll keep this source mod, that's an easy way to add some interesting feature.

 

Thanks!

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

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