Store a reference permanently...

Post » Thu Jun 21, 2012 7:22 pm

Hello again, forum of knowledge!

So I have a challenging dilemma, and I'm still a little fuzzy on the details so let me just jump right into it.

*EDIT: See 2nd post for progress...

What I am trying to do is store an NPC reference for later use and manipulation. By later I mean like even after the game has been saved/reloaded.

The only way I can imagine to do this is through the use of a quest alias.

Ingenue had an interesting idea over on http://www.gamesas.com/topic/1373542-how-do-you-addscriptpackage-now/page__view__findpost__p__20765624 thread:

Or make the quest start from a script event so you can send the NPC as a parameter:

MyKeyword.SendStoryEvent(akRef1 = someNPCref)

and then use Find matching reference: From event to assign the alias.

In theory that seems like it might work. I am not sure if quest aliases are saved so long as the quest stays running though, like if one died I could just put it in a temporary cell that never reset and bring it back with MoveTo and resurrect?


EDIT: Reading http://www.creationkit.com/Story_Manager and http://www.creationkit.com/SM_Event_Node now, maybe I'll figure it out after all.
User avatar
sarah simon-rogaume
 
Posts: 3383
Joined: Thu Mar 15, 2007 4:41 am

Post » Thu Jun 21, 2012 8:30 am

OK, a bit of an update...

Following the Ingenue's outline I created the following on my spell:

Scriptname phitamecastS extends ActiveMagicEffectKeyword Property phi_s1_p1 autoEvent OnEffectStart(Actor akTarget, Actor akCaster)	phi_s1_p1.SendStoryEvent(akRef1 = akTarget)EndEvent

In the magic effect window where you can manually select properties for an attached script, I set the keyword "phi_s1_p1" to one by the same name I created in the editor.

I created a new quest (called phi_slot1_pos1), set NOT to start with game, and set the "Event" on the Quest Data tab to "Script Event."

Then on the "SM Event Node" section of the editor (under Characters), I went into Script Event, and at the top level right-clicked on "Stacked Event Node: Script Event" and clicked "New Quest Node." I named this "phi_s1_p1ev."

Under conditions I right-clicked again and selected New, then for the Condition Function I selected "GetEventData" then clicked the button to the right and selected "GetIsID" then Keyword and finally my "phi_s1_p1" keyword.

I then right-click on my quest node and click "Add Quests," and selected my "phi_slot1_pos1" quest, then hit OK up at the top right.

Then I went back and opened the "phi_slot1_pos1" quest again. On the Quest Stages tab I made a quest stage 0 and set it to the Start Up Stage. I then created a stage 10 and set it to the Shut Down Stage and made a fragment with "Stop()" in it.

Finally I went to the Aliases tab and created an alias called "phi_s1_p1a" with Fill Type set to "Find Matching Reference" and "From Event" checked, Script Effect was now automatically selected and I was able to choose Ref 1 for the Event Data.

This all seems right (and rather cool) to me, however, when I cast the spell I can't tell if anything happened...

I tried putting that alias in all the player factions and giving it a "must complete" package to follow the player, but it just keeps attacking me, telling me something is probably not getting set right.
User avatar
Suzie Dalziel
 
Posts: 3443
Joined: Thu Jun 15, 2006 8:19 pm

Post » Thu Jun 21, 2012 5:46 pm

CORRECTION: The procedure described in the above post DOES set the alias!

In my follow player package I set "Must Complete", "Allow Swimming", "Ignore Combat", and "World Interaction" as the only boxes checked. By setting ignore combat the target did indeed stop attacking me (though the in-combat keeps them targeted in the HUD), so it seems like just a matter of messing with override packages...
User avatar
Budgie
 
Posts: 3518
Joined: Sat Oct 14, 2006 2:26 pm

Post » Thu Jun 21, 2012 1:30 pm

For anyone that finds this thread, the magic mojo that I worked to get a clean state on my alias (no potential hostilities) was to modify my script like so:

Scriptname phitamecastS extends ActiveMagicEffectKeyword Property phi_s1_p1 autoEvent OnEffectStart(Actor akTarget, Actor akCaster)    akTarget.RemoveFromAllFactions()    akTarget.StopCombatAlarm()    Game.GetPlayer().StopCombatAlarm()    phi_s1_p1.SendStoryEvent(akRef1 = akTarget)EndEvent

This stops combat for both the target and the player (to also remove the combat HUD), and removes the target from all factions (like creature factions) BEFORE sending it to the alias by the steps I outlined above.

After that, I didn't need to check the "Ignore Combat" option in my FollowPlayer package. I just added all the player factions to the alias, and the target follows me, and engages in defensive combat when something attacks me, or assists when I attack.
User avatar
Ashley Campos
 
Posts: 3415
Joined: Fri Sep 22, 2006 9:03 pm


Return to V - Skyrim