• Visit Rebornbuddy
  • Problem with Kupo's Spell.Cast

    Discussion in 'Community Developer Forum' started by Ichiba, Oct 31, 2014.

    1. Ichiba

      Ichiba New Member

      Joined:
      Jun 14, 2014
      Messages:
      258
      Likes Received:
      8
      Trophy Points:
      0
      DoAction and CanCast don't agree.

      Pretty simple

      Why does this work?
      Code:
      Actionmanager.DoAction("Ninjutsu", Core.Player.CurrentTarget)
      but this doesn't do anything?
      Code:
      Spell.Cast("Ninjutsu", r => true, r => Core.Player.CurrentTarget)

      Edit: Hmmm.... looks like CanCast only returns true if the target is Core.Player, but DoAction has to be Core.Player.CurrentTarget.

      Edit2: I guess I wrote around it, but it would be nice to not have to.
       
      Last edited: Nov 6, 2014
    2. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      Are you sure DoAction on Player doesn't work as well? I guess Ninjutsu is handled weird :S

      On a random tangent: if you don't like specifying targets in your rotation, you could edit the cast function: if cancast on target fails, check cancast on self and replace XD but I guess that would be bad >_>
       
    3. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83

      This..I assume if cancast only returns correct value on the player then it needs to be cast on the player. Don't have a ninja so cant say.
       
    4. Ichiba

      Ichiba New Member

      Joined:
      Jun 14, 2014
      Messages:
      258
      Likes Received:
      8
      Trophy Points:
      0
      It's wrong, though. For anything that requires being casted on an enemy target like Fuma Shuriken, Raiton, or Suiton,
      Code:
      Log(Actionmanager.CanCast("Ninjutsu", Core.Player));
      Log(Actionmanager.CanCast("Ninjutsu", Core.Player.CurrentTarget));
      Log(Actionmanager.DoAction("Ninjutsu", Core.Player));
      Log(Actionmanager.DoAction("Ninjutsu", Core.Player.CurrentTarget));
      Returns
      Code:
      True
      False
      False
      True
       
    5. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      Thanks for the testing!

      I think the best workaround would be a special cast function that cancasts the player :D
       
    6. Endus

      Endus Community Developer

      Joined:
      Jul 9, 2012
      Messages:
      458
      Likes Received:
      6
      Trophy Points:
      18
      Yeah I ran into this when I was banging my head against the LastSpell wall. At first I thought it might be because the game sees it as the new spell name and not "Ninjutsu" but I couldn't get a "True" out of anything but "Ninjutsu".

      I've tried the "DoAction" route but it doesn't work nearly as well/consistently as Cast (at least in my case). Hopefully someone smarter than me will figure something out soon. :cool:
       
    7. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      you still need all the logic behind a standard cast function instead of just using a doaction :p you just copy the cast function, rename it something else and replace the CanCast(data, o ?? Core.Player.CurrentTarget) with a CanCast(data, Core.Player)
       
    8. Endus

      Endus Community Developer

      Joined:
      Jul 9, 2012
      Messages:
      458
      Likes Received:
      6
      Trophy Points:
      18
      Yeah I made that post right after I woke up this morning, didn't make much sense. Was just venting that I had a lot of trouble getting it working right last night but didn't come out right lol.
       

    Share This Page