Skill Autocast

Get help using Construct 2

Post » Sun Jan 19, 2014 6:43 am

my tower defense project will have skills that have cooldown, if the cooldown is 0 or lower, the skill then can be activated.


for manual casting, i've finished it, no problem at all. However, as it is tower defense game, i thought of making a 'auto cast' that will cast the skill automatically with 2 simple conditions :

1.the tower has target in range
2.the skill is not in cooldown


each available towers will cast it's skill for as long as those 2 conditions are fulfilled.


based on those 2 conditions, i've make the code like this



it doesn't work.



whole .capx file :
https://www.dropbox.com/s/ms9129ky1km6ssl/tralalala.capx

the autocast exists in 'tower skills' group
(remove the extra dots)vahnyourdoom2014-01-19 09:30:38
B
7
Posts: 11
Reputation: 397

Post » Sun Jan 19, 2014 9:29 am

update :
i've tried to make the casting of skill into a function.


works like charm, this works as fine as before


then i changed the autocast code too :



doesn't work......only works to the first tower affected by the autocast, if i had 2 or more instance of 'mana tower', it won't autocasts. any idea why?


this is the .capx of my update :
https://www.dropbox.com/s/ksw5ryf223qyzvf/reololo.capx

if you clicked on the atkpoint (that small yellow circle), you can see that the code from

actually works.
it changes the instance variable of 'Zeal' into 1, but it does not call "SkillActivate" function.....
or maybe the SkillActivate function got an error because the first tower keeps calling it? how to stop it then?



-----------


pffffffffftttttt....

okay, after looking it through, i know what's wrong, now autocast and manual cast works.
i've tried this for 2 days already, posting it here sure help :3
vahnyourdoom2014-01-19 09:44:24
B
7
Posts: 11
Reputation: 397

Post » Sun Jan 19, 2014 10:30 am

Glad you got it sorted.

In future, to make thing wait for a bit before doing something, it might be worth looking at the timer behaviour rather using wait ?

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Sun Jan 19, 2014 11:01 am

@Ram

i got stuck from yesterday morning through todays afternoon, so i thought of posting it here for helps

for timer, maybe it's going to go better... thanks
B
7
Posts: 11
Reputation: 397

Post » Sun Jan 19, 2014 11:08 am

I think most of us have posted a "How do I ?" only to realise the answer before we get to read a reply...

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812


Return to How do I....?

Who is online

Users browsing this forum: ChesVCF and 1 guest