16
Bugs & Feature requests / Re: Lttp tileset not being recognized.
« on: July 21, 2019, 07:24:27 PM »
It may sound dumb, but did you register the tileset to the database using "add to quest" right-click option in the file tree?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
To make sure I am understanding this right, you mean to say the code should look more like this?:Code: [Select]map_meta:register_event("on_started", function(camera)
--stuff
end)
map_meta:register_event("on_started", function(map, destination) --the destination is optional in our case, but this is for completeness regarding the API examples
--your map initialization code
end)
when they wroteCode: [Select]self.get_camera()
they should have instead writtenCode: [Select]self:get_camera()
or
self.get_camera(self)
, right?
map_meta:register_event("on_started", function()
--stuff
end)
you forgot to add an argument for the map object which is needed to fetch the camera and which is automtically passed by the event. Speaking of "self", your code will be easier to read and debug if you use an explicitely named variable for the first argument.
--[[
The game utilities
This file manages low-level operations such as save management
and manages game handling operations such as getting/setting hero's parameters
(life, money, position) or initializing the game parameters
Include it in your scripts if you need some function that couldn't get in other ways,
especially in menus or for debug purpose.
--]]
local gu={}
--[[
+---------------+
| GAME HANDLING |
+---------------+
--]]
local file_utils=require("scripts/utilities/files")
--print("[game manager] INFO : Preloading file")
local game=nil
local debug={ <---la variable fautive
enabled=true,
show_grid_marker=true,
show_debug_hud=true,
}
function gu:is_debug_enabled()
return debug.enabled
end
function gu:show_debug_hud()
return debug.show_debug_hud
end
function gu:show_grid_marker()
return debug.show_grid_marker
end
--<plein de fonctions de management de quete>
return gu
Error: In on_started: scripts/system/game_utils.lua:30: attempt to index upvalue 'debug' (a nil value)
stack traceback:
[C]: in function '__index'
scripts/system/game_utils.lua:30: in function 'is_debug_enabled'
menus/hud.lua:50: in function <menus/hud.lua:41>
[C]: in function 'start'
scripts/system/quest_initializer.lua:28: in function <scripts/system/quest_initializer.lua:27>
quand j'essaye d'appeler la fonction gu:is_debug_enabled() depuis un autre fichier.[code= lua]
at start of your code is helpful indeed
The problem is that the engine expects NPC to have 4 sprite directions, and i suppose you only put 2 in your animation. To fix this, you must duplicate some of its directions to have all 4 required, in case you want to add more to the path.
Another thing to precise is that your movement might not loop as you scripted it.Use movement:set_loop() to define whever you want it to loop or not.
Also, you can use timers to enhance your moves, like, walk to point A, wait, turn left, wait, go to point B, wait, etc. I suppose it is not in your priorities yet, but it will definetely add live to your NPC.
function <id>
, the content of the parenthesis is the declaration of variable(s) that you want to be passed on callfunction map:on_started(movement:start(traveller_2))
is not correct and is likely to generate odd behaviour if not triggering an error. movement:set_path{4,4,4,4,4,0,0,0,0,0}
you forgot the parenthesis around the list content, since you wnt to call the set_path function. (which may be why you got the error message in the first place)