NPC Handler Class |
Bolodefchoco « Sénateur » 1529944260000
| 7 | ||
https://github.com/Lautenschlager-id/Transformice/blob/master/Others/NPC%20class.lua A class to manipulate animation and callbacks of NPCs. What can you do with this? Code Lua 1 2 3 4 5 6 7 8 9 10 11 12 13 local bot = npc("Wu", { https://github.com/Lautenschlager-id/Transformice/blob/master/Others/NPC%20class.lua npc
:destroy :getAction :getCollection :getId :getLayer :getName :getState :removeAction :removeName :setAction :setCallback :setDimension :setPosition :setState :static x y w h https://github.com/Lautenschlager-id/Transformice/blob/master/Others/NPC%20class.lua • npc.data The table containing all the frame collections of the NPC. • npc.x The horizontal position of the NPC. • npc.y The vertical position of the NPC. • npc.w The NPC's width. • npc.h The NPC's height. https://github.com/Lautenschlager-id/Transformice/blob/master/Others/NPC%20class.lua • npc ( name, collection, layer ) Creates a NPC instance. Parameters: - data (string) : the name of the NPC. - collection (table) : the frame collections of the NPC. - layer (string) : the target of the frames of the NPC. Returns: (npc) self • npc:deleteCallback ( [ playerName ] ) Removes the callback of the NPC, if set. Parameters: - playerName (string) : the name of the player that won't see the callback anymore Returns: (npc) self • npc:destroy ( super ) Removes the NPC. Parameters: - super (boolean) : if the name must be removed too Returns: (npc) self • npc:getAction ( ) Gets the action/animation of the NPC. Returns: (function | nil) the NPC's action • npc:getCollection ( ) Gets the frame collections of the NPC. Returns: (table) the frame collections of the NPC • npc:getId ( ) Gets the ID of the NPC. Returns: (int) the NPC's ID • npc:getLayer ( ) Gets the layer / target of the NPC. Returns: (string) the NPC's target • npc:getName ( ) Gets the name of the NPC. Returns: (string | nil) the NPC's name • npc:getState ( ) Gets the current frame collection of the NPC. Returns: (table) the current frame collection of the NPC • npc:removeAction ( ) Destroyes the action/animation of the NPC, if set. Returns: (npc) self • npc:removeName ( [ playerName ] ) Removes the name of the NPC. Parameters: - playerName (string) : the name of the player that won't see its name anymore Returns: (npc) self • npc:setAction ( [ event[, static] ] ) Sets the action/animation of the NPC. Parameters: - event (function) : the function to be executed in/for each frame. Receives the current frame, mutable with a return - static (boolean) : whether the NPC will be static or not Returns: (npc) self • npc:setCallback ( eventName[, event] ) Sets the callback of the NPC, so it triggers the callback when the image is clicked. Parameters: - eventName (string) : callback's name - event (function) : function triggered when the callback is called Returns: (npc) self • npc:setDimension ( width, height ) Sets the NPC size/dimension (for callbacks, only). Parameters: - width (int) : the NPC's width. (default = 1) - height (int) : the NPC's height. (default = 1) Returns: (npc) self • npc:setPosition ( x, y ) Sets the NPC's position. Parameters: - x (int) : the horizontal position of the NPC. (default = 0) - y (int) : the vertical position of the NPC. (default = 0) Returns: (npc) self • npc:setState ( newState ) Defines the current frame collection of the NPC. Parameters: - newState (string) : the name of the frame collection. Returns: (npc) self • npc:static ( ) Sets the NPC as static (that doesn't move) and ends all the actions. Returns: (npc) self https://github.com/Lautenschlager-id/Transformice/blob/master/Others/NPC%20class.lua To initialize your NPC, create a new instance of npc with a frame collection. Each collection is a table, containing its name and the images. Code Lua 1 2 3 4 5 6 { -- Collections Dernière modification le 1566684600000 |
1 | ||
Nice job Bolo !!! <3 |
1 | ||
Good job. !:) |
Honorabilis « Consul » 1530001920000
| 1 | ||
Good job! |
Bishomilad « Citoyen » 1531140900000
| 1 | ||
it's perfect bolo |
Bolodefchoco « Sénateur » 1532904480000
| 0 | ||
Thread updated. New functions and bug fixes! |
Sebafrancuz « Consul » 1532950620000
| 1 | ||
Good job |
1 | ||
OP as usual |
Omarpasha « Citoyen » 1536364740000
| 1 | ||
Is that work out of tribehouse only ? there is an "addImage" on code. |
Sebafrancuz « Consul » 1536406740000
| 2 | ||
Omarpasha a dit : No, it doesn't work in tribehouse, you can ask anyone from Module Team to launch code for you. |
Flasher « Citoyen » 1546027440000
| 0 | ||
not working ! |
Bolodefchoco « Sénateur » 1546030140000
| 0 | ||
Flasher a dit : You have to be a module team member in order to test it correctly, since it uses images and timers. |
Flasher « Citoyen » 1546432440000
| 0 | ||
• # [*SomeReach] Init Error : [string "Flasher#4080.lua"]:13: unfinished string |
Bolodefchoco « Sénateur » 1546433460000
| 0 | ||
Flasher a dit : it's your script then, cuz line 13 there's not a string in the source |
Ahmadmide « Consul » 1546500180000
| 0 | ||
Good job. !: |
Mikou20 « Citoyen » 1680811920000
| 0 | ||
... not working :/ |