Jump to content

Event for when a misc item is used from inventory?


Recommended Posts

EDIT: Figured it out... Never would have thought to try it, but just started trying random similar things and, for anyone else looking for the info, Event OnEquipped believe it or not.

 

 

 

I've got a misc item that's meant to be a teleporter, when the player uses the item, a menu pops up and allows the player to choose a teleport destination. However, I can't seem to find an event to use.

 

I tried onactivate() and with amateur level scripting knowledge, I couldn't think of anything else. Here's my current script, which never fires. Is there a different Event I can use to detect when the player activates the item from their inventory?

Scriptname AATeleporterScript extends ObjectReference Const

Message Property OptionMenu Auto Const   
ObjectReference Property myareaTele Auto Const
ObjectReference Property SancTele Auto Const
Explosion Property TeleExplosion Auto Const

Event OnActivate(ObjectReference akActionRef)
if akactionref == game.getplayer()
  Menu()
endif
endevent

Function Menu(Int aiButton = 0)
Int iButton = OptionMenu.Show()
   If iButton == 0
    game.getplayer().placeatme(teleexplosion)
    game.getplayer().moveto(SancTele)
    game.getplayer().placeatme(teleexplosion)
   ElseIf iButton == 1
    game.getplayer().placeatme(teleexplosion)
    game.getplayer().moveto(myareaTele)
    game.getplayer().placeatme(teleexplosion)
   ElseIf iButton == 2
    Debug.Notification("Teleport Canceled")
   EndIf
Endfunction
Edited by saintgrimm92
Link to comment
Share on other sites

  • Recently Browsing   0 members

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