I’m making a weapon inventory system in which you can carry multiple guns, use and swap between guns, and get ammo for those guns without them in your hand. Thing is, the guns and their weapon/ammo pickup are separate objects. I want to make sure the player get the gun first before getting more ammo as seen in the below screenshot:
Generally gdevelop read events from top to bottom
Sooo all you would need to do is increase ammo be always under change guns variable
Sorry, what do you mean by “be always under”?
YES
Player is in collision with Wpickup 0
Change variable gunsUnlocked.gun1 set to 1
Increase ammo of pistol by RandomInRange(6,9)
NO
Player is in collision with Wpickup 0
Increase ammo of pistol by RandomInRange(6,9)
Change variable gunsUnlocked.gun1 set to 1
By deault, I set the Pistol ShotsPerReload to 10, its starting ammo 10, and max ammo of 50. Idea is, the gun needs to be picked up first before I can get more ammo for it with the WPpickup object since I hide all the player’s guns in a scene layer.
What is WPpickup?
Gun to unlock
Or Ammo pickup?
Or what?
The WPpickup object is both for unlocking guns and ammo pickup. Or should I make a separate weapon and ammo object?
I have no idea cause that would depend on your game
Same as splitting ammo type per weapon
For me concept is stupid
BUT if your game logic circle around it then it would make perfect sense
On other hand AGAIN depending on your game
I have no idea what is the point of splitting ammo pickups and gun pickups
Like why you should be able to pick up ammo for weapon only if you have that weapon?
Going further what is the point of having 2 different things for that?
Why not just picking a weapon adds ammo
And that weapon pickup serves both as ammo and weapon pickup
Like look
Let’s go most stupid route of logic
I assume you played minecraft
SOOOO
You pick up stone axe you get stone axe with 100% durability
And each picked stone axe is another stone axe with 100% durability
HOWEVER imagine picking another axe would just add 100% or set your axe to 100%
Wouldn’t that make more sense?
And now picking stone to use your axe would not make sense
Do you get it?
Where if you want to have FEW weapon pick up (unlock weapon items) over your scene
BUT many ammo pickups for each weapons then that is different story
But in the 1st place it should be logical to your well game logic
So before we go any further be sure we are going right direction
BTW to my understanding only benefit with your idea is
I will run your level passing by many ammo pickups and it will be NOT like i cannot pick them up cause i don’t have specific gun
It will be more like i cannot store them for now cause i don’t have specific gun
Like once i have gun its like i get that new backpack that can store ammo for that gun
And before that i don’t have that backpack
Where what i would find logical is just allow me to store whatever ammo i pick when i pick it
But use it only if i have appropriate gun for it
Current concept is like, first time weapon1 pickup gives you the weapon, next weapon1 pickup gives you the ammo for that weapon even if you’re using something else, something like Half-Life or GTA style of system.
I do get that
But issue is will you have separate object for ammo which should not be pickable if you don’t have weapon for it unlocked
OR do you want to go like
I have pistol but i don’t have shotgun
I pick up my very first shotgun i get 10 shotgun ammo
And i get shotgun
AND my weapon is automatically switched to shotgun
BUT now i having both weapons pistol and shotgun i switched to pistol
I pick another shotgun and NOW it only adds ammo but DO NOT switch to shotgun?
Yes, something like the latter.
SO you need to set your events in order
Look
Player is in collision with WPickup
Sub event
Here in condition you check if WHATEVER you picked up is NOT unlocked
In action you unlock it and set your current weapon to that weapon
In another sub event you check if weapon IS unlocked and in action you add ammo to it
This way if weapon is already unlocked it will only add ammo without switching to it