I really don't understand about multiple instances

Get help using Construct 2

Post » Thu Feb 28, 2013 5:34 am

I've made like 3 threads and i got no feedbacks... I guess i would keep making threads until we get a reason why it didn't work.

Download it and press preview:
http://dl.dropbox.com/u/76227787/Miner.capx

It works like a charm, so we want to copy another "Harverster" in this layout, then preview.

It didn't work because second miner ignored harvesting. There a workraround to make it working was cloning from Harvester to Harvester 2 and copy/paste the entire event from Harvester to Harvester2, it worked very fine. But it's waste of time and bigger events.

I need a help, i still don't get why multiple instances never work.
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Thu Feb 28, 2013 6:30 am

Your problem with this specific capx is the trigger once events.

Few tweaks and cleanup resulted in this capx (r120.2)

B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Thu Feb 28, 2013 7:01 am

@theubie oh weird, i always think it could take logic performance if each boolean state is on every tick, however it's working. Thanks!

Actually... i added animation how it gathers mineral. 100 per Frame 2. Added in event 5.

I found a bug, it seems the synchronization between 2 instances, if they move as equal... it caused bug, there a thing you can reproduce bug, i made 2 layouts Good and Bad:

-Good, the gathering minerals were reasonable added goods and substracted minerals.

-Bad, the returned goods was irregular because the remaining crystal is 50,000, 2 instances gathered this mineral by 500 each one, the goods are 1,000 and the mineal is 49,500, very irregular. It should be 49,000.

Do you have an idea how to fix it?

http://dl.dropbox.com/u/76227787/MineralGoodsBug.capx
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Thu Feb 28, 2013 7:38 am

Add 'for each harvester' above your 'is gathering' event. Right now every gathering harvester is picked and same events are executed for each one. You can observe the behavior by setting a debug text to 'Harvester.pickedCount' at start of gather event and you'll get value 2 back, meaning that there are two harvesters that fulfill the 'is gathering' condition.vee412013-02-28 07:40:28
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Thu Feb 28, 2013 11:16 pm

[QUOTE=vee41] Add 'for each harvester' above your 'is gathering' event. Right now every gathering harvester is picked and same events are executed for each one. You can observe the behavior by setting a debug text to 'Harvester.pickedCount' at start of gather event and you'll get value 2 back, meaning that there are two harvesters that fulfill the 'is gathering' condition.[/QUOTE]


@vee41 that's NOT the solution, i've added "for each harvester" before, if you notice the numbers are substracting like animation is irregular too.

Also it breaks the other instance when is gathering longer.


The excepted result should substract 200 to Mineral if 2 workers are gathering at same time.Joannesalfa2013-02-28 23:17:49
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Fri Mar 01, 2013 3:02 am

Bump, i still need to know to avoid conflict between instances to instancesJoannesalfa2013-03-01 03:07:31
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Fri Mar 01, 2013 8:09 am

Didn't really look through your other events, was in a hurry. :)

Harvester example

I kind of did in a different way that should be way easier to manage and expand. Left few comments in the events, but feel free to ask if there is something weird there :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Fri Mar 01, 2013 8:44 am

[QUOTE=vee41] Didn't really look through your other events, was in a hurry. :)

Harvester example

I kind of did in a different way that should be way easier to manage and expand. Left few comments in the events, but feel free to ask if there is something weird there :)[/QUOTE]

@vee41
Nice! I think im understanding better, i liked your event order, i feel so good you could solve the problem that i couldn't figure out, i really appreciate your help! :)

I have a question...

However, you removed "Animation Frame = 2" it's used to give an eye candy like impact, isn't possible to implement back?

B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Fri Mar 01, 2013 9:34 am

[QUOTE=Joannesalfa] [QUOTE=vee41] Didn't really look through your other events, was in a hurry. :)

Harvester example

I kind of did in a different way that should be way easier to manage and expand. Left few comments in the events, but feel free to ask if there is something weird there :)[/QUOTE]

@vee41
Nice! I think im understanding better, i liked your event order, i feel so good you could solve the problem that i couldn't figure out, i really appreciate your help! :)

I have a question...

However, you removed "Animation Frame = 2" it's used to give an eye candy like impact, isn't possible to implement back?

[/QUOTE]

That's a a good point, I added an action to match the gathering animation speed with gathering speed of the harvester. I updated the link I posted before, was this what you were looking for?
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Fri Mar 01, 2013 9:53 pm

@vee41 It looks nice tricky!

I'm not sure this is flexible enough, my idea is supposed to be like

Frames:

1 - 2 - 3 - 4 - 5

bolded 3 causes impact to another object.

Otherwise 4 and 5 are cooldown frames.

We can add new instance variable like "Impact Frame" value is 3 compare frame animation

Is complicated to do it?
Joannesalfa2013-03-01 21:54:33
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests