Advertisement
Terrah

Lua eventhandler area transition

Oct 28th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. LUA:
  2.  
  3. local function EventHandler(obj,trg,ev,sub)
  4.  
  5. if ev == 10 and sub == 30 then
  6. nwn.SetObject(trg);
  7. --"trans" should be the name of the below script
  8. nwn.ExecuteScript("trans",obj);
  9. end
  10. end
  11.  
  12. nwn.SetEventHandler(EventHandler);
  13.  
  14. NWSCRIPT:
  15.  
  16. #include "nwnx_lua"
  17.  
  18. void main()
  19. {
  20. object oTrans = OBJECT_SELF;
  21. object oTarget = GetTransitionTarget(oTrans);
  22.  
  23. if(!GetIsObjectValid(oTarget))
  24. return;
  25.  
  26. SendMessageToPC(GetFirstPC(),"Transition: "+GetName(oTrans)+" target: "+GetName(GetArea(oTarget))+" PC: "+GetName(LuaGetObject(3)));
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement