gerg357 Posted August 30, 2016 Share Posted August 30, 2016 Im running a script that i made/edited that will drop a random item from a leveled list if certain conditions are met.. Im wondering if maybe its the placeatme thats causing the issue here is my codeScriptname CreateclothesScript extends ObjectReferenceLeveledItem Property ClothesFarm AutoLeveledItem Property LItemClothesFarmAll AutoLeveledItem Property LItemClothesRegular AutoLeveledItem Property LItemClothesWork AutoLeveledItem Property LItemClothesAll AutoLeveledItem Property LItemFineClothes50 AutoMessage Property lackmaterials AutoMessage Property failure AutoGlobalVariable Property dlinen AutoGlobalVariable Property tailorthread AutoGlobalVariable Property tailorneedles AutoObjectReference Property clothesplace AutoEvent OnActivate(ObjectReference akActionRef)if akActionRef != Game.GetPlayer() ; do not let other NPCs trigger this return endif if (tailorthread.GetValue() >= 5 && tailorneedles.GetValue() >= 1 && dlinen.GetValue() >= 5) dlinen.SetValue(dlinen.GetValue() - 5) tailorthread.SetValue(tailorthread.GetValue() - 5) int random = Utility.RandomInt(0, 5) If random == 0 clothesplace.PlaceAtMe(ClothesFarm,1) elseif random == 1 clothesplace.PlaceAtMe(LItemClothesFarmAll,1) elseif random == 2 clothesplace.PlaceAtMe(LItemClothesRegular,1) elseif random == 3 clothesplace.PlaceAtMe(LItemClothesWork,1) elseif random == 4 clothesplace.PlaceAtMe(LItemClothesAll,1) elseif random == 5 clothesplace.PlaceAtMe(LItemFineClothes50,1) else failure.Show() endif else lackmaterials.Show() endif EndEvent what its doing is its creating stuff fine but then it makes boots. Once i pick them up it just spams stuff at the spawn point.. Im guessing i should maybe use a chest to put this in since picking up the boots is causing the glitch... ?? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 31, 2016 Share Posted August 31, 2016 I don't see any reason for your script to be spamming items. Its clearly designed to place one item per activation. What is the script attached to? Could it be possible that you over activated the object and thus built up a queue of items to be spawned? The only other thing I could think of is something going wonky with the leveled item selection process and multiple items are chosen instead of just one. You could make sure that your leveled item list is properly spread out among levels instead of a whole bunch at one level. Side note:Its one thing to use SetValue() when you want to ensure that the global variable is at a specific value, i.e. setting user selected values in an MCM script. But when you are going to be modifying the value by a set amount its better to use Mod(). For example, dlinen.SetValue(dlinen.GetValue() - 5) would become dlinen.Mod(-5). Link to comment Share on other sites More sharing options...
gerg357 Posted August 31, 2016 Author Share Posted August 31, 2016 What's funny is it will spawn a pair of boots when I pick the boots up then it goes to spawning stuff like a flood of stuff Link to comment Share on other sites More sharing options...
gerg357 Posted August 31, 2016 Author Share Posted August 31, 2016 Thanks for that info I'll use thar from now on Link to comment Share on other sites More sharing options...
NexusComa Posted August 31, 2016 Share Posted August 31, 2016 what is kicking off the OnActivateif it's a box then yes it will keep spawning items the way you got it set up. for a box trigger you need something like this Int InTrigger = 0 Event OnTriggerEnter(ObjectReference akTriggerRef) if (InTrigger == 0) if akTriggerRef == Game.GetPlayer() InTrigger += 1 ;debug.notification("Entered Trigger") gotoState("done") endif endifEndEvent Event OnTriggerLeave(ObjectReference akTriggerRef) if (InTrigger > 0) if akTriggerRef == Game.GetPlayer() InTrigger -= 1 ;debug.notification("Leaving Trigger") gotoState("done") endif endifEndEvent State done ;do nothingendState Link to comment Share on other sites More sharing options...
gerg357 Posted August 31, 2016 Author Share Posted August 31, 2016 Im using it on a activator.. basically activator is on table i have a x marker beside of that on table.. it works good until it drops a pair of boots then once i pick up the boots then it starts spamming these clothes. i was thinking it had something to do with the fact of the xmarker maybe a glitch what i wanted to do was if they had the materials/ conditions then it rolls a die/get a random number then once it gets a random number lets says 0-5 if its 0 we drop one item from this leveled item list if its another number we drop one from another level item list .. my above code works good until it drops boots about every time it does when i pick up boots its spamming stuff.. so i figure i might want to try putting the item in a chest.. i dont think i have anything like a level item list inside of one i thought maybe it was something to do with that... i havent tried a chest yet i may do that here later.. Link to comment Share on other sites More sharing options...
NexusComa Posted September 1, 2016 Share Posted September 1, 2016 So a box activator or a switch activator ? Link to comment Share on other sites More sharing options...
JonathanOstrus Posted September 1, 2016 Share Posted September 1, 2016 Im using it on a activator.. basically activator is on table i have a x marker beside of that on table.. it works good until it drops a pair of boots then once i pick up the boots then it starts spamming these clothes. i was thinking it had something to do with the fact of the xmarker maybe a glitch what i wanted to do was if they had the materials/ conditions then it rolls a die/get a random number then once it gets a random number lets says 0-5 if its 0 we drop one item from this leveled item list if its another number we drop one from another level item list .. my above code works good until it drops boots about every time it does when i pick up boots its spamming stuff.. so i figure i might want to try putting the item in a chest.. i dont think i have anything like a level item list inside of one i thought maybe it was something to do with that... i havent tried a chest yet i may do that here later.. Chest is an option. So is just directly adding it to the player inventory instead of dropping it on the floor. Unless there's a reason to not add it to the player inventory. I wanted to clarify something though. If you activate it with whatever method it is, you get an item. If you pick up that item nothing further happens? Unless the item is the boots you're mentioning. If you then pick up those boots, it *then* starts placing more? It is not starting the repeated spam as soon as you activate and it places the first boots? A recursive leveled list shouldn't be able to produce the problem you're describing. Another thing that might be though, is if the record of the boots has some sort of script attached. It might incorrectly be triggering your on activate when you pick it up. Can you easily identify which boots it is to check that? Link to comment Share on other sites More sharing options...
gerg357 Posted September 27, 2016 Author Share Posted September 27, 2016 Was able to fix by putting output of item in a chest.. nonproblems now Link to comment Share on other sites More sharing options...
Recommended Posts