zelazko Posted September 27, 2022 Share Posted September 27, 2022 So far I was only successful in making all skooma references placed in the world marked as stolen/belonging to the Imperial Watch. I am struggling making a script to get any skooma player picks up marked as stolen = belonging to Imperial Watch.I tried assigning HasBeenPickedUp && PlayerRef.IsContainer to different variable but I just cannot crack this nut. Scriptname SkoomaTMZMOwnedbyWatch ref Skooma int SkoomaIllegal int SkoomaCount begin function {SkoomaIllegal} Let Skooma := GetFirstRef SkoomaIllegal while ( skooma != 0 ) if ( Skooma.GetIsID PotionSkooma == 1 ) Set SkoomaCount to PlayerRef.GetInventoryObject Skooma set SkoomaCount to PlayerRef.GetItemCount PotionSkooma Skooma.SetOwner ImperialWatch Message "Loop Completed cycle" endif Let Skooma := GetNextRef loop end Link to comment Share on other sites More sharing options...
RomanR Posted September 27, 2022 Share Posted September 27, 2022 if you don't mind script being attached to item, one working way could be this: scn OwnerShipTest ref item ref item2 ref item3 ref container ref owner ref added begin OnAdd player set added to 1 end begin GameMode set container to GetContainer if container == player && added != 0 let item := GetBaseObject foreach item2 <- container let item3 := item2.GetBaseObject if item3 == item let owner := item2.GetOwner if owner == 0 item2.SetOwner ImperialWatch endif endif loop set added to 0 endif end This will change ownership of all items of same kind upon taking to be Imperial Watch property as new item arrives in player inventory. For example if you attach this script to Daedric Dagger, you will see all Daedric Daggers marked as stolen when you take another one. There are commands which doesn't execute OnAdd block, but for single taking this will be enough. The only disadvantage can be performance, if there are too many items of this kind in a cell. Script runs in game mode only for now too. Link to comment Share on other sites More sharing options...
zelazko Posted September 27, 2022 Author Share Posted September 27, 2022 (edited) if you don't mind script being attached to item, one working way could be this: scn OwnerShipTest ref item ref item2 ref item3 ref container ref owner ref added begin OnAdd player set added to 1 end begin GameMode set container to GetContainer if container == player && added != 0 let item := GetBaseObject foreach item2 <- container let item3 := item2.GetBaseObject if item3 == item let owner := item2.GetOwner if owner == 0 item2.SetOwner ImperialWatch endif endif loop set added to 0 endif end This will change ownership of all items of same kind upon taking to be Imperial Watch property as new item arrives in player inventory. For example if you attach this script to Daedric Dagger, you will see all Daedric Daggers marked as stolen when you take another one. There are commands which doesn't execute OnAdd block, but for single taking this will be enough. The only disadvantage can be performance, if there are too many items of this kind in a cell. Script runs in game mode only for now too.I have similar script for other illegal items like skooma paraphernalia and dwemer artifacts. Scriptname MoonSugarIngredTMZMScript begin OnActivate if ( IsActionRef Player ) if ( GetOwner != ImperialWatch ) SetOwnership ImperialWatch Activate else Activate endif endif endI would like to avoid editing directly base PotionSkooma object to avoid compatibility conflicts. Given the mod I am including those scripts already edits a few major city worldspace. So the less headache the better... foreach item2 <- containerWhat does this expression mean? I can't figure it out that thing foreach <- Edited September 27, 2022 by zelazko Link to comment Share on other sites More sharing options...
GamerRick Posted September 27, 2022 Share Posted September 27, 2022 (edited) So far I was only successful in making all skooma references placed in the world marked as stolen/belonging to the Imperial Watch. I am struggling making a script to get any skooma player picks up marked as stolen = belonging to Imperial Watch.I tried assigning HasBeenPickedUp && PlayerRef.IsContainer to different variable but I just cannot crack this nut. Scriptname SkoomaTMZMOwnedbyWatch ref Skooma int SkoomaIllegal int SkoomaCount begin function {SkoomaIllegal} Let Skooma := GetFirstRef SkoomaIllegal .. end The only thing SkoomaIllegal can be is 40, the item code for Alchemy items (aka potions). The command GetFirstRef shows the item codes. I say this because you are using a passed variable there, which makes no sense. Edited September 27, 2022 by GamerRick Link to comment Share on other sites More sharing options...
RomanR Posted September 27, 2022 Share Posted September 27, 2022 (edited) foreach item2(variable which will be filled) <- container(source field) .......... loop This will stroll automaticaly through every record of field and in documentation is presented as the only way to walk within actor's/container inventory. You can view the part "Inventory References" in OBSE Command Docs for more. So I'm assuming you need some script for detecting item is being/was in the cell taken without using OnAdd? Maybe using GetCrosshairRef, GetBaseObject and IsActivatable commands, including checking for activate controls is a way to go, but such script must be always activated and running, which will eat performance. For now I can't think of suitable and quick solution, I'm sorry. Edited September 27, 2022 by RomanR Link to comment Share on other sites More sharing options...
Recommended Posts