Advertisement
Guest User

lua

a guest
Jul 19th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | None | 0 0
  1. NWNXLua v0.5 created by Terra_777
  2. Copyright © 1994–2013 Lua.org, PUC-Rio. Please visit: http://www.lua.org/
  3.  
  4. Additional nwn functions: (useage nwn.funcname)
  5.  
  6. void SetLuaTMI( new ) - the tmi is handed in 100.000 units. 1 = 100.000 instructions. Calling this also resets the current count value
  7. int GetLuaTMI( ) - Get the TMI, see SetLuaTMI
  8. int GetFirstNextTURD( first ) - Traverse the turds, if first is true it'll reset and start from the top. Returns nil on fail and id and communityname on success
  9. string GetBic( creature ) - Get the bicfilecurrently in use by creature (player object)
  10. int DeleteTURD( pccreature ) - Delete a TURD (object containing info about PCs not online).
  11. int SetGetDomain( creature, domain, newdomain ) - set the domain (1 or 2) to a new domain or return the current if newdomain is nil. Returns -1 for non clerics, does not mod feats.
  12. int SetGetSpecialization( creature, newspec ) - set the wizard spec to a new specilization or return the current if newspec is nil. Returns -1 for non wizards.
  13. table GetLevelStat( creature, level ) - returns a table filled in with the info of the level that was requested, nil on failure
  14. int AddFeat( creature, feat, level ) - adds feat to creature, if level is higher then 0 then its also added to that level in the statlist
  15. void RemoveFeat( creature, feat ) - removes feat from creature, it'll also remove it from the statlist if any
  16. int GetABVs( creature, target ) - returns the AB the creature has vs the target
  17. int GetACVs( creature, target ) - returns the AC the creature has vs the target
  18. void SetSkillScore( creature, type, number ) - Sets the skill of a creature, type corresponds to SKILL_*, if type is negative it'll set the 'stored' skillpoints
  19. int GetStoredSkillPoints( creature ) - Get the number of stored/unassigned skillpoints the creature has
  20. void SetAbilityScore( creature, type, number ) - Set the base ability score for a creature. type corresponds to ABILITY_*
  21. string SetGetName( creature, type, name ) - Set the first or lastname of a creature. type 1 = lastname, type 0 = firstname. If name is nil it will only return a value
  22. string SetGetScript( creature, type, script ) - sets or gets an eventscript on a creature.
  23. If script is nil it will return only.
  24. type: 1: onattack 2: onblock 3: ondamage 4: ondeath 5: onconvo 6: ondisturbed 7: onendcombat 8: onheartbeat 9: onperception 10: onrested 11: onspawn 12: onspellcastat 13: userdefined
  25. int SetGetMovementRate( creature, movementratetype ) - sets the movementrate for a creature. nil or 0 will return only. type: 0 PC movement, 1: immobile, 2: very slow, 3:slow, 4: normal, 5: fast, 6: very fast, 7: default, 8: dm fast
  26. int SetGetVoiceSet( creature, voiceset ) - sets the voiceset of creature, if voiceset is nil or less then 0 it will return the current without changing
  27. void SetBaseDesc( creature, text ) - Set the base desc of a creature
  28. void SendMSGToAll( text )
  29. void SendMSGToPC( PC, text )
  30. int IsValid( object )
  31. object GetFirstPC( )
  32. object GetNextPC( )
  33. int ExecuteScript( script, objectself )
  34. void SetLocalString( object, varname, data )
  35. string GetLocalString( object, varname )
  36. void DeleteLocalString( object, varname )
  37. void SetLocalObject( object, varname, target )
  38. object GetLocalObject( object, varname )
  39. void DeleteLocalObject( object, varname )
  40. void SetLocalInt( object, varname, int )
  41. int GetLocalInt( object, varname )
  42. void DeleteLocalInt( object, varname )
  43. int SendChatMessage( receiver, sender, message, channel ) channel = 0:talk 1:whisper 2:party 3:tell 4:shout 5:dm 6: dmtalk 7: dmwhisper
  44. object IntToObject( number )
  45. int IntToObject( object )
  46. data NWScriptFunction( proc-address-string, opcode, secondarg, ... ): attempts calling a nwscript function, proc-address-string must the address to the function. Then the function behaves the same as the nwscript version, this can horribly crash everything! Only works with nwscript functions that handle ints, floats, strings and objects!
  47. void LuaLog( int ) 0 (default) no logging done, 1 log stuff
  48. file, attributes GetFirstFile( filepathfilter )
  49. file, attributes GetNextFile( )
  50. spot, listen GetCheckDistance( creature )
  51. oldvalue SetCheckDistance( creature, type, newvalue ) type: 1 combat spot 2 spot 3 combat listen 4 listen
  52. void ClearVisibleList( creature )
  53. void UpdateVisibleList( creature )
  54. int AddToVisibleList( creature, target, a1,a2,a3,a4 )
  55. void RemoveFromVisibleList( creature, target )
  56. oldflags SetVisibleListFlag( creature, target, flags )
  57. flags GetVisibleListFlag( creature, target )
  58. bool GetInvisible( creature, target, DC )
  59. bool GetBlind( creature )
  60. void LuaMainLoop( string FuncName ): hooks nwservers mainloop and executes the function with FuncName as its name
  61. void SetObject( object ): sets the object which is returned by nwscript GetObject
  62.  
  63. Additional:
  64. The object type is a hexadecimal string, same as nwns ObjectToString.
  65. The command print is by default redirected to this logfile.
  66. All standard lua libraries enabled!
  67. OBJECT_SELF is available in lua-scripts executed from nwscript and holds the object executing the script.
  68.  
  69. Hooking VM: ok
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement