Talk:Scripting Tutorial: Custom Bound Items

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Thanks for this tutorial, I've been trying to find out, how an item can determine its bearer...and it's here! I think I'd never even tried "GetContainer".

I've been doing some tests because of annoyances with scripts on items when transfering the with "RemoveAllItems". It's documented here: http://www.elderscrolls.com/forums/index.php?showtopic=492245 The result is, that scripts using "OnEquip" might fail (or: usually fail) to work, if the item is handed to a companion using companion share: the block is not executed.

Andreas.

Query[edit source]

Your explanation is really good, thankyou. I'm planning on creating summon spells where i summon multiple NPC's or creatures at once. and i plan to then reward these spells to a player upon eqipping a ring. but i want to make these spells permanent, hence reward.

any tips or tutorial scripts? :)

thanks

Thanks[edit source]

Thanks for this tutorial it was very informative and lead to my first (non-generic ie. not "Hello world") mod with scripting in it. I adapted it to summon a robe, hood and dagger. Leonidas 04:40, 3 June 2007 (EDT)

A question I hope to resolve[edit source]

I'm just a scripter thinking up ideas. Can you reference objects in a container/actor from outside the object? Like having a scripted spell effect that can set a script on an object's variable to something. Maybe it would help if I outlined my idea:

Note that, for clarity, I used bad scripting. I know that using GetSelf/GetContainer as a reference is (probably) illegal. So substitute for what works Also, where percent signs are concerned, I'm not sure whether they are used as "brackets" or just as the start/end char. some systems use one, some the other.

Components: (Multiple) Bound Items, A variety of armor/weapons/etc. (1)script to be attached to the spell or object calling the summon, that does such as this: onScriptEffectStart If ( Getself.GetItemCount %itemname% == 0 ) additem %itemname% 1 endif If ( Getself.GetItemCount %itemname% > 0 ) set %itemname%.%refvar% to %itemname% set %itemname%.shortvar to 1 endif end


(1) script that can act universally for bound items, contains a ref variable that is supposed to be a ref to the calling object itself and a short variable to check whether the script should run. I.e:

onUnequip %item if ( shortvar == 1 ) If ( GetContainer.IsActor == 1 ) GetContainer.ForceEquip %refvar% endif endif

If I come across unclear, please add a note. If you know the answer, add a note. If I figure it out on my own, I will add a note.