How do I instance variable transfer

Get help using Construct 2

Post » Mon May 19, 2014 12:18 pm

Hello,
I would like to know how can I transfer instance variable to family variable e.g. from Enemy1, to Enemies family HP variable. There will be only one enemy randomly chosen from enemies family.
I tried hard, but I have no idea how to do it. When there is enemy, I dont know which one has spawned, so I cant check if enemy should be destroyed or not.

PS. Sry for bad english ;p
B
3
Posts: 8
Reputation: 193

Post » Mon May 19, 2014 1:12 pm

What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Tue May 20, 2014 8:31 am

Message: Freenek is not yet permitted to post plain text URLS (300 rep required). 2 URLS removed. Why?
granpa wrote:Take a look at this in the manualand this tutorial


I cant use Monsters.HP (which HP is instance variable of certain monster). Im forced to use family variable, thats why I need to transfer it.

The only way I found is doing it manually, however its really bad idea at all.
B
3
Posts: 8
Reputation: 193

Post » Wed May 21, 2014 8:54 am

Still need help, bump.
B
3
Posts: 8
Reputation: 193

Post » Wed May 21, 2014 11:23 am

You could use the system condition Pick random instance (choose a random instance, in this case you want a random instance of the family):
"Pick a random instance from the currently picked objects. In other words, if Pick random instance follows another condition, it will pick a random instance from the instances meeting the prior condition. Otherwise it picks a random instance from all the instances."

Store the Ennemies.HP value somewhere (since you picked a random instance, it ll be that instance that is concerned)
Then pick all instances of Ennemies, and set their health to the value stored.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Fri May 23, 2014 7:57 am

Aphrodite wrote:Store the Ennemies.HP value somewhere (since you picked a random instance, it ll be that instance that is concerned)


Not sure how to store it somewhere, thats my problem at all.
B
3
Posts: 8
Reputation: 193

Post » Sat May 24, 2014 7:42 am

Bump, still need help.
B
3
Posts: 8
Reputation: 193

Post » Sat May 24, 2014 7:54 am

I would scrap using families for Monsters. Families are there to make the work flow quick and easy. When you are handling multiple monsters and instance variables, you need to do them separately.
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Post » Mon May 26, 2014 8:03 am

Tekniko wrote:I would scrap using families for Monsters. Families are there to make the work flow quick and easy. When you are handling multiple monsters and instance variables, you need to do them separately.


Wait, you tell me to add 50 monsters separately and for each skill i should add 50 monsters which every lose certain amount of hp? Thats totally retarded imo.
B
3
Posts: 8
Reputation: 193

Post » Mon May 26, 2014 9:13 am

Yes. Unfortunately, it takes a lot of work.
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Next

Return to How do I....?

Who is online

Users browsing this forum: FlyingRam, jkmalau, Manubis, marcinkowski and 7 guests