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

#1
Quote from: llamazing on March 19, 2019, 12:49:04 AM
Code (lua) Select

dialog{
  id = "first_dialog",
  next = "second_dialog",
  text = [[
show this dialog first.
]]}

dialog{
  id = "second_dialog",
  text = [[
Then show this dialog.
]]}

This code is relevant to the the language.dat file, not your code. In code call the dialog as you normally would, I.E.
Code (lua) Select
game:start_dialog("sword.first")
Now you have two options from here for calling another dialog. You can either use the callback or, the much cleaner way, use the "next" property key.

I'm just using an image extracted from my own personal project (see attachment 1), so certain properties here are irrelevant (and don't work as the dialog script your using doesn't use these properties).
The value that the property key "next" should be the next dialog that you wish to call.
#2
Your scripts / Re: Simple Leveling up system
March 09, 2019, 01:29:48 AM
Since when did lua only accept integers?
I've done quite a bit of programming in lua where I've used non-integer numbers and the functions math.ceil() and math.floor() exist, which round a number up or down respectively.
#3
I think it's also worth noting that technically, the number of ropes can be changed via other methods that don't involve them being killed, but these are cases in which you'd be doing something in your code and not something that the engine would do on it's own.

I would also advise that the chest activation script for these ropes use a save game variable to check if this challenge has been done before, and set the map state to reflect this. The map won't automatically do this for you on it's own. You'll have to remove the enemies under map:on_started() and enable the chest again.

The method "entity:remove()" won't call the the "enemy:on_dying()" and "enemy:on_dead()" events, so you can safely remove them from the map without code accidentally being executed.
#4
Rather than doing a repeat command and wait until,
you should preform a check on each enemy to check if all the enemies are defeated when they are slain.
like so:
Code (lua) Select

function map:on_started()
  -- Find all the entities named "rope" and define their on_dead() function.
  for rope in map:get_entities("rope") do

    -- Another method of defining a function, One that I like using for dynamically handled code.
    rope.on_dead = function(rope) -- Because the function isn't defined like the other functions here, we need to set the first variable to be the object that this event is being called on.

      if rope:get_map():get_entities_count("rope") <= 0 then
        -- Do things here for making the chest appear, the local variable map will need to be defined inside this function.
        local map = rope:get_map()
        -- map:get_entity("rope_chest"):enable()
        sol.audio.play_sound("chest_appears")
      end

    end

  end

end
#5
Development / Re: Pre-made LttP Maps?
January 29, 2019, 02:29:33 AM
try ffomega's tileset and the sample maps. (Although, it would appear that the images have been lost when the site was transferred to this server.)
http://absolute-hyrule-tutorials.solarus-games.org/
#6
Quote from: Diarandor on August 28, 2018, 02:01:38 AM
I still don't see the aim of this. You can play Solarus on any OS and use controllers and gamepads, or am I wrong?
No you're not.

@Levi, solarus has native controller support. If you're trying to use the d-pad on a controller and it's not working, try using the Left stick. The in game button mappings for a joystick default to the left stick being the movement option.
#7
Quote from: Diarandor on July 17, 2018, 05:29:09 PM
Is it my phone or the movement is not completely smooth? (I do not have internet at home now to check this.)
No, It's also choppy on my PC.
#8
The position of the collision box is based upon where the origin of the sprite is.
#9
Should be. For a while, I was running solarus on a Chromebook. (acer c720 for those who care)
#10
Development / Re: Using chest to open a door
March 06, 2018, 11:36:49 PM
Your usage of arguements in the function is incorrect.

The way defining functions work in lua (And in most if not all programming languages with some differences) is the section within the parentheses are variable only accessible from within the function.
So instead what you would want to do is something like this:

Code (lua) Select

function clothes_chest:on_opened(treasure_item, treasure_variant, treasure_savegame_variable)
  map:get_hero():start_treasure(treasure_item, treasure_variant, treasure_savegame_variable, function() -- The function here is to indicate an event happens after receiving an item
    map:open_doors("exit_door")
    sol.audio.play_sound("door_open")
  end)
end
#11
Development / Re: Issue with doors
September 23, 2017, 05:01:36 PM
You need to have multiple directions for the sprite or simply just set the door's direction to the right.
#12
General discussion / Re: An example of the Engine.
July 29, 2017, 03:41:44 AM
Quote from: ffomega on July 28, 2017, 09:44:52 PM
Very nice :) Do you plan on making a fully-functional engine using LttP-like items?
Eventually, once I can pull myself away from other projects and look back at this one.

Here is a link to the data files; https://drive.google.com/file/d/0B0VY1euKVqfoYU5BQnpSTWVndmM/view?usp=sharing
Although be warned, its in a very clearly development test stage and should be treated as such.

Although the video is a far earlier build of what I currently have, I haven't really touched much of the data in the past few months. (Primarily because I got myself messing about with team fortress 2 and the hammer world editor.)
#13
When drawing out a map, at least for me, I use a base of 16 by 16, and cut said tiles in half for 8 by 8. This will mach up nicely with the tiles of one's map.
So, a 320 by 240 map will have a base 16 grid of 20 by 15.
#14
Development / Re: Item command held on item?
June 19, 2017, 07:09:01 PM
What you'll probably want to do is create a timer (or a set of timers) that count for how long you want the difference of time between the instances of charge.

So doing something like this:
Code ( lua) Select

-- At beinging of code
local timer = nil

--  Code before timers
local function start_timer()
  timer = sol.timer.start(item, 1000, function()
    --code relating to when timer reaches max time
  end) -- This timer lasts 1 sec and belongs to "context" item if defined. To increase the time, change the 2nd value to desired time in milliseconds.

end

local function end_timer()
  local time_remaining = timer:get_remaining_time()
  --code relating to translating time into charge
  --I.E. Total charge value / (time_remaining * -1)
  --return charge_strength
end



See http://www.solarus-games.org/doc/latest/lua_api_timer.html for more details relating to timers.

For checking if the item is being held down, I would look to these sets of events: http://www.solarus-games.org/doc/latest/lua_api_game.html#lua_api_game_on_key_pressed
#15
Development / blend modes
March 13, 2017, 02:23:49 AM
So I was working on a new light_manager script for my quest, but I've run into an issue with (what I think is) an engine limitation.
I'm trying to get it so that one surface applies to another while inverting it's alpha channel content (Opaque becomes transparent and transparent becomes Opaque). I'd write an algorithm myself in lua, but It would seem (Unless I'm missing something), that this is impossible for the moment.