mjshi 2 Posted February 21, 2015 (edited) Okay, so in Scene_Shop I found this: #-------------------------------------------------------------------------- # * Get Sale Price #-------------------------------------------------------------------------- def selling_price @item.price / 2 end end And realizing that I wanted to make selling back items worth more than half price, I proceeded to change it to this: #-------------------------------------------------------------------------- # * Get Sale Price #-------------------------------------------------------------------------- def selling_price @item.price * 0.75 end end But what ended up happening was that upon selling back a "potion" worth 50 G, it returned a float number of 37.5 GIs there any way to "round" a float number in Ruby code? EDIT: no need to trouble about rounding "up" or "down", just always round up xD EDIT 2: I found that even when multiplying "50" by 0.8, which would give a whole number, still returns a float with a ".0" at the end. So.. float to int conversion, anyone? .-. Edited February 21, 2015 by innovation Share this post Link to post Share on other sites
R_Valkyrie 0 Posted February 21, 2015 If you want the item to be sold at 75% write it like this instead: (@item.price / 4) * 3 Share this post Link to post Share on other sites
+ Glasses 606 Posted February 21, 2015 Or just add .to_i at the end. Like, (@item.price * 0.75).to_i Share this post Link to post Share on other sites
mjshi 2 Posted February 22, 2015 Strange that when I use R_Valkyrie's suggestion, an item at 50 G comes out to 36 (50/4 = 12.5, probably rounded to 12, then multiplied by 3) whereas Glasses's suggestion makes it come out as a 37. Anyway, Thanks to both of you! Share this post Link to post Share on other sites
+ TBWCS 953 Posted February 22, 2015 Or there's this script that does everything: https://infinitytears.wordpress.com/2014/01/15/rgss3-item-weapon-and-armor-price-change/ Share this post Link to post Share on other sites
mjshi 2 Posted February 22, 2015 @ Soulpour777: That's not quite what I was looking for, and I've already found the answer to my question. Thank you for responding though! This thread can be closed now. Share this post Link to post Share on other sites