Jump to content
  • 0

What's Wrong with this code?


Question

Posted


 - script levelingcontrol -1,{

OnNPCKillEvent:

if (BaseLevel - getmonsterinfo(killedrid,1) < 10) {

BaseExp = BaseExp + BaseExp*0.35;

JobExp  = JobExp  + JobExp*0.35;

}

}

4 answers to this question

Recommended Posts

Posted

This script will give 0,35% more EXP for killing any mobs in game.

I dont know why this dont work.

-	script	leveling_control	-1,{
OnNPCKillEvent:
	.@range = BaseLevel - getmonsterinfo( killedrid, MOB_LV );
	.@range = .@range < 0 ? -.@range : .@range;
	if ( .@range < 10 ) {
		.@base = getmonsterinfo( killedrid, MOB_BASEEXP );
		.@job  = getmonsterinfo( killedrid, MOB_JOBEXP  );
		if ( .@base > 0 )
			set BaseExp, BaseExp + .@base * 35 / 100;
		if ( .@job  > 0 )
			set JobExp , JobExp  + .@job  * 35 / 100;
	}
	end;
}
  • Upvote 1
Posted

You can't use decimal in scripts...

Instead you could do...

BaseExp += ( BaseExp * 35 ) / 100;

Which is roughly the same thing.

 

Also for the record...

BaseExp = BaseExp + BaseExp*0.35;

And

BaseExp = BaseExp * 1.35;

Are the same.

You could even shorten it to...

BaseExp *= 1.35;

In some languages.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...