Jump to content

Need help to make a spell to steal things.


Recommended Posts

Posted
I have tried to make two spells.

One will give people things - This spell effect works


 

Scriptname GiveThingsScript extends activemagiceffect  

 

LeveledItem Property _Lootavg  Auto  

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

 

akTarget.AddItem(_Lootavg)

 

EndEvent


 

And one will remove the ownership so you can steal things - This one doesn't work... :(

 


Scriptname _RemoveOwner extends activemagiceffect  

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

 

Debug.Trace("Magic effect was started on " + akTarget)

akTarget.SetActorOwner(NONE)

 

EndEvent

 


 

Any suggestions?

Posted

For the first script you need to do something like:

 

akTarget.AddItem(_Lootavg, 1)

 

The number of items to add is mandatory.

 

But the second script may not work.

The items on the tables are objectreferences, but often they do NOT receive magic effects.

 

If you are trying to remove the ownership of items, and this is a player spell, probably you can use a different path:

Do a spell that when it is running sets a variable (global if you like, or one in your main quest script)

Then add an alias to the player and handle the event:

 

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
 
Then for the akItemReference, reset the owner in case your variable is set.
 
if myVariable==1
  akItemReference.SetActorOwner(None)
endIf
 
 
I hope this helps.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...