0 Favourites

[Solved]Enemy stat changes happen to all enemies.ID system??

  • Edit: After spending an embarrassingly long amount of time on this, I simply solved it by choosing an object and going down to 'size & position' and used 'Pick Nearest/Furthest' as opposed to instance variables and pick nth and all that crap.

    I'm making a turn based game where enemies get summoned from fog of war. I've got a TON or work DONE but having a real hard time trying to separate stats for each enemy since I can't find a way to identify the difference between each enemy. BASICALLY if you walk away from an enemy and attack another, the stat changes happen to both of them. The stats get randomized upon spawning and that works.Having a global variable doesn't matter since all enemies pull from the global variable. I read about UID and it seems there's no way to tell a UID of a spawned enemy?

    Is there any good way to give an enemy an identifier upon spawning so I can make changes during gameplay to only that enemy?

    I'll be around still lurking, any help at all is appreciated

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You shouldn't really need to differentiate if the logic is setup correctly, the events should trigger it for all objects that make it true. If you do want to label them though then you're probably looking for 'instance variables' instead of global variables. Instance variables are on the objects themselves and update individually kind of like stats for that one object. You could give it an ID that increments every time it is created. I see that you have done this with a text object display. Really you should be using instance variables for monster type objects so you have more control. You can give it a name, health, defense stats etc. Then you can use the text to display the variables that are stored on the monster object itself.

  • You shouldn't really need to differentiate if the logic is setup correctly, the events should trigger it for all objects that make it true. If you do want to label them though then you're probably looking for 'instance variables' instead of global variables. Instance variables are on the objects themselves and update individually kind of like stats for that one object. You could give it an ID that increments every time it is created. I see that you have done this with a text object display. Really you should be using instance variables for monster type objects so you have more control. You can give it a name, health, defense stats etc. Then you can use the text to display the variables that are stored on the monster object itself.

    Thanks, I'll definitely give it a try! In my research I had seen the 'pick instance' and I had no idea it might have referred to this. Very helpful. Still open for more input while I work on this. Extremely useful, I think this is what I'm looking for. Will report back

  • Pick instance refers to picking instances of objects, so a specific Monster object. Instance variable is a variable of a particular instance.

  • Having a bit of a hard time. I can't create anything on the event sheet to reference these variables so I can't edit them at all, just set the initial number. I'm definitely going to keep trying. I PM'd you the capx if you have the patience to keep working with me. If not, everything so far is much appreciated and I'll keep studying.

    Edit: Oh yeah, the code is in the folder - Random Generation>Main and that's where the monster is created

    I've been following this:

  • Yeah we can move this to PM as it will just be gaining assistance with instance variables.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
234 61,230
DARKSETH's avatar
DARKSETH
Unread hot topic
0 Favourites
Board Horde Stats Update
146 14,477
Dave Hailwood's avatar
Dave Hailwood
Unread hot topic Locked topic
195 16,197
Ashley's avatar
Ashley Construct Team Founder