Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

Random Gun Generation

$
0
0
Hello! So a main mechanic of a game I am working on is random gun drops. Very similar to Borderlands style but the game itself is a roguelike. I've already written a script that randomly generates gun stats which includes the gun type (Pistol, Rifle, Shotgun, etc), the shot type (full auto, burst, single fire), and all the other stats like damage, fire rate, reload time, magazine size, and even bullet spread. I then have these variables fed to my gun component and I temporarily have the stats set to all generate by pressing "E". Most of these stats are calculated simply by using Random.Range. NOW... The part that has left me scratching my head for a while here is how can I have the gun stats be set on drop. IE when an enemy is defeated or a chest is opened. Ideally I'd like an inventory space of two but that's adjustable, and of course the weapons need to be able to be dropped and maintain their stats. Also have the stats carry over between scenes, but that part I think I got covered. I imagine the first steps of getting this to work would first have a system of being able to pick up a gun in the first place but any attempts of that have failed. I believe the method of just passing variables back and forth is janky and wasn't even working to begin with. The scripts I have written are extensive so let me know if there are any excerpts from them you'd like to see in particular. ![alt text][1] ![alt text][2] [1]: /storage/temp/148734-unityhelp3.png [2]: /storage/temp/148733-unityhelp2.png

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>