How do I reload a particular weapon ?

0 favourites
  • 3 posts
From the Asset Store
A sound pack containing 132 laser gun sound effects, including mono and stereo versions of audio files.
  • I tried storing the weapon UID and use the pick instance with UID function but it never does reload the weapon in question.

    Here is my "code" :

    Basically I just use a while to find any magazine not used.

    Then use it by toggling the Used boolean.

    And pick the weapon that it on the shoulder of the player to reload it by setting the variable AmmoLeft to the max capacity of the weapon.

    Result : it doesn't work and I don't really know what to do any help appreciated.

    Thanks.

  • I think instead of "while", you meant to use "for each" items

    But I'm not sure what you expect this event to do..

    If you change the while with for each what it will do is set the boolean of all items that are on layer 2 and are of type ammo and are not used to used..

    If the instance of items with uid = player.uid is on layer2, is of the type ammo and is not used it will set it's ammoleft to items.maxammo

    what I don't get is how you use the ammo by setting it used..

    It doesn't change anything else than it's boolean in this event.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • My magazines have no capacity because I want ammo to be universal so the player can gather any weapon and never have to worry about ammo type. So the magazine can either be used (empty) or full (not used).

    The part that doesn't work is the pick instance one. Switched to a for each didn't solve the fact that pick instance isn't triggered.

    Thanks for your answer tho.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)