Help with player Alias, OnItemRemoved...

Post » Tue Jun 19, 2012 10:04 am

Hi there,

The thing is that even if I read the CK and a few posts around here talking about OnItemRemoved and other "player alias" stuff, I'm not able to figure out where do I add these events.

I mean, there are events to detect if a player sleeps, changes location, picks an item, etc... Where do I attach those events?. I read people say things like "just attach this and that to the player...", and I'm completely lost.

Also, I just want to check if the player consumes 4 types of potions. Does this mean that this 4 conditions get run everytime the player drops an item?

Thanks in advance,
Regards.
User avatar
Zach Hunter
 
Posts: 3444
Joined: Wed Aug 08, 2007 3:26 pm

Post » Tue Jun 19, 2012 11:57 pm

Aliases are created through the quest editor, and essentially they are collections of scripts, ai packages, factions, etc. that can be added to an actor. The way I think of it is that instead of giving an NPC or object a lot of individual items and characteristics, you give the NPC a bag filled with all of it at once. It also makes it easier to take that bag from one NPC and give it to another. It's supposed to be a time-saver (and it is, usually!), but so much of the CK is structured around it that it's almost impossible to attach and remove things from actors and objects the old-fashioned way.

I've worked with aliases, but I've never assigned one to the PC. I thought for a bit about where you might look, and you might look at the Quest C03Rampage (It's a spoiler if you haven't played through the Companions quest line!) Take a look at the Alias called Player under Quest Aliases, and you'll see that all it does is assign a script to the player that keeps track of the players health which will trigger the next stage of the quest. I don't know if that's the best example, but it might give you a start.

Even if it won't be a quest that the player sees in the journal, the quest editor is the best way to keep track of things that have stages. I could imagine a hunger mod, for example that would assign certain effects to a player through aliases as the player advanced through certain stages of hunger. The system has more advantages than disadvantages in my opinion, but it takes some getting used to.
User avatar
Chris Ellis
 
Posts: 3447
Joined: Thu Jul 26, 2007 10:00 am

Post » Tue Jun 19, 2012 7:56 pm

Thanks for your detailed reply Qutayba7, I'll take a look at that quest once I get home from work. I played the companions, and if the quest checks the player's health as you say, I think I know which one is it.

Knowin this, maybe one option is that I create a "dummy" quest, and attach the scripts there, and at same time create some phases that add a bit of content. If I think on an idea that makes sense, I might do it this way.. anyway I hope that there is an option to add these type of scripts in a global way, instead of inside a quest.
User avatar
Nomee
 
Posts: 3382
Joined: Thu May 24, 2007 5:18 pm

Post » Tue Jun 19, 2012 5:38 pm

If you add scripts to the player through a quest alias, those scripts will probably stay on the player until you clear them. Also take a look at the early stages of the Main Quest (esp 101) which I think sets up some long term effects on the player. There are dozens of quests running in the background during the game keeping track of all kinds of things the player never really sees.
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am

Post » Tue Jun 19, 2012 3:17 pm

Hi again,

Well, I'm completely lost here, so any help will be appreciated.

This is what I tried:

- Duplicated the "AchievementsQuest" quest, which is supposed to keep track of things done by the player (kill X creatures, craft X weapons, etc.)
- I removed the attached scripts.
- I added a new script with the following:

Scriptname prueba extends QuestEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)    Debug.Notification("Ha!!")endEvent

I tried both "extends Actor" and "extends Quest", just in case. No result at all.

The quest properties are identical to the Achievement's one. Is "Start Game Enabled".

I also tried opening a mod I have installed ("Auto Unequip Arrows"), adding my script to the same place where the author attached his script. Same result: nothing.

I just want to add a simple OnItemRemoved listener event... it can't be so hard. :wallbash:

Thanks for any help!
User avatar
Cartoon
 
Posts: 3350
Joined: Mon Jun 25, 2007 4:31 pm

Post » Tue Jun 19, 2012 12:56 pm

Your script will need to extend ReferenceAlias, not Quest or Actor. It should be attached to a Reference Alias (naturally), that is filled by a Specific Reference, namely the Player.

In other words, if you look at the screenshot of the Reference Alias window on http://www.creationkit.com/Bethesda_Tutorial_Quest_Aliases, "Specific Reference" will be selected and then you choose PlayerRef for "Select Forced Reference," and then your script should be created over in the box to the right.

Hopefully that makes sense conceptually. You're creating an alias for the player, and then attaching your script to that alias. The advantages of this system are that 1) you can turn on and off your script as needed and 2) other mods can also create scripts attached to their own aliases of the player without conflicting with your mod.
User avatar
Krista Belle Davis
 
Posts: 3405
Joined: Tue Aug 22, 2006 3:00 am

Post » Tue Jun 19, 2012 9:31 pm

Thanks DreamKing!

Finally I managed to do it. As you said, it was just as easy as creating a quest, creating the reference alias for the player inside it, and attaching the script there. No way I could have find all those windows and subwindows myself anytime soon, anyway. I also had to read a couple CK pages from previous steps from the link you posted.

Now, both on item added and on item removed events have been detected successfully. Now I can sleep peacefully. :biggrin:
User avatar
BEl J
 
Posts: 3397
Joined: Tue Feb 13, 2007 8:12 am


Return to V - Skyrim