i've been trying to write a (as i thought) simple little mod that allows me to process cloth into items of more use. My problem is, i can't seem to give those clothes several charges to respect different qualities of cloth.
So i set up an array that is synchronized with my inventory every fQuestDelayTime seconds, if in menuMode. it's working fine and cloth bolts, (fine) folded cloth is added / removed when bought / sold or picked up / dropped, but the charges i was storing in the array are of course resetting each time such an item is added to my inventory.
Marking every "cloth" item as quest item isn't the right way i guess so i thought of setScript. If i understood what i could find about setScript it should be an elegant way to have every item in question manage their uses individually, even if dropped or something.
Well but i can't seem to get setScript to work. What i've got so far is like:
begin menuMode 1002 ... let miscItems := player.getItems ;; getItems 27 didn't seem to work, some "misc" items weren't included while index >= 0 let miscItem := miscItems[index] if eval (getObjectType miscItem != 27) ar_Erase ... let index -= 1 continue endif ;; ok, miscItem is applicable, add it to the array if eval (isScripted miscItem) == 0 ref tmpScriptRef ;let tmpScriptRef := *someObjectWiththeScript*.getScript let tmpScriptRef := setScript *someScriptRef* miscItem let tmpScriptRef := 0 endif ; add the item ... loop ...end
ok, it's not all of the script but i hope it shows what i'm trying to do. So... it compiles, it runs, but when "use"ing the item(s) in question (-> miscItem) nothing happens. No that's not correct, sOmething happens, as the animation of my character in the menuMode is resetted ^^ but the OnEquip block of the "attached" script won't run.
Well, does anyone know what i'm missing to get it working?
i read something about adding the item to, well, someone, should help to start the script added to it... that is something i don't quite understand, because then i would have two of them in my inventory, one scripted (hopefully) and the other not, or how it is supposed to be meant?
I'm really new to this all, so don't slap me for my simple question, if so, nor for my poor English


regards, leptoton