Story Manager and Remove Item

Post » Thu Jun 21, 2012 10:48 am

Hi there,

After reading the replies to http://www.gamesas.com/topic/1380940-changes-in-remove-item-code-16/, I start a new thread seeking some enlightement when transforming my Quest+PlayerAlias+OnItemRemoved() event into a Story Manager event (a feature I never used before). I checked some wikis and viewed some tutorials, but all is confusing, so I just decided to do some tests, see what happens, and try to learn.

Yesterday I did the following:
- Opened the SM Event tree and added a new entry on the Player Remove Item section.
- Created a new Quest, with no player alias, enabling it by Remove Item, and added a script to the Scripts tab.
- Added a Debug.Messagebox saying "hello" in this same script, under the StoryRemoveItem event (can't remember the exact name now). Added a "Stop()" as the last line of this event, because I read that the Quest needs to be stopped for it to repeat.

Well, the following happens: I drop items randomly, and sometimes I see the Hello message, sometimes I don't. I noticed that the message appears only after closing the inventory, so I have to drop items one by one.

I just don't understand what am I missing, as I'm new to this SM thing... until now I always worked with the PlayerAlias, but as I say in the post I linked, it started to act weirdly with the 1.6 beta patch, so I think switching to SM is the best option.

Thanks in advance for any help.
User avatar
James Wilson
 
Posts: 3457
Joined: Mon Nov 12, 2007 12:51 pm

Post » Thu Jun 21, 2012 6:28 pm

Did you drag your quest node up to the top (with Shares event checked)? There could be some non-sharing quests that randomly beat your quest to it, otherwise.
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Thu Jun 21, 2012 5:16 pm

Did you drag your quest node up to the top (with Shares event checked)? There could be some non-sharing quests that randomly beat your quest to it, otherwise.

I moved it to the top, yes, but I didn't check the "Shares Event" checkbox on the top level. I tried now, and still the same. I also tried switching from "Random" to "Stacked", just in case, but same happens.

Also, I eat all the food in my inventory, and the message box doesn't appear at all. Instead, if I drop my items to the floor (one by one, and closing inventory for each one), I get the message box randomly.

Completely lost here....

Oh, this is my quest, by the way:

Scriptname KCHSM extends Quest Event OnStoryRemoveFromPlayer(ObjectReference akOwner, ObjectReference akItem, Location akLocation, Form akItemBase, int aiRemoveType)Debug.MessageBox("Hola!")Stop()EndEvent

Only configuration is at "Quest Data" tab:
Priority: 20
Event: Player Remove Item

Thanks again.
User avatar
Eddie Howe
 
Posts: 3448
Joined: Sat Jun 30, 2007 6:06 am

Post » Thu Jun 21, 2012 1:29 pm

Well, almost got it working...

I created a new Branch Node. Initially I placed my quest under the existing "Random Branch" node. So after setting my node as Stacked and putting it on top, I got the messagebox everytime I removed an item from my inventory.

BUT, now the problem is that it doesn't show any messagebox if I actually consume an item, which is the only thing I need to check. I even placed a condition ("if aiRemoveType==2"), and doesn't trigger at all.

It looks like the event isn't triggered when player consumes an item from the inventory.

Also, it doesn't make any sense to get the messagebox once the player closes the inventory... what if I drop 7 different items? How can I control them one by one?
User avatar
Bambi
 
Posts: 3380
Joined: Tue Jan 30, 2007 1:20 pm

Post » Thu Jun 21, 2012 2:36 pm

Hi,

Any help on this? I still can't make this even to run without closing the inventory, or when the item is consumed... it only runs when I drop an item, and then close the inventory.

Thanks.
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Fri Jun 22, 2012 12:28 am

Based on what you are expecting your script to do, the OnItemRemoved story event is probably not right for you.

Your observations on how the system works are correct. If the player drops an item, OnPlayerDropItem() doesn't register until they leave the inventory screen. This story event is more to register a player dropping a valuable item in the world (so that other actors can react to it)

If you want to know when your item was consumed (and not just dropped/destroyed) why not just put a unique magic effect on the item? Then in the magic effects event 'oneffectstart' you can put your code.

E.G.
Event OnEffectStart(Actor akTarget, Actor akCaster)if (akTarget ==game.getplayer());this code will fire when the player consumes an item with this magic effectendifendevent
User avatar
Trish
 
Posts: 3332
Joined: Fri Feb 23, 2007 9:00 am

Post » Thu Jun 21, 2012 2:51 pm

I appreciate your input Jediborg, but I'm not sure this is the right way.

I switched from Quest+PlayerAlias to SM because it was supposed to be how it should be done, and now I find this. I have an event with parameters like "destination container" or "remove type", and the event doesn't trigger if I put (remove) the items into a chest (destionation container?) or if I consume them (remove type?). So, what are these event parameters for then?

Adding this onEffectStart property, even if I end up doing it like this, is even a "dirtier" way of fixing this than using a quest+player alias, as I did before (until it got fixed and broken in 1.6). Until 1.5 I just followed an event for "removed item" in a player alias. Now I try it in the SM, and it doesn't work at all.

I don't know.. I'm pretty sure I'm missing something important to make it work, because it doesn't make any sense to have all those parameters, if the event is not triggered. It should be triggered in ANY remove item (moved to container, sold, consumed...)
User avatar
Lauren Denman
 
Posts: 3382
Joined: Fri Jun 16, 2006 10:29 am

Post » Thu Jun 21, 2012 11:20 pm

Two points:

1) If you insist on trying to continue doing this the 'proper' way: Instead of triggering the messagebox from the onstoryremovefromplayer()
script event, you should trigger the message box from stage 0 of your quest. Your quest should be started automatically when the player removes the item, and stage0 function may be called before/more reliably than the onstoryremovefromplayer() event. Any conditions on whether the quest is started should be on the quest node in the Story Manager, not in the script of the quest (because that is run after the quest eats the event)

2) There is a well-known phrase amongst programmers: 'TMTOWTDI' which is an acronym for 'There's more than one way to do it'
I actually think the activemagiceffect route is the cleanest way to go about this (since the playeralias+quest script route was broken)
If you can get the SM to do what you want, that's great. But it was created to serve a certain purpose and that purpose might not align with the purpose you want to use the SM for. I don't know of any examples (CK isn't in front of me ATM) where vanilla skyrim triggers an 'onstoryitemremoved' event quest when a player eats a food/potion/item. All the existing examples are for when an item is dropped in the physical world.

Now you can argue all day about how a CK feature 'should' work, lord know's I've had my tangents of yelling at the CK about how it should really be working, and how the implementation in my head is much better than what's actually there, but at the end of the day, since we don't have source code, you have to understand how it DOES work and work around those limitations.
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Fri Jun 22, 2012 12:31 am

(...)
2) There is a well-known phrase amongst programmers: 'TMTOWTDI' which is an acronym for 'There's more than one way to do it'
(...)

:biggrin: Yeah, I'm usually one that uses to do stuff in its own way, instead the way its "supposed" to be done.

Anyway, I will do some more tests here and there. Right now I don't think the magic effect event is doable for me, because I would have to set it to a lot of items:

- Usable barrels mod:
All alcoholig beverages (4 types of wine, mead, honningbrew, etc...), and also their empty version.

- Refilable potions:
All the potion sizes for heal, stamina and mana (small, normal, plentiful...), and also their empty version.

I know it's the kind of work that can be hard to do but, once done, is done, and if I design the functions properly, it shouldn't be much a pain to edit. But right now for each mod I have the control of all the items inside one single ItemRemoved event (if item type is this, do this stuff, etc..).

I'll come back with an update if I ever get this fixed.
User avatar
Louise Dennis
 
Posts: 3489
Joined: Fri Mar 02, 2007 9:23 pm


Return to V - Skyrim