sh0ker Posted May 17, 2016 Posted May 17, 2016 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
FrankFamily Posted May 17, 2016 Posted May 17, 2016 (edited) 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 May 17, 2016 by FrankFamily
sh0ker Posted May 17, 2016 Author Posted May 17, 2016 On 5/17/2016 at 10:08 PM, FrankFamily said: 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
Elias555 Posted May 18, 2016 Posted May 18, 2016 Weird. Are you using a coc character that is seeing the item for the first time? What happens when you use OnObjectEquipped?
Sjogga Posted May 18, 2016 Posted May 18, 2016 I believe that unless the item is a persistant reference, it will not register events as an objectreference.
sh0ker Posted May 18, 2016 Author Posted May 18, 2016 On 5/18/2016 at 4:53 AM, Sjogga said: 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 On 5/18/2016 at 3:40 AM, Elias555 said: 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
FrankFamily Posted May 18, 2016 Posted May 18, 2016 OnObjectEquipped runs on actor and triggers for each object equipped by it, OnEquipped runs of the object and triggers when it's equipped, different things.
NexusComa Posted May 18, 2016 Posted May 18, 2016 (edited) Try this: Reveal hidden contents ScriptName RobeScript Extends ObjectReferenceActor Property PlayerRef Auto HiddenEvent OnInit() GoToState("Park")EndEvent;---------------------------------Event OnEquipped(Actor akActor) Debug.MessageBox("Hey ...") GoToState("Park")EndEvent;---------------------------------State Park ;parkingEndState; Edited May 18, 2016 by NexusComa
sh0ker Posted May 18, 2016 Author Posted May 18, 2016 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)
NexusComa Posted May 19, 2016 Posted May 19, 2016 (edited) Hmm, well the script I posted for you works perfectly and is also put together correctly. Edited May 19, 2016 by NexusComa
Recommended Posts