porroone Posted February 8, 2012 Posted February 8, 2012 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.
needsaname Posted February 8, 2012 Posted February 8, 2012 On 2/8/2012 at 3:33 PM, porroone said: 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. TryScriptname _Weapon_test extends ObjectReference {Weapon Script} Event OnUnequipped (Actor AkActor) if AkActor == Game.GetPlayer() debug.MessageBox("Hello World!") endif EndEvent
porroone Posted February 8, 2012 Author Posted February 8, 2012 (edited) On 2/8/2012 at 9:56 PM, needsaname said: On 2/8/2012 at 3:33 PM, porroone said: 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. TryScriptname _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 February 8, 2012 by porroone
needsaname Posted February 8, 2012 Posted February 8, 2012 The script works for me, did you copy the line "Scriptname _Weapon_test extends ObjectReference " by chance and leave it in with another Scriptname line?
needsaname Posted February 8, 2012 Posted February 8, 2012 (edited) On 2/8/2012 at 11:02 PM, porroone said: 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 EndEventpart of the script and below what's in there by default. Edited February 8, 2012 by needsaname
porroone Posted February 8, 2012 Author Posted February 8, 2012 I think I missunderstood you, I left the original scriptname, the one that matches the name of the file as the wiki says it should, otherwise it doesnt let you compile anyways.
needsaname Posted February 8, 2012 Posted February 8, 2012 Oh I see. Wonder why it doesn't work for you? It works every time with me...
porroone Posted February 8, 2012 Author Posted February 8, 2012 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.
Recommended Posts