Do this OR this

This forum is currently in read-only mode.
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Since CC Wiki is gone and I'm dumb as hell I don't know how to use "OR" system condition. I wanna Audiere play sound "walk1" OR "walk2" OR "walk3" (33,3% chance) when character walk (actually he don't walk now, I use "every X milliseconds", but is not important), because having only one sound for walk may be quite... boring. I don't wanna use variables for such simple thing, but I really don't know how to use "OR" condition. Can you help me?

  • Something like this? Not using OR

    audio:play sound(choose("sound1", "sound2", "sound3"))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't think that Construct Classic understand "choose"...

  • oh damn.. sorry dude

    note to self, look at forum title

    In CC can you do:

    choose random number 1 to 3

    if number=1 -> play "walk1"

    if number=2 -> play "walk2"

    if number=3 -> play "walk3"

  • You could use this expression for an equivalent of choose.

    {"sound1", "sound2", "sound3"}at (random(3)+1)

  • codah, yes, but I really don't wanna create variables for such trivial things.

    Thanks R0J0, your solution of course work, too bad that I totally don't understand why this work...

  • codah, yes, but I really don't wanna create variables for such trivial things.

    Thanks R0J0, your solution of course work, too bad that I totally don't understand why this work...

    I think this creates an one dimensionnal array of the 3 strings, then it choose one of the 3 values (not sure why the +1, does CC needs a 1 based index?)

  • > codah, yes, but I really don't wanna create variables for such trivial things.

    >

    > Thanks R0J0, your solution of course work, too bad that I totally don't understand why this work...

    >

    I think this creates an one dimensionnal array of the 3 strings, then it choose one of the 3 values (not sure why the +1, does CC needs a 1 based index?)

    Yes.

  • codah, yes, but I really don't wanna create variables for such trivial things.

    sorry CC is out of my depth.. is there a premium on variables or something?

  • There are only global and instance variables in CC. C2 spoils us with local variables.

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