none repeating table issue

tippedchairtippedchair Member Posts: 3
edited April 2014 in Working with GS (Mac)

Hey GS community,
I'm a good way through my first game and I'm hung up on a bug that I'm pretty sure is easy to fix... buuuut can't seem to solve.

I have an actor (Hero) that should spawn 6 new actors (Companions) around himself. Now each of the Companions are different actors (ones fire, water, lighting, etc.) and when they are spawned the Companion are supposed to:
FIRST look on a table for their y position which is an offset from the hero
THEN remove that choice from the table
AND FINALLY save the table so the other Companions don't use the same information.

Now what happens in game is that a Hero will spawn all 6 Companions but two (or sometimes more) will be in the exact same spot.

right now my code looks like this:

Companion Actor Attribute
Spot

    **Companion Actor Code**
      Change Attribute
          Change Attribute self.Spot    to     tableCellValue( game.Table 1 ,random(1,tableRowCount( game.Table 1 )),1)

      Remove row
         Table 1
         Action: Remove Row    At Index   self.Spot

      Save Table
         Table 1

      Constrain to Hero
         Constrain attribute: self.Position.Y   to game.HeroPositionY + self.Spot

Table 1 has the offset numbers; example 100, 200, 300.

As you can see from above I've used the code from Tshirtsbooth's video on picking random values from a table without repeating and tatiang was so kind as to help me out to make sure the actors are pulling the right information from the table.

I thought maybe that the system was getting confused by all the actors pulling info and writing/saving to the table at the same time so I tried spacing out the spawning of each companion. That still did not work, and even made it worse in some cases.

Any help would be appreciated.

Comments

Sign In or Register to comment.