• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Update weapon stats?

E

entegrade

Guest
hey all, ive made an rng weapon system in my game. the gun has its own base reload stat decided in the create event. ive also put a new reload stat in the create event that gets its new reload speed after upgrades/mods (this is here since i cant put it in the step event otherwise). the new reload is also in the begin step event.

when the gun is drawn in the draw event and is in its reload state (also in the draw event) it plays its reload animation. the image_speed is determined by the formula base reload / New reload. (divides both values so if you have a faster new reload, the animation will play faster).

however, even if ive modified the new reload’s value in the step event, it always refers to its create event for the value. i want to update the new reload in real time so the image_speed will always be updated based on any new +reload speed stats/upgrades/downgrades.

ive tried global variables that can be updated but it still always refers to its create event value. any idea how i could fix this? any help would be deeply appreciated
 
Last edited by a moderator:
T

trentallain

Guest
hey all, ive made an rng weapon system in my game. the gun has its own base reload stat decided in the create event. ive also put a new reload stat in the create event that gets its new reload speed after upgrades/mods (this is here since i cant put it in the step event otherwise). the new reload is also in the begin step event.

when the gun is drawn in the draw event and is in its reload state (also in the draw event) it plays its reload animation. the image_speed is determined by the formula base reload / New reload. (divides both values so if you have a faster new reload, the animation will play faster).

however, even if ive modified the new reload’s value in the step event, it always refers to its create event for the value. i want to update the new reload in real time so the image_speed will always be updated based on any new +reload speed stats/upgrades/downgrades.

ive tried global variables that can be updated but it still always refers to its create event value. any idea how i could fix this? any help would be deeply appreciated
So I'll assume that this is using the same concept as your last post on how to create an rng weapon system. One way you can do it is store each part of the gun in its own ds_map. You choose can choose each part from a list of ds_maps if you like. Each part in that ds_map will have different stats depending on what it does. E.g. a ammo clip on it will give you more ammo and maybe even faster reload.

When you have gotten your gun made (you have chosen all the parts), you can store the information from that gun's ds_map into some variables (e.g. reload speed), and you can add all the relevant stats to those for later use. Then in the draw event or whatever, just reference those variables and you will get your calculated reload speed.

Edit: every time you change a part on it, update the ds_map for the gun and update the variables too.
 
Top