Help with switching locked/unlocked Guns in Tables.

BillyEvsBillyEvs Member, PRO Posts: 14

Hi,

So my latest problem is causing me some headaches, wonder if anyone can shed some light.

I have a table with 3 guns stored, in my game you press an actor and it changes to the next gun (even if its locked) you just cant shoot bullets which is great, problem is the animation will have the next gun in hand therefore it is looking as if it the gun is already unlocked but just cant fire any bullets.

I may have over complicated that abit, in a nutshell i basically want my actor that when pressed will only change to a true(unlocked(boolean)) gun not a false(locked(boolean)) one.

(My set up at the moment - when actor is pressed - self.armorcount to ( self.armorCount +1)%tableRowCount( game.tbArmorIndex )

Any way of going about this?

Comments

  • deadbeatdeadbeat Member Posts: 14

    I think your massively over complicating it or i dont understand your question

    You could make three new boolean attributes called Gun1Unlocked, Gun2Unlocked and Gun3Unlocked. Set them to false. When the player unlocks the guns, set them to true. Then make a rule saying if touch is pressed AND GunXUnlocked is true change attribute, self.image to desired image. It would be a pain doing it this way because that would mean saving three attributes, which could be costly on memory. The alternative is to use a table, personally i dislike using tables because at the moment gamesalad does not support rules in which tablecellvalue's are equal to whatever.

    Hope I helped, deabeat

  • BillyEvsBillyEvs Member, PRO Posts: 14

    @deadbeat thanks for the reply, you have helped my but unfortunatley its still not working very close but not quite there.
    I have used your method which is perfect and incorporated it into my tables ( i have to use tables) i can get it only to swap when a gun is unlocked which is good, its just say gun1 and gun3 are both unlocked is there a way that i can go from row 1 straight to 3 instead of it (+1) through the table as then it passes through gun2, if i use (+2) it will go from gun1 to gun3 but then gun3 to gun2 as it skips one.. any way of telling it to use next unlocked gun? or row 3 for example...

    thanks for your input.

Sign In or Register to comment.