compare with a string that isn't created?

This forum is currently in read-only mode.
  • Is it possible to check how many private strings an object has? In mmf it was possible by a bunch of events looking like this: Alterable string A of "object = <> "". But that's not possible in construct cus you cant compare with a string that issn't created.

  • Why do you need to know how many private variables an object has? There's no expression to get the count at the moment. I guess you could always add spares and compare to see if those are empty or not?

  • I'm creating a system for my rpg where you can talk to people, and to make it easy to create levels i want to just ad any number of strings to an object, and when you overlap it, one of the strings are displayed at random. So i want to create an event like

    Player overlaps Talking-Set text "Talking.String(1+random(number of strings))"

    Something like that. I don't want to write how many strings the object has in a separate value, and i don't want to create ten strings for every new guy i create.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could have a private variable for the number of strings on each talking NPC.

    So it would be "Set text "Talking.String(1+random(Talking('numstrings'))" or something to that effect. (I believe private variables are referenced with object('variable') are they not? Or at least, object.variable has never worked for me)

  • I try to avoid repetitions. Its very unpractical if i'm going to have 100 diffrent persons talking, and if i want to change around while i create the game. I would like a simple way to retrieve the number of strings, and/or a way to name a string by a number, and not just the name (for example, display string #3 would display the third string, if it exists. Otherwise the string counts as empty.)

  • Well, it's easy to add. 0.91 has a 'get private variable count' (Sprite.NumVars) expression.

  • Wow, you're really incredible. Thank you very much.

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