0 Favourites

Skill Autocast

  • 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

    <img src="https://dl.dropboxusercontent.com/u/158057323/c2.JPG" border="0" />

    it doesn't work.

    whole .capx file :

    dropbox.com/s/ms9129ky1km6ssl/tralalala.capx

    the autocast exists in 'tower skills' group

    (remove the extra dots)

  • update :

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

    <img src="https://dl.dropboxusercontent.com/u/158057323/c2%20ManualCast.JPG" border="0" />

    works like charm, this works as fine as before

    then i changed the autocast code too :

    <img src="https://dl.dropboxusercontent.com/u/158057323/c2%20AutoCast.JPG" border="0" />

    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 :

    dropbox.com/s/ksw5ryf223qyzvf/reololo.capx

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

    <img src="https://dl.dropboxusercontent.com/u/158057323/c2%20AutoCast.JPG" border="0" />

    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

    <img src="smileys/smiley36.gif" border="0" align="middle" /> <img src="smileys/smiley4.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley17.gif" border="0" align="middle" /> <img src="smileys/smiley2.gif" border="0" align="middle" />

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

  • ram

    i got stuck from yesterday morning through todays afternoon, so i thought of posting it here for helps <img src="smileys/smiley1.gif" border="0" align="middle" />

    for timer, maybe it's going to go better... thanks<img src="smileys/smiley4.gif" border="0" align="middle" />

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I think most of us have posted a "How do I ?" only to realise the answer before we get to read a reply...

    <img src="smileys/smiley1.gif" border="0" align="middle" />

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