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

Get help using Construct 2

Post » Wed Oct 26, 2016 10:42 pm

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
Last edited by jbr190 on Sun Oct 30, 2016 2:03 am, edited 2 times in total.
B
30
S
14
G
6
Posts: 51
Reputation: 5,085

Post » Wed Oct 26, 2016 11:41 pm

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.
B
46
S
16
G
74
Posts: 2,088
Reputation: 44,185

Post » Thu Oct 27, 2016 1:03 am

plinkie wrote: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
B
30
S
14
G
6
Posts: 51
Reputation: 5,085

Post » Thu Oct 27, 2016 1:30 am

Pick instance refers to picking instances of objects, so a specific Monster object. Instance variable is a variable of a particular instance.
B
46
S
16
G
74
Posts: 2,088
Reputation: 44,185

Post » Thu Oct 27, 2016 2:26 am

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:
how-do-i-create-an-object-with-diff-instance-variable-value_t111748
B
30
S
14
G
6
Posts: 51
Reputation: 5,085

Post » Thu Oct 27, 2016 2:59 am

Yeah we can move this to PM as it will just be gaining assistance with instance variables.
B
46
S
16
G
74
Posts: 2,088
Reputation: 44,185


Return to How do I....?

Who is online

Users browsing this forum: plinkie, rayolf, SashikLV, Yahoo [Bot] and 7 guests