Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spell and Run
Author Message
Mimosa
Apprentice
*

Posts: 6
Likes Given: 5
Likes Received: 0 in 0 posts
Joined: Aug 2018
Reputation: 0



Post: #1
Spell and Run
Hello Guys, How are you?

I'm trying to make my pet use spell and walk at the same time. Someone know how to do that?
The script i'm using to make the spell and the go function is down there, but when i use magic and try to make the pet walk the magic is cancelled.

PHP Code:
[SPEECH fala_galinha]

// the speech to make it use spell
ON=*use bola de fogo*
    
    IF (<
ISMYPET>)
          IF (<
MAGIAFOGO> >=100 )    
            
SRC.CTAG.NPCCast.Src=<UID>
            
SRC.TARGETF f_npc_boladefogo
             
Return 1
        
ENDIF
    ENDIF

// the speech to make pet go where i want
ON=*VAI PARA LA*

    IF (<
ISMYPET>)    

        
SRC.CTAG.VAI.Src=<UID>
        
SRC.TARGETFG f_npc_vaiparala
        
return 1
    
ENDIF


// the function to use the fireball magic
[FUNCTION f_npc_boladefogo]
IF (<
ARGO.ISCHAR>)
  
REF1=<CTAG0.NPCCast.Src>
  IF (<
REF1.ISMYPET>)
    
REF1.TAG.ELEMENTOFOGO 1
    REF1
.TAG.DIFICULDADE 100
    REF1
.NPCCAST <DEF0.s_boladefogo>,<ARGO>
      ENDIF
ENDIF

CTAG.NPCCast.Src=


// the function to pet go where i want

[FUNCTION f_npc_vaiparala]

  
REF1=<CTAG0.VAI.Src>
  
REF1.GOTO <TARGP


Thanks for the support.
08-29-2018 11:53 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 806
Likes Given: 4
Likes Received: 187 in 153 posts
Joined: Jul 2012
Reputation: 6

Dimension Shard

Post: #2
RE: Spell and Run
I never played with "scripted" NPC actions because usually it's not a good idea replace the internal AI actions with any kind of scripted behavior (it will mess the AI action). But anyway, I think it's not possible make the NPC walk and cast spells at the same time because to make it walk you need to set ACTP and start action 074 ("runningto") and to make it cast spells you must set ACTPRV, ACTARG1 and start action 25 ("skill_magery"), so one action will override the other. Even if you call ATTACK function it will probably also override the previous action

long story short: NPC AI can't handle 2 actions at the same time
09-03-2018 09:16 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 2 users Like Coruja's post
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

This forum uses Lukasz Tkacz MyBB addons.