Jump to content

Adding script to a weapon


porroone

Recommended Posts

So basically im trying to add an script to a weapon, but im not sure what im doing wrong, im trying something very simple but it doesnt seem to work, I was hoping somebody could point me in the right direction, here is the code:

Scriptname WarGlaiveBack extends Actor
import debug
import game
import utility
Event OnObjectUnequipped(Form WarGlaiveR, ObjectReference akActor)
Debug.MessageBox("Hello, world!")
EndEvent

 

Basically I have a weapon named WarGlaiveR, and I want it to show a messagebox when I unequipped.

Link to comment
Share on other sites

So basically im trying to add an script to a weapon, but im not sure what im doing wrong, im trying something very simple but it doesnt seem to work, I was hoping somebody could point me in the right direction, here is the code:

Scriptname WarGlaiveBack extends Actor
import debug
import game
import utility
Event OnObjectUnequipped(Form WarGlaiveR, ObjectReference akActor)
Debug.MessageBox("Hello, world!")
EndEvent

 

Basically I have a weapon named WarGlaiveR, and I want it to show a messagebox when I unequipped.

 

Try

Scriptname _Weapon_test extends ObjectReference  
{Weapon Script}

Event OnUnequipped (Actor AkActor)

if AkActor == Game.GetPlayer()
	debug.MessageBox("Hello World!")
endif


EndEvent

Link to comment
Share on other sites

So basically im trying to add an script to a weapon, but im not sure what im doing wrong, im trying something very simple but it doesnt seem to work, I was hoping somebody could point me in the right direction, here is the code:

Scriptname WarGlaiveBack extends Actor
import debug
import game
import utility
Event OnObjectUnequipped(Form WarGlaiveR, ObjectReference akActor)
Debug.MessageBox("Hello, world!")
EndEvent

 

Basically I have a weapon named WarGlaiveR, and I want it to show a messagebox when I unequipped.

 

 

 

Try

Scriptname _Weapon_test extends ObjectReference  
{Weapon Script}

Event OnUnequipped (Actor AkActor)

if AkActor == Game.GetPlayer()
	debug.MessageBox("Hello World!")
endif


EndEvent

Didn't work, I tried several combinations including declaring the weapon as a property, using the WEAPON extend, using event OnObjectUnequipped(Weapon WarGlaiveR), tried so many tings that something should had work, or at least gave me something, but no, instead all I got is a perfect compiled script, with zero results after unequipping the weapon on all attempts which after a few hours I find a bit frustrating, so Im gonna go sleep hoping tomorrow ill see things clearly :P

Edited by porroone
Link to comment
Share on other sites

Yes, why would the name matter ?

 

The script on the sword wouldn't work since the name changed during the runtime of the script.

Just create a new script with the

Event OnUnequipped (Actor AkActor)

       if AkActor == Game.GetPlayer()
               debug.MessageBox("Hello World!")
       endif


EndEvent

part of the script and below what's in there by default.

Edited by needsaname
Link to comment
Share on other sites

Im starting to think its because I already had the weapon in the inventory when I added the script to it, maybe if I make a new save without the mod then activate the mod again and recraft the weapon, any idea if that could be the reason? I think I had a similar issue back in oblivion but Im not sure.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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