Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

doing it wrong again

tatao

Member

let's assume i know for sure that the character with ID = 1 (actor = 1) is in the party
i would like to know if he is in the first, second, third or fourth position inside the party

i want to use the "index" function because the help file says:

index(val)
Returns the position of the first element equal to val (using ==). If no such element is found, returns nil.

i want to store it into a variable, so i do this:

$game_variables[16] = @actors.index(1)

and of course, it gives me an error message :-/
 

Anonymous

Guest

$game_actors[1].index should give you the index of actor 1.

Alternatively, you could use

$game_party.actors.index($game_actors[1])
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top