Hello everyone, I seem to have hit a stand still, now I’m no programmer, not at all(though i try) and I’ve spent the last few hours trying to make a script to be able to pick up weapons, now the problem here is I don’t even know where to start. Now I’m not asking for someone to make me a full script because I know you all are busy and I wouldn’t learn anything from that, what I’m asking is for someone to give me an idea of how I should start, so any help at all is greatly appreciated
i think you need to check the Unity Documentation… but here’s a clue for do that you want.
Review for the instructions:
Instiatate
Destroy
GetComponent
i made this along time ago… you can do that in one day if you put atention
I can think of several ways of doing this, but I’m a poor programmer so they might not be the best ways (they probably aren’t). Anyway, you never know, this strikes me as being a simpler problem than it sounds.
Supposing you had a player who can pick up one of each weapon available (as in Unreal Tournament for example). How about if you set up a load of boolean variables (or just a single array), each of which corresponds to a weapon type. Set all of them except whatever weapons you want to start with to false, then whenever you collide with a weapon pickup have it check if you’ve already picked it up before by just asking if the relevant boolean for that weapon type is false. If it is false, then destroy the pickup and set the weapon’s boolean thingy to true.
var weaponKnife : Boolean = true;
var weaponPistol : Boolean = false;
var weaponRocketPropelledCocktailParasolLauncher : Boolean = false;
var weaponDalekToiletPlunger : Boolean = false;
Somewhere else of course you’d need other scripts so that you can only switch to a weapon if its variable is set to true, or if you want GUI stuff too you could do something like vary the alpha channel of the weapon’s GUI texture icon depending on if it’s variable is true or false, just so the player knows what gubbins they’ve aquired already.
Is that kinda what you were after? If not I’ll have another stab at it, but if you’re wanting something much more complicated like having a character physically reach down and pick up a weapon off the ground I’m afraid procedural animation or whatever is a bit beyond me.
Thanks for the reply’s guys
First of all i have spent 3 days in the docs, and i did find some stuff but just couldn’t put it together
And Wolfie, that is exactly what i need! thank you so much!
Glad to be of service, best of luck with the game!