Jump to content
  • 0

What's Wrong with this code?


Tales

Question


  • Group:  Members
  • Topic Count:  163
  • Topics Per Day:  0.04
  • Content Count:  319
  • Reputation:   8
  • Joined:  02/05/12
  • Last Seen:  


 - script levelingcontrol -1,{

OnNPCKillEvent:

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

BaseExp = BaseExp + BaseExp*0.35;

JobExp  = JobExp  + JobExp*0.35;

}

}

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   5
  • Joined:  02/01/12
  • Last Seen:  

And there is probably no end;

in case if this is not planned

Edited by CandyCandy
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  163
  • Topics Per Day:  0.04
  • Content Count:  319
  • Reputation:   8
  • Joined:  02/05/12
  • Last Seen:  

This script will give 0,35% more EXP for killing any mobs in game.
I dont know why this dont work.

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