Gathering Minerals... Some Instances Ignored

Get help using Construct 2

Post » Fri Feb 22, 2013 12:14 pm

Hi guys,

I'm having a headcache when i'm figuring out how to make it perfect AI when each servbots should gather minerals togheter and don't ignore, this .capx is wrong because some servbots move and ignore gathering minerals.

I'm looking best practices and remove their "ignorance" when they encounter minerals


It spawns a servbot, wait to gather a mineral, everything works if is only one instance

But multiple instances, when other servbots are gathering and spawn another servbot, then walks and ignored minerals to gather.


Would you help me?

Thanks!


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

Post » Fri Feb 22, 2013 12:20 pm

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

Post » Fri Feb 22, 2013 5:31 pm

@Joannesalfa - the trigger once condition in setting the state is what's doing it, because it's telling it only do this once. so once they have been set to "harvest" and that becomes untrue and then true again it will not re-reset to harvest and will keep walking. i think anyway, this fixes it:



B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Sat Feb 23, 2013 12:52 am

Thanks @wretchedshark, there another irregular, disable every 2 seconds to spawn servbot, create 1 servbot, watch Minerals Collected: # looks pretty normal, but spawn another servbot, it looks very irregular, it shouldn't generate more 50 minerals than 20 per gathering.

Do you know what i mean?
B
96
S
25
G
20
Posts: 3,052
Reputation: 22,638

Post » Sat Feb 23, 2013 10:15 am

@Joannesalfa - trigger once doesn't always work as expected, also triggering minerals added by animation frame leads to weird problems. because every tick that it's on that animation frame it will continuously add 10 minerals.

you can try adding a harvest time variable that counts down every dt while harvesting and then when it = 0 > add 10 minerals > reset harvesttimevariable
B
14
S
6
G
2
Posts: 136
Reputation: 3,210


Return to How do I....?

Who is online

Users browsing this forum: Paradox and 4 guests

cron