Jump to content

Ending a patrol package? : <


ObLars

Recommended Posts

Hi. I made a patrol package for a NPC i just created, he follows the xmarkers just okai, but when he reaches the last Xmarker he just continues back, to the start Xmarker. I want him to end his Patrol package at the last Xmarker, to go into a Sandbox Package. How can i do this? Is it possible to do this via a script? I know i can add a script to the Xmarkers.

 

Maybe like "End package" script? Or something?

Link to comment
Share on other sites

Hi. I made a patrol package for a NPC i just created, he follows the xmarkers just okai, but when he reaches the last Xmarker he just continues back, to the start Xmarker. I want him to end his Patrol package at the last Xmarker, to go into a Sandbox Package. How can i do this? Is it possible to do this via a script? I know i can add a script to the Xmarkers.

 

Maybe like "End package" script? Or something?

 

Do you have a condition on your patrol package? In the 'package end' script of the patrol package, you can set the condition for that package to 'off', then evp the NPC. Then if you have a sandbox package under that with no conditions, it will just start.

 

Assuming you declared a variable on your NPC script and gave your NPC a RefID of MyNPCRef

 

short MyConditionForPatrol

 

set MyNPCRef.MyConditionForPatrol to 0
MyNPCRef.evp

 

Or you can have a trigger at the patrol ending location with a script on it, which will probably be more reliable:

 

ONTriggerEnter MyNPCRef

set MyNPCRef.MyConditionForPatrol to 0
MyNPCRef.evp

END

Link to comment
Share on other sites

Hi. I made a patrol package for a NPC i just created, he follows the xmarkers just okai, but when he reaches the last Xmarker he just continues back, to the start Xmarker. I want him to end his Patrol package at the last Xmarker, to go into a Sandbox Package. How can i do this? Is it possible to do this via a script? I know i can add a script to the Xmarkers.

 

Maybe like "End package" script? Or something?

 

Do you have a condition on your patrol package? In the 'package end' script of the patrol package, you can set the condition for that package to 'off', then evp the NPC. Then if you have a sandbox package under that with no conditions, it will just start.

 

Assuming you declared a variable on your NPC script and gave your NPC a RefID of MyNPCRef

 

short MyConditionForPatrol

 

set MyNPCRef.MyConditionForPatrol to 0
MyNPCRef.evp

 

Or you can have a trigger at the patrol ending location with a script on it, which will probably be more reliable:

 

ONTriggerEnter MyNPCRef

set MyNPCRef.MyConditionForPatrol to 0
MyNPCRef.evp

END

 

 

Thanks for response :) No, i didn't do anything with conditions etc. I just added a patrol package to him with a Start destination and the markers do the rest.

 

I guess this;

 

ONTriggerEnter MyNPCRef

set MyNPCRef.MyConditionForPatrol to 0
MyNPCRef.evp

END

 

Would do the job. But what do you mean with Myconditionforpatrol to 0? :P And is this supposed to be at the end script of the patrol package? Sorry if im being a noob. :P

Edited by ObLars
Link to comment
Share on other sites

There's a few ways to do it.

 

Add a SandBox and Patrol package to him.

 

Edit > myNPCREF > Edit (make sure Reference Editor ID is "myNPCREF" or something > Edit Base > Script

scn myNPCSCRIPT

short patrolBegin   ;0 = false. 1 = true. Default is 0.
short doOnce

BEGIN GameMode

if doOnce == 0
	set patrolBegin to 1
	set doOnce to 1
endif

END

 

Create a Trigger (cubic activator button). Put it over the last xmarker. Attach this script.

scn myTriggerSCRIPT

BEGIN OnTriggerEnter myNPCREF

set myNPCREF.patrolBegin to 0

END

 

Edit SandBoxPackage > Conditions > New > GetScriptVariable Cell/NPCReferenceID patrolBegin == 0

(if patrolBegin == 0, do the SandBoxPackage)

 

Edit PatrolPackage > Conditions > New > GetScriptVariable Cell/NPCReferenceID patrolBegin == 1

(if patrolBegin == 1, do the PatrolPackage)

 

If you have the PatrolPackage at the top of the packages list, maybe you can get away with removing the GameMode block which would help performance. Script inside GameMode runs every 5 seconds. Change the variable to patrolEnd, and change the trigger script to "set myNPCREF.patrolEnd to 1", and change the package condition.

Edited by st4rdog
Link to comment
Share on other sites

  • Recently Browsing   0 members

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