Jump to content

Quest Script stops working


Lord Yalet

Recommended Posts

I was writing a quest script. target and agent represent two npc's, whose references are assigned using a scripted spell. agent should attack target, but, in order not to get the guards attack him, i stated that he would have come near to his target using a Follow Package. To determine target's location, in the quest script, an invisible marker is moved to its position, refreshing the command every 5 seconds. In that way, agent should move until he reaches a certain position, very near to target, and then he should attack him. As you can se from the scripts, there are many debug messages.

But once agent has reached the marker, he stops there: this is not surprising me, since the marker is the location he must have followed. The strange thing is that the marker is 300 units far from target, i.e. from the point in which it should have been. Moreover, once he has completed his Follow Package, the whole quest script stops. I infer this from a simple observation: debug messages are no longer displayed. A quest script shouldn't stop while the quest is running (and it is):

scn TotemListenerScript

ref target
ref agent
short isfighting

begin GameMode
  if (target != 0)
  if (target.getdead == 1)
	 Message "Il bersaglio che avevi designato è stato ucciso!"
	 set target to 0
	 set isfighting to 0
  else
	 TotemObj1.MoveTo target
	 message "Posizion bersaglio reimpostata!"
  endif
  else
  set isfighting to 0
  endif
  
  if (agent != 0)
  if (agent.getdead == 1)
	 Message "L'agente che avevi mandato in missione è morto."   
	 set agent to 0
	 set isfighting to 0
  else
	 if (target != 0)
		if (agent.GetDistance target < 150)
		   agent.RemoveScriptPackage
		   agent.StartCombat target
		   set isfighting to 1
		else
		   message "Dist>15"
		endif
	 else
		if (agent.GetIsCurrentPackage TotemFindTarget == 0)
		  ;agent.RemoveScriptPackage
		   message "P div"
		endif
	 endif
  endif
  else
  set isfighting to 0
  endif

  message "nessuna condizione"
end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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