theseventhdog Posted August 13, 2018 Share Posted August 13, 2018 What I'm trying to do is that whenever the player adds something to his inventory (picking items up from the world, buying from vendors etc.) a script checks if he gets over encumbered. If so he should drop random items from his inventory until he falls under his maximum carry weight again (like he's losing stuff because he can't hold or balance it any more).I've studied the Creation Kit Wiki and the forums here for the past days and figured that a reference alias script was probably the way to go. I set something up, but as this is the first time I'm trying something like this I don't REALLY know what I'm doing. The mod doesn't do anything in game, maybe someone here can tell from the screenshots what I've done wrong (if the error lies within the script or with the way I set up the quest) and give me some step-by-step advice. Thanks! And the code again: ---------------------------------------------------------------------------------------Scriptname Overencumbrance extends ReferenceAliasActor Property PlayerRef AutoEvent OnInit() AddInventoryEventFilter(none)EndEventEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) While (PlayerRef.IsOverEncumbered()) PlayerRef.DropFirstObject() EndWhileEndEvent--------------------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
GePalladium Posted August 14, 2018 Share Posted August 14, 2018 (edited) This idea is funny, so I took a look.I tested it, it works, but I made it a compeletly different way. I made a new quest: In Quest Data:ID TheDropQuestPriority 3 (not sure but it works)Event Player Add ItemAllow repeated stages checked (nothing else check, no quest alias) In Quest StagesCreate a new stage:Index 0 Run on Start checked Papyrus Fragment:Create one new quest property:TheDropQuest(don't add the player, Game.GetPlayer() works without property) If Game.GetPlayer().isoverencumbered() Game.GetPlayer().DropFirstObject()endifTheDropQuest.SetStage(10) Then create another stage:Index 10 Papyrus Fragment: If Game.GetPlayer().isoverencumbered() TheDropQuest.SetStage(0)else TheDropQuest.Stop()endif That way the script will return until the player isn't over encumbered anymore, once this done, the quest will stop. Then you need to add your quest to the SM Event NodeSection Player Add ItemOpen the window, right clic on stacked event Node: Player AddItem on the top of the list.Hit New Branch NodeGive it the ID TheDropQuestBranchNodeThen right clic On that new branch node you just createdHit New Quest NodeGive it the ID TheDropQuestNodeThen right clic On that quest node you just createdHit Add QuestAdd your quest, No condition are needed. That's all. Edited August 14, 2018 by GePalladium Link to comment Share on other sites More sharing options...
theseventhdog Posted August 15, 2018 Author Share Posted August 15, 2018 Hey Palladium, thanks for your help! I followed your guide and it really works. BUT I found out that after reinstalling the game, Creation Kit and the Script Extender my version suddenly worked too. I must have messed up my installation somehow. So I'll playtest both mods to see if one is causing any issues. Anyway, your help's much appreciated, you've done this in a way I would have never considered, and I think I've learned a thing or two by following you along. One last thing that bugs me a bit though is that 'DropFirstObject()' doesn't really randomly drop items. As described in the Wiki: 'The definition of "first" is up to the code, and so this basically drops a random object. However it does it in such a manner that, if called multiple times, is likely to repeatedly drop the same kind of object until that object's stack is exhausted before moving onto the "next" stack.' Link to comment Share on other sites More sharing options...
GePalladium Posted August 15, 2018 Share Posted August 15, 2018 (edited) Yeah, I'm not surprise, while testing, I noticed I was only dropping objects stack by stack, first food then junk. I was actually happy to notice weapons and amors were not in the first stack. This mod is a weird idea. I wonder what you'll do with it. I'll wait for the surprise. I'm happy your quest worked. There is always 10 different ways to do the same thing.I learnt it's better to avoid (when it's possible) the quests that are running all the time. The story manager is great for that: It starts the quest only when needed. That's a new feature in the CK. Edited August 15, 2018 by GePalladium Link to comment Share on other sites More sharing options...
theseventhdog Posted August 15, 2018 Author Share Posted August 15, 2018 Well, it's intended just as a small mod altering the way carry weight is handled. Unfortunately when I tested it my character always threw away weapons and armor first. I have no problem with weapons slipping out of my hand (that seems somewhat logical when you have to balance a lot of stuff), but me standing there in my underwear just because I picked up an aluminium can could be seen as slightly unimmersive :-) So if I can't resolve this in some way I don't know if I'll persue this further. Maybe I'll have to come back to it when I know my way around scripting and the Creation Kit a bit better. Link to comment Share on other sites More sharing options...
Recommended Posts