Scripts / A question about weight?

Author
Message
Honkeyboy
3D Media Maker
6
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 26th May 2021 16:59
Hey all been working on weight today, so say if you buy berries from a shop it starts to add weight to the inventory, from the shop to player its working fine but I'm a little stuck on the pickup/collection script as it uses
g_berriescollected = g_berriescollected + math.random(2 , 10)
and not a set value which the shop does e.g
g_berriescollected = g_berriescollected + 1
g_weight = g_weight + 0.01

My question is how would I get the script to add the correct value of weight from the random amount?
Cheers
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
5
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th May 2021 17:27
local berriesCollected = math.random(2 , 10)
g_berriescollected = g_berriescollected + berriesCollected
g_weight = g_weight + 0.01 * berriesCollected
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
6
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 26th May 2021 17:37
Cheers AM
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Login to post a reply

Server time is: 2022-01-25 05:55:24
Your offset time is: 2022-01-25 05:55:24