Jump to content

Need help with really basic scripting


sh0ker

Recommended Posts

Hey,

I have added a new armor into the game now just for testing I want to display a message when someone equip it, I made this script:

ScriptName EquipRobesScriptTest extends ObjectReference


Event OnEquipped(Actor akActor)
  Debug.MessageBox("Hey")
endEvent

But for some reason It doesn't work.

Yes I've attached the script to the item

Link to comment
Share on other sites

Are you equipping it by any means other than normally from the inventory?

From my experience OnEquipped/OnUnequipped are not reliable events and will not fire at times but this is noticiable when doing something that requires specific order of equipped and unequipped in order to not mess stuff up. In such a simple script it should fire fine at least once if you equip it a few times and as said before try from inventory if you are not, no hotkeys or anything.

Edited by FrankFamily
Link to comment
Share on other sites

Are you equipping it by any means other than normally from the inventory?

From my experience OnEquipped/OnUnequipped are not reliable events and will not fire at times but this is noticiable when doing something that requires specific order of equipped and unequipped in order to not mess stuff up. In such a simple script it should fire fine at least once if you equip it a few times and as said before try from inventory if you are not, no hotkeys or anything.

 

I am equipping it from the inventory but nothing happens :S

Link to comment
Share on other sites

I believe that unless the item is a persistant reference, it will not register events as an objectreference.

 

How do I know if the item is persistent or not? I simply made a copy of a similar item and changed the name and stats.

Then I added it to my inventory using player.additem

 

Weird. Are you using a coc character that is seeing the item for the first time? What happens when you use OnObjectEquipped?

 

I basically equip it on myself and it doesn't work, I will try OnObjectEquipped thanks

Link to comment
Share on other sites

Try this:

 

 

ScriptName RobeScript Extends ObjectReference
Actor Property PlayerRef Auto Hidden

Event OnInit()
GoToState("Park")
EndEvent
;---------------------------------
Event OnEquipped(Actor akActor)

Debug.MessageBox("Hey ...")

GoToState("Park")

EndEvent
;---------------------------------
State Park
;parking
EndState
;

 

 


Edited by NexusComa
Link to comment
Share on other sites

Okay, i managed to make it work, it's kinda funny but the way it worked is that I dropped the item on the floor then picked it up.

My guess is that because I used player.additem and the item wasn't loaded or something it was only an inventory reference (this is my guess)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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