GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Some table issues adjusting object speeds at random...

I have 3 item spawners that spit out actors, these actors come out at a starting speed of 100. I am using the move behavior to do this. I have an at a speed of: game.DrinkSpeed.

I have a table setup with 1 row and 4 columns. They are all using integers and they go in the following order 100, 150, 200, 250. Now I want to pass those values off at random to game.DrinkSpeed.

So I setup a change attribute that statues when my actor overlaps or collides with one of these drinks. Spawn another one and change its speed. My change attribute looks like this: set: game.DrinkSpeed to random(1,tableColCount(game.T_DrinkSpeeds))

It will spawn another one but they seem to move at the speed of one of those Comcast turtles. Looks like if I was to set the move speed to about 10.

Comments

  • ericzingelerericzingeler Posts: 334Member
    edited June 2013
    ChangeAttribute game.DrinkSpeed
    to
    tableCellValue(table.DrinkSpeeds, 1, random(1, tableColCount(tableDrinkSpeeds)))

    Give that a whirl.
  • UberAirshipUberAirship Posts: 10Member
    Yeah that did the trick. So let me see if I got this straight.

    That code is telling my drink speed table so look at row 1 then randomly pick from the columns.

    I was just pretty much missing the part telling it to look at a row. So when I do something like this again I need to make sure I am putting in a table check for a row and a column.
  • ericzingelerericzingeler Posts: 334Member
    Correct!

    Change attribute to a table cell value > of some table > at row number 1 > at column number random 1 to column count of some table.

    Just follow that puppy all they way through.
  • UberAirshipUberAirship Posts: 10Member
    Cool thanks again, coming from using the Unreal Engine this code in GS really mind F's me haha.
This discussion has been closed.