Creating a relic item

Post » Wed Apr 07, 2010 4:27 am

Hello!
I made a relic item for my game. A magic scull that gives +15 Blade just by having it in my inventory. To make that i used the following script.

scriptname BookofBlade5

ref target
short activator

begin gamemode
set target to getcontainer
end

begin onadd
target.modactorvalue2 blade 5
message "Blade +5"
end

begin ondrop
target.modactorvalue2 blade -5
message "Blade -5"
end


that works fine.
The problem i encounter is that if i want to give this item to one of my companions, they dont get the bonus "blade+15"
I understand that the onadd and especially ondrop is not the proper block for that.
Can you plz tell me what i can put there? (onequip - onunequip) cannot be used because the "scull" is not equipable.
Btw i use Toaster Share Recruit for my inventory share,
Thanks
User avatar
Alycia Leann grace
 
Posts: 3539
Joined: Tue Jun 26, 2007 10:07 pm

Post » Wed Apr 07, 2010 4:40 am

For starters, ModActorValue2 is an OBSE function, so you shouldn't use it unless you plan to make your mod dependant on OBSE. Secondly, I remember reading somewhere that forcibly advancing skills that way leads to problems with gaining XP and levelling up the skill after the bonus is applied (but I may be wrong)

As for why it wont work for companions, my best guess is that it involves the OnAdd and OnDrop blocks. Try placing your relic in a container - Does the boost go away?
User avatar
biiibi
 
Posts: 3384
Joined: Sun Apr 08, 2007 4:39 am

Post » Wed Apr 07, 2010 1:35 am

An alternative to using ModActorValue2 could be if you make an ability (constant spell) that gives Fortify Blade +5. And then you use target.addspell and target.removespell .
User avatar
ILy- Forver
 
Posts: 3459
Joined: Sun Feb 04, 2007 3:18 am

Post » Wed Apr 07, 2010 12:57 am

Are you sure that it works? Modav2 should not increase any value above the normal max value, so blade +5 shouldn't work, neither for you, nor for anyone else. Unless the blade skill was damaged before modav2 was called.
User avatar
Adam
 
Posts: 3446
Joined: Sat Jun 02, 2007 2:56 pm

Post » Wed Apr 07, 2010 12:09 am

Thanks for replies.

I know about OBSE, its cool because it offers some very useful commands , that in vanilla they dont excist.

The ModAV and MODAV2 commands work. I have no prob with that.

Real problem here is...

I use share/recruit mod that allows player to share inventory with companions and give/take them items.
The idea of those items is to give a temporary (+5 BLADE) just by having it to my inventory. When i transfer my item from my inventory to my companion's inventory, i have to get (-5 blade) and my companion must now have the (+5 blade). And reverse of course. This action is not onadd / ondrop or onequip / onunequip. Its something else, that dont know... (thats the prob)

That really works if i pick the item up from the floor, or drop it to the floor.

Now about the friend who told to put in container i suppose (havent tested yet) that it will work when i pick the item from container, but i dont think that it will work when puting it in. Because the ondrop script demands that you have to use the drop action (shift + click) Anyway i will try it.

Thanks
User avatar
Leanne Molloy
 
Posts: 3342
Joined: Sat Sep 02, 2006 1:09 am

Post » Wed Apr 07, 2010 4:56 am

Now about the friend who told to put in container i suppose (havent tested yet) that it will work when i pick the item from container, but i dont think that it will work when puting it in. Because the ondrop script demands that you have to use the drop action (shift + click) Anyway i will try it.

No :nono:, onDrop works not only when shift-click but when you put things in container : read the article http://cs.elderscrolls.com/constwiki/index.php/OnDrop and ESpEcIALLy the http://cs.elderscrolls.com/constwiki/index.php/Talk:OnDrop, where maybe your problem is mentioned.
EDIT : :flame: the forum software is changing the links - http://tiny.cc/wbdql, http://tiny.cc/jrdgx.

as you will see onDrop and onAdd are notoriously buggy
User avatar
benjamin corsini
 
Posts: 3411
Joined: Tue Jul 31, 2007 11:32 pm

Post » Tue Apr 06, 2010 8:00 pm

Look at the "Scales of Pitiless Justice" as a reference.
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm


Return to IV - Oblivion