Menu

Show posts

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.

Show posts Menu

Messages - Cadwyn

#1
Thank you!
#2
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:

-- 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?