Thank you!
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.
Pages1
#1
Development / Re: I need some help to customize the command "action".
December 28, 2014, 03:55:04 PM #2
Development / Re: I need some help to customize the command "action".
December 28, 2014, 01:38:49 AM
Hello. I am doing something similar, trying to customize the action command so that the hero can jump when not performing another action (as if they had the feather item). Unfortunately I am very new to lua coding and am not sure how to implement this. Here is the code I have so far:
However, I'm not sure even where to put this code where it might work. I tried putting it in the main.lua script, but nothing happens. Is there somewhere else I should put it? Would the code not even work at all as written?
Code Select
-- Event called when action button is pressed while not near any interactable entities
local command = game:is_command_pressed("action")
if command and game:get_command_pressed("action") == nil then
sol.audio.play_sound("jump")
local hero = self:get_map():get_entity("hero")
local direction4 = hero:get_direction()
hero:start_jumping(direction4 * 2, 32, false)
self:set_finished()
end
However, I'm not sure even where to put this code where it might work. I tried putting it in the main.lua script, but nothing happens. Is there somewhere else I should put it? Would the code not even work at all as written?
Pages1