Jump to content
  • 0

Regarding "bonus2 bSkillAtk,sk,n;"


aadritch2

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   0
  • Joined:  04/29/13
  • Last Seen:  

It says in item_bonus.txt that it "Increases damage of skill sk by n%". My problem is that since it is n%, it cannot read below 1%. Like 15.52% increase in damage. How can i make so that it is "by n/100%" instead?

Edited by aadritch2
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

bonus2 bSkillAtk,"SK_TEST",50/2; Try this :))

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   0
  • Joined:  04/29/13
  • Last Seen:  

Yes I've tried that. My value was -8868/100, but the result i get is still from -88% rather than -88.68% which are 3410 and 3214 respectively. Its a little difference in percentage but it can be a large gap in bigger numbers. It seems to it keeps rounding off the decimals. Thanks for answering.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

it is because the declaration of the variable that handles the bonus in the src is type short.

struct s_skill_bonus { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
		unsigned short id;
		short val;

Hence, C automatically truncates the decimals that follow after it. If you want to handle decimal values, you have a lot of choices but for me you can do this: change the variable type to any floating type variable (i.e. float, double, etc.) but you should make sure to cap those values to -32768.00 to +32767.00 to accommodate the original non-float type "short"

 

  • Upvote 1
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...