Scripts / A question of weight

Author
Message
Honkeyboy
3D Media Maker
6
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 6th Jun 2021 21:12 Edited at: 6th Jun 2021 21:26
Hi all, ok as it is i have the weight system sort of tied to the inventory using this



Now the problem because I'm using a collecting as its base e.g you gain collecting exp for doing just that so as you collect you get more exp and you get a shiny badge for each level (that parts working fine) but what I'm trying to do is as you gain a badge your weight limit will increase so you can carry more stuff.

Question is would i be better making a new script to control that as by the looks of it it might over complicate the inventory script which just displays what you have? Ideas? Pointers?
what's the best way to go about this?
Cheers
p.s max weight to start with is set at 500 so e.g if g_collectingexp = say 100 then maxweight = 1000 but then the script as it is would still slow the player at 400 so that would need to adjust?
just trying to work out the best way do do this as i have lots of skills that need to add stats etc (maybe a seperate skill mods script?)
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
smallg
Community Leader
15
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jun 2021 09:42 Edited at: 7th Jun 2021 09:44
as long as it's a global you can change it in a different script yh.
at the top you can call
g_maxWeight = g_maxWeight or 500
to make sure it is always the same as the last value it was set to or default it to 500 (note i changed it to g_ so it will save with the save game)

as for changing it based on level if you have it done by a formula it will be much easier
i.e.
g_maxWeight = 500 + (g_level * 100)
so at g_level = 0 you can carry 500
at g_level = 1 = 600
g_level = 2 = 700 etc
just change the formula to suit your scaling

that way you don't need a bunch of 'if' statements
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
6
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 7th Jun 2021 12:26 Edited at: 7th Jun 2021 13:18
OK thanks G so in my case as I'm using g_collectexp I'd just use that in place of g_level and yh got you on the changing maxWeight to g_maxWeight will add that today reason i asked about doing it as a seperate script was that's 1 of 9 profession skill mods so I'll try it that way so the mods are all in the same script.
had to add this to the inventory script but works a treat ty



and added this to slow the player if over weight



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: 2021-11-27 20:47:57
Your offset time is: 2021-11-27 20:47:57