Jump to content
  • 0
Sign in to follow this  
Aeromesi

Can someone help me with a check on a job?

Question

In Regards to the Sub Class System script I released on Hercules (Special thanks: GM Ocean) So since releasing the script, I came across a lot of problems. So anyone using the Sub Class System please wait for 1.2! But basically I'm having problems with a check to see if they are any kind of mage type class, everything works but I've ran into a problem where I want it to check if they are a High Wizard or not or so and so with other classes so they don't get the sub skills added to their same class.

The piece of code looks like this:
 

.skill_set$[2] = ""+(eaclass(EAJ_MAGE?"":"SP Rec"))+":Sight:Napalm Beat:Saftey Wall:Soul Strike:Cold Bolt:"				 "Frost Driver:Stone Curse:FireBall:FireWall:Fire Bolt:"				 "Lightning Bolt:ThunderStorm";


So it checks the eaclass bitmask EAJ_MAGE which contains ALL of the mage type classes, basically I'm trying to make it NOT show "SP Rec" which is SP recovery if they are any mage type class, otherwise it would show SP Recovery to lets say, a Assassin Cross. It shows nulled as a 0, so what am I doing wrong here?

Edited by Aeromesi

Share this post


Link to post
Share on other sites

13 answers to this question

Recommended Posts

  • 0

Well you forgot a closing ) for the eaclass command. If you provide a parameter for eaclass it doesn't use the users current players class to return the job number for the check.

It makes no sense to use the job number bitmask as parameter as it uses the class as parameter to give you the job number.

The command just returns the job number to check if the players has a certain base job you need to check it against the according bitmasks.

Also you have the "" in front of your function and : afterwards, so you add a empty menu option, which is uneccessary.

.skill_set$[2] = ( ( ( eaclass() & EAJ_BASEMASK ) == EAJ_MAGE ) ? "" : "SP Rec:" ) + "Sight:Napalm Beat:Saftey Wall:Soul Strike:Cold Bolt:Frost Driver:Stone Curse:FireBall:FireWall:Fire Bolt:Lightning Bolt:ThunderStorm";

The documentation for that command seems to be incorrect though:

 

*eaclass ({<job number>})

This commands returns the "eA job-number" corresponding to the given
class, and uses the invoking player's class if none is given. The eA
job-number is also a class number system, but it's one that comes with
constants which make it easy to convert among classes. The command will
return -1 if you pass it a job number which doesn't have an eA job-number
equivalent.

I guess it should be:

 

 
*eaclass ({<class>})

This commands returns the "eA job-number" corresponding to the given
class, and uses the invoking player's class if none is given. The eA
job-number is also a class-number system, but it's one that comes with
constants which make it easy to convert among classes. The command will
return -1 if you pass it a class which doesn't have an eA job-number equivalent.

Otherwise it would make no sense since why should i give a function that gives me a job number, a job number just to give me that job number?

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

Actually class and job number are one and the same. This one returns job number in "ea format", you can read more about that all in doc/ea_job_system.txt

Share this post


Link to post
Share on other sites
  • 0

@@Garr That is confusing since if the number you get from eaclass is the same as class shouldn't the binary representation of both be the same and therefore the bitmask would work on both and therefore we wouldn't even need a eaclass function?

Share this post


Link to post
Share on other sites
  • 0

I didn't say that number you get from eaclass and class are same. I said job number/job id/class are one and the same. It's pretty much what you know as Job_* constants. 0 for Novice, 1 for  Swordsman and so on.

 

On par with that exists eaclass system, which you can read about in the document I told about above.

 

Those are 2 different systems.

 

My comment above was aimed towards you changing "job number" into "class" :P

Share this post


Link to post
Share on other sites
  • 0

@@Garr

Well i found the explenation a bit confusing since once its called class:

 

This commands returns the "eA job-number" corresponding to the given class,

But later its called job number:

 

 The command will return -1 if you pass it a job number which doesn't have an eA job-number equivalent.

Share this post


Link to post
Share on other sites
  • 0

if you want any mage type class to be effected ,you can use BaseClass

 

+(eaclass(EAJ_MAGE?"":"SP Rec"))+

  change into

+(BaseClass == EAJ_MAGE  ?"":"SP Rec"))+

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

@@Angelmelody, an error about invalid word shows up. And @@Winterfox, the list shows up as NULL D:



I fixed it with this:

.skill_set$[2] =  ""+( ( ( eaclass() & EAJ_BASEMASK ) == EAJ_MAGE ) ? "" : "SP Rec:" ) +"Sight:Napalm Beat:Saftey Wall:Soul Strike:Cold Bolt:Frost Driver:Stone Curse:FireBall:FireWall:Fire Bolt:Lightning Bolt:ThunderStorm";


But it still shows as nulled...

Share this post


Link to post
Share on other sites
  • 0

Well after reading the complete thing and testing it on my server i found the issue. I thought your check would run in the script itself.

But in the OnInit part eaclass doesn't have a rid to attach so it failed.

 

That is also the reason why BaseClass fails, since thats a variable that is bound to your character and doesn't exist when running OnInit.

 

So that means it is impossible to ever check for the current class of the player in your menue, as long as it is in your OnInit part, since that is only once executed at server restart or when you use @reloadscript.

Well except you define it right after the npc definition and it jumps right into the label at every start, but that makes OnInit quiet useless.

 

To really do what you want to do, you need to build that menue when running it as player or add a copy without that skill and add a fork for that like this:

OnInit:.............skill_set$[2] = "SP Rec:Sight:Napalm Beat:Saftey Wall:Soul Strike:Cold Bolt:"				 "Frost Driver:Stone Curse:FireBall:FireWall:Fire Bolt:"				 "Lightning Bolt:ThunderStorm";.skill_set$[3] = "Sight:Napalm Beat:Saftey Wall:Soul Strike:Cold Bolt:"				 "Frost Driver:Stone Curse:FireBall:FireWall:Fire Bolt:"				 "Lightning Bolt:ThunderStorm";............OnInitEndSubclass Manager NPCif subclass is mage and we need that skille menue:// if the player is mageif( ( eaclass() & EAJ_BASEMASK ) == EAJ_MAGE ) )    .@menueToUse$ = .skill_set$[3]; // Use the menue without SP Regenelse    .@menueToUse$ = .skill_set$[2]; // Use the menue with SP Regen

Personally for readability and code clarity i would move the defining of .skill_set$ at the beginng on the npc so it gets executed everytime and use a scope variable (.@ prefix) instead of a npc one ( . prefix ).

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

Why not just use

select( (((eaclass() & EAJ_BASEMASK) == EAJ_MAGE)?"":"SP Rec") + ":" + .skill_set$[2] )

Anyway, that ":" there for a reason. If you'd be using the code presented by you, you'll essentially be getting 2 different menus with 2 different choice options, which would make it hard to place into logic. This way, empty option will not be presented inside NPC choice window, but it'll still take up place. So in short, without that ":" when you choose "Napalm Beat" you can get either option 2 or 3, with this you'll always get 3.

Edited by Garr

Share this post


Link to post
Share on other sites
  • 0

@@Garr You could go for that yes, didn't think of that but it was just a quick example. Personally i think the cleanest way is to set the array at runtime, since it requires no change of the internal working of the code and is more dynamic. Especially if future conditions could arise etc.

Edited by Winterfox

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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