How does the EvaluatePackage function work?

Post » Sat Nov 22, 2014 8:31 am

I'm working on a quest in which the player has to release some prisoners from their jail cells. I found a vanilla script that I think will work, but I'm not sure how the EvaluatePackage function works. I placed a package on each prisoner to keep them in their cells, and I want them to escape when released. I know I need to add a travel package to them so they will leave the jail, but I'm not sure how to stop the first package and then start the travel package.

Here is the script I am planning to use.

Spoiler
Scriptname defaultPrisonerDoorSCRIPT extends ObjectReference  {Default script on a door, that's linked to a prisoner, to handle his factions.}import gameimport utilityimport debugFaction Property dunPrisonerFaction AutoObjectReference Property Prisoner01 AutoObjectReference Property Prisoner02 AutoObjectReference Property Prisoner03 AutoObjectReference Property Prisoner04 AutoObjectReference Property Prisoner05 AutoObjectReference Property Prisoner06 AutoObjectReference Property PrisonerLink Auto Hiddenbool Property AlreadyLoaded Auto HiddenEVENT OnLoad()	if AlreadyLoaded == FALSE		if Prisoner01			(Prisoner01 as Actor).AddToFaction(dunPrisonerFaction)		endif		if Prisoner02			(Prisoner02 as Actor).AddToFaction(dunPrisonerFaction)		endif		if Prisoner03			(Prisoner03 as Actor).AddToFaction(dunPrisonerFaction)		endif		if Prisoner04			(Prisoner04 as Actor).AddToFaction(dunPrisonerFaction)		endif		if Prisoner05			(Prisoner05 as Actor).AddToFaction(dunPrisonerFaction)		endif		if Prisoner06			(Prisoner06 as Actor).AddToFaction(dunPrisonerFaction)		endif				PrisonerLink = GetLinkedRef()		if PrisonerLink			(PrisonerLink as Actor).AddToFaction(dunPrisonerFaction)		endif			endif	AlreadyLoaded = TRUEEndEVENT	Auto STATE WaitingToBeOpened	EVENT OnOpen (ObjectReference triggerRef)		if Prisoner01			(Prisoner01 as Actor).RemoveFromFaction(dunPrisonerFaction)			Utility.Wait(0.1)			(Prisoner01 as Actor).EvaluatePackage()		endif		if Prisoner02			(Prisoner02 as Actor).RemoveFromFaction(dunPrisonerFaction)			Utility.Wait(0.1)			(Prisoner02 as Actor).EvaluatePackage()		endif		if Prisoner03			(Prisoner03 as Actor).RemoveFromFaction(dunPrisonerFaction)			Utility.Wait(0.1)			(Prisoner03 as Actor).EvaluatePackage()		endif		if Prisoner04			(Prisoner04 as Actor).RemoveFromFaction(dunPrisonerFaction)			Utility.Wait(0.1)			(Prisoner04 as Actor).EvaluatePackage()		endif		if Prisoner05			(Prisoner05 as Actor).RemoveFromFaction(dunPrisonerFaction)			Utility.Wait(0.1)			(Prisoner05 as Actor).EvaluatePackage()		endif		if Prisoner06			(Prisoner06 as Actor).RemoveFromFaction(dunPrisonerFaction)			Utility.Wait(0.1)			(Prisoner06 as Actor).EvaluatePackage()		endif				if PrisonerLink			(PrisonerLink as Actor).RemoveFromFaction(dunPrisonerFaction)			Utility.Wait(0.1)			(PrisonerLink as Actor).EvaluatePackage()		endif				GoToState("AlreadyOpened")	EndEVENTendSTATESTATE AlreadyOpened	;do nothingEndSTATE

I have checked the forums, CK Wiki pages, and Googled the EvaluatePackage function and can't find any info on how it works or how to set it up. I even checked the quests in the CK that use this script and got nowhere.

If anyone has any suggestions on how it works or where I can find the Information it would be greatly appreciated.

User avatar
Elisha KIng
 
Posts: 3285
Joined: Sat Aug 18, 2007 12:18 am

Post » Sat Nov 22, 2014 3:02 am

there's no setting up about it.

you just call evp, and the actor will re-evaluate his package stack.

meaning: first package (from top down) in his package list that's conditions are met will run.

packages normally are on the base actor (these can get overridden by alias packages/stacks, which again can be overridden by scene packages)

edit: i can hear your script's actors screaming "put us into an array! put us into an array!" :-)

(like this: Actor [] Property Prisoner Auto

and add an Int Counter variable,

then you can just go

Counter = Prisoner.Length

While ( Counter > 0 )

Counter -= 1

Prisoner [ Counter ].RemoveFromFaction (...)

Prisoner [ Counter ].EvaluatePackage ()

endWhile

User avatar
zoe
 
Posts: 3298
Joined: Sun Nov 12, 2006 1:09 pm

Post » Fri Nov 21, 2014 9:03 pm

Ok maybe I asked the question wrong. I understand how the package stack works from top to bottom. But if a package is running to keep the prisoners in their jail cells, that is valid right now, when I open the jail doors, how do I tell the next package to run and ignore the first package, the first package would still be valid also because it is attached to the actor. Would it be better if I used a Alias_Package attached to the quest to keep the prisoners in the cell, then disable the Alias with a SetStage or ObjectiveCompleted, and call the EvaluatePackage function after the door is opened?

EDIT: I just reread your post. Think I answered my own question.

User avatar
Franko AlVarado
 
Posts: 3473
Joined: Sun Nov 18, 2007 7:49 pm

Post » Sat Nov 22, 2014 9:35 am

well then... :-)

User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Sat Nov 22, 2014 3:27 am


Thanks

User avatar
Eve Booker
 
Posts: 3300
Joined: Thu Jul 20, 2006 7:53 pm

Post » Sat Nov 22, 2014 9:02 am

To summarize EVP: Packages are evaluated only every ~10 seconds or so. Calling EVP forces the actor to re-evaluate them the next tick, which can prevent delays caused by this ~10 second interval.

User avatar
suniti
 
Posts: 3176
Joined: Mon Sep 25, 2006 4:22 pm

Post » Sat Nov 22, 2014 1:49 am

Usually it's just a case of making sure that only package at a time is valid. For example, set the condition on the "remain in cell" one to be "door is locked" or something like that, so you don't have the problem of them going back into the cell later. Hooking an EVP to the cell door just makes sure they notice.

Usually you only want to rely on package priority for situations where a character has a "normal" activity that gets interrupted by something more urgent, and they'll just go back to it after the interruption.
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am

Post » Sat Nov 22, 2014 2:19 am

All I want to do is have the prisoners in the cell to be released by the player to add some immersion to the quest. Once the "prisoners" are released I want to set them to rally to some point out of play and will be disabled at the end of the quest stage as they will no longer have a purpose (sounds cruel, but it is only a game), or I could just let them wander aimlessly about the Island or perhaps use them to populate a new area on the island IDK haven't worked out all the details yet.

Thank you to all of you for your input and advice. If you have any Ideas I'm open for suggestions.

User avatar
JUan Martinez
 
Posts: 3552
Joined: Tue Oct 16, 2007 7:12 am


Return to V - Skyrim