0 Favourites

I really don't understand about multiple instances

  • 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.

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

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

  • 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

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

    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.

  • Bump, i still need to know to avoid conflict between instances to instances

  • 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 :)

  • 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 :)

    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?

  • > 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 :)

    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?

    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?

  • vee41 It looks nice tricky!

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

    Frames:

    1 - 2 - <font size="4">3</font> - 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?

  • vee41 i'm sorry to bump

  • Sorry didn't see your reply earlier :)

    Modified the example a bit, added a small delay so the gathering moment now matches with animation frame 3. Other approach would be to modify your animation a bit so it matches with gathering the way you wish, or start your animation on different frame.

    Hope this helps!

  • vee41 Thanks for your reply! :)

    I've checked your sample, that's not flexible tought what happens if you add extra cooldown frames?

    Actually we have 4 frames for Harvester, then duplicate last frame, duplicate another 4 frames, in total 8 frames. It altered the impact time. The observed result was it can impact by some cooldown frame, not frame number "2"

    Do you think we can create new instance variable as "Impact Frame" we type 2 in value field which is related to impact frame?

  • Do you think we can create new instance variable as "Impact Frame" we type 2 in value field which is related to impact frame?

    Yes, if you have different animations with different impact frames you need to change the action: Wait(Harvester.GatherSpeed/Harvester.AnimationFrameCount)*3

    Change the *3 to whatever your impact frame is, should work. You can have it as instance variable as well if you have separate animations with different impact frames.

  • >

    > Do you think we can create new instance variable as "Impact Frame" we type 2 in value field which is related to impact frame?

    >

    >

    Yes, if you have different animations with different impact frames you need to change the action: Wait(Harvester.GatherSpeed/Harvester.AnimationFrameCount)*3

    Change the *3 to whatever your impact frame is, should work. You can have it as instance variable as well if you have separate animations with different impact frames.

    vee41 Honestly, i'm getting a headache for this. The biggest problem to determine the number of frames and each frame speed.

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