Jump to content

NPC spell cast problem


Recommended Posts

alrighty so I'm pretty confused here. what I have is an NPC who has an AI package that essentially makes him sit and ponder. He has a second package that tells him to find the player if the player is within 500 units of him, and to always run at him. I have the NPC set at aggression 5, 100 energy 100 confidence and 0 responsibility. He's a member of the necromancer faction, the necromancer dungeon and the undead faction. His script below governs what happens when he dies, triggers a conversation if the player gets within 200 units of him (only once) and checks for conditions in order to tell him to cast a certain script spell (conditions are set true by the conversation). He casts the spell which basically places 3 skeleton soldiers who are scaled to character level. He stands back and fights from afar and eventually rushes in and joins the fray...

 

Here's my problem: If you walk in and stand within 500 units (but outside of 200), it sometimes takes a few seconds and then he gets up, rushes you, yells at you, then ends the conversation himself and casts the spell which places 3 skeletons who are friendly to him. All fine and good. However, if you rush him before the package for him to rush you executes, then he starts conversation when in range and then stands up and casts the spell, but nothing appears as a result.

 

In the code below you will see I commented out one segment which is the "placeatme" option which if left in the code, will cause 6 skeletons to summon if you allow the NPC to approach you before rushing him.

 

So what is causing this? Why doesn't the code work when you approach him before he starts to approach you?

 

Begin OnDeath

CRMOSbookref.enable
crmosbookfire.enable
crmosbookfire2.enable

end

Begin GameMode

If Talkstate == 0
if CRdrakeburnREF.getdistance player < 200
	StartConversation player
	set talkstate to 1
endif
endif

If caststate == 0
If CRdrakeburnREF.getdisposition player == 0 && CRdrakeburnREF.getav aggression == 50      ; these are set at the shown values by the conversation
	CRdrakeburnREF.cast CRdrakeburnsummon CRdrakeburnref
	;CRdrakeburnREF.placeatme CRCreatureSkeleton2 3, -200, 1
	set caststate to 1
endif
endif
end

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...