Attaching scripts to Books & Constant Effect Enchantment

Post » Mon Jun 18, 2012 4:03 pm

Hi all,
I am having some trouble attaching particular scripts, I have looked through the boards and the wiki but I feel I am missing something...

I'm sure it has something to do with what CIPSCIS says on his page about is setting a property or an 'extend' but I can't seem to find the answer (or maybe just cause I've been working on 4-5 things at once again).

The following script is attached to the magic effect 'EnchFortifyAlchemyConstantSelf'...


Scriptname LFAlchemyLimit{Limits the maxiumum you can have "Alchemy Modifier" at with Enchanted items equiped.}actor playerEvent OnEffectStart(Actor Target, Actor Caster)player = game.getplayer()if player.GetAV("AlchemyMod") > 25.0  player.ForceAV("AlchemyMod", 25.0)endifEndEvent; ------------------------------------------------------Event OnEffectFinish (Actor Target, Actor Caster)if player.GetAV("AlchemyMod") < 0.0  player.ForceAV("AlchemyMod", 0.0)EndifEndEvent


I'm sure I need an 'extends' after my script name but not sure what to reference.


The following script is attached to skill up books...


Scriptname LFSkillbookpickup extends ObjectReference{This script lets you pickup skill books if sneaking and having a weapon drawn instead of reading the book and activating the skill point gain.}actor PlayerBook Property TheBook AutoObjectReference MyselfrefEvent onGrab()Player = game.getplayer()If Player.IsSneaking() && Player.IsWeaponDrawn()  Player.Additem(MyselfRef)  ; would rather add this exact item to player inventory.;  Player.Additem(TheBook, 1)  ; Can set this to each individual book type...;  Myselfref.Disable()	; but cant seam to remove original in world.;  Myselfref.Delete()EndifEndEvent

With this script I was looking for a way to add the actual in world item to the players inventory instead of a copy but I can't work out the proper syntax to set MyselfRef as the grabbed object.

Any help would be greatly appreciated :biggrin:

Thanks.
User avatar
His Bella
 
Posts: 3428
Joined: Wed Apr 25, 2007 5:57 am

Post » Mon Jun 18, 2012 9:12 pm

Wow threads move dam fast here dont they.
User avatar
Nauty
 
Posts: 3410
Joined: Wed Jan 24, 2007 6:58 pm

Post » Mon Jun 18, 2012 2:09 pm

Great sorted the book script, please see below...

Spoiler


Scriptname LFSkillbookpickup extends ObjectReference
{This script lets you pickup skill books if sneaking and having a weapon drawn instead of reading and activating the skill point gain.}

actor Player
Book Property TheBook Auto
ObjectReference property objSelf auto

Event onGrab()

Player = game.getplayer() ; set 'Player' to reference the player.

Self as ObjectReference ; set 'Self' to reference the book.

If Player.IsSneaking() && Player.IsWeaponDrawn() ; check if player is sneaking and holding weapon drawn.

Player.Additem(Self) ; Adds to inventory instead of auto reading.

Endif

EndEvent

User avatar
Sxc-Mary
 
Posts: 3536
Joined: Wed Aug 23, 2006 12:53 pm


Return to V - Skyrim