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.

Messages - froggy77

Pages: 1 ... 5 6 [7] 8 9 10
Development / Re: Save Game
« on: January 16, 2016, 08:04:50 pm »
I think you wrote the solution
The Solarus Write Directory is already set.
  -- Directory where your quest will write its savegames and setting files.
  -- It will be a subdirectory of '$HOME/.solarus/', automatically created by
  -- the engine. Its name should identify your quest, to avoid confusion with
  -- other Solarus quests that might also be installed on the user's machine.
  -- You must define it before you can use savegames or setting files.
  -- Uncomment the line below and set its value to the name of that directory:
   write_dir = "tuto_quest_en",

In the directory $HOME/.solarus/ or  %UserProfile%\.solarus (for Windows),
it may be that there is an existing subdirectory named "tuto_quest_en".
Just rename it into, for example, "tuto_quest_en_old" and restart the Quest Editor to update the version.

Development / Re: Possible to create a level up system?
« on: January 10, 2016, 03:04:16 pm »
Thank you for answering. If I understand you, I should not use my enemy metatable for this, but only enemy scripts.

I also used the metatable for the hero: I created "hero:get_xp()" and "hero:set_xp(xp, boolean)" functions .(Maybe I will also create "hero:add_xp(xp)" ). It works fine, but I had then added a value in the backup file, otherwise I lost the xp value when I backed up and left the game. It would be easier without metatables for backups and to avoid having a value that is outdated.
I have another question:
Is it better to often read a value inside a metatable or a value from a backup file?

I put this code in the quest_manager.lua, maybe it is not the best file.

Code: (Lua) [Select]
-- Initializes some behavior of our hero.
local function initialize_hero()

  local hero_meta = sol.main.get_metatable("hero")
  -- ZL --  Functions for experience points of our hero
  hero_meta.t_xp = {k_xp = nil}
  function hero_meta:set_xp(v_xp, bool)
local game = self:get_game()
v_xp = v_xp or nil
bool = bool or false -- false means "do not save" with a set_value.
if type(v_xp) == "number" and type(bool) == "boolean" or bool == nil then
hero_meta.t_xp.k_xp = v_xp
if bool == true then
game:set_value("xp", v_xp)
print("error in set_xp(v_xp, bool)")
  function hero_meta:get_xp()
local game = self:get_game()
local xp = game:get_value("xp")
if hero_meta.t_xp.k_xp == nil then
local hero = self:get_map():get_hero()
-- print("xp from file = ", xp)
hero:set_xp(xp) -- xp value is now in the metatable
return xp
-- print("xp from metatable = ", hero_meta.t_xp.k_xp)
return hero_meta.t_xp.k_xp


function quest_manager:initialize_quest()

  -- blablabla
  -- blablabla


EDIT: I said "backup file" (for save1.dat, save2.dat or save3.dat), but I should have said "buffer";  e.g "xp = 100" is first read in a "backup file" and then the value is in the buffer of the engine. But with my method, I have xp value in the buffer (with other values found in the saveX.dat) + in the metatable which also used memory: I think my method is stupid, and I should avoid to insert data in the metatable.

Development / Re: Possible to create a level up system?
« on: January 10, 2016, 12:01:44 pm »
Very interesting subject , at least for me, because I started a little scripting experience points .
If you want to give xp to each kill of enemy, you can modify the enemy metatable to add the xp value of enemy to the xp counter of your hero (it can be a formula if easy enemy give you less and less xp to avoid the "easy farm" ^^).
I modified the enemy metatable to add the xp value, but the problem is that the value is common to every enemy. It could be ok for a bonus. I have probably misunderstood.

Thank you for your test.
I also tested with Mystery of Solarus (engine v1.4.2) and the problem is the same. It is not really a bug, but I would be happy to find a solution, even if it is just a workaround.

I use a destructible entity, not a custom entity.
Not so cool for me. 8)

Development / Help: destructible / regenerate / lift / animation and sound
« on: November 21, 2015, 07:59:19 pm »

I would like an object that can regenerate.
But, my problem is that when I tick the option to regenerate, there are two animations of destruction:
First, there is an animation of destruction (with the sound) when the hero begins to lift an object
 and then, there is the same animation and the same sound when the hero is destroying this objet (after having throwing it).
The first animation is OK for a "flower bomb", not too ugly for a bush, but strange for a rock or something in wood.

Is there a way to have two animations and sounds or even delete the first animation of destruction and its sound?
I tried with metables, but I did not succeed.

Thanks in advance.

I have put some rectangles that have some " ? " into it. I have called it as "exit_sensor", then i have copy it and past it, and ive notice that it is writen "exit_sensor_2", etc, etc.
This is normal. Different sensors with the same name (e;g: "exit_sensor",  "exit_sensor_2",  "exit_sensor_3") can activate the same  object (They can open a same door if the object is a door).

The next thing i wonder, is that the software "Tree" on the left. There is the folder called "script". I wonder if it is there i add the script that i could call as example: "town_exit_sensor.lua"?
No, it is easier in the map script as explained in tutorials (see below). In the tree, "solarus" > "maps" > Right click on the map > and "Open map script"

- Part 13: Lost Woods (youtube)
- Chapitre 13 : Les Bois Perdus (youtube)
- Chapitre 13 : Les Bois Perdus (Adaptation écrite)

Bugs & Feature requests / Re: Trying to get where the item is ...
« on: October 26, 2015, 12:00:30 pm »
You forgot an "end" in your function.

Otherwise, I would test with something like that:
Code: [Select]
if game:get_value("_item_slot_1") == "bow" or game:get_value("_item_slot_2") == "bow" then

Development / Re: Help? :/
« on: October 18, 2015, 12:35:09 pm »
I use to test and understand basic commands of Lua (There are different languages).

Your projects / Re: Solarus - ZL project
« on: October 18, 2015, 04:12:55 am »
Thank you, polyglot762  :)
I tried to follow the board members of another forum: new clouds, smaller sun and softer color frame at the horizon.
The island is slightly adapted to the new pixel art .

New pixel art with 11 colors again, most of which are taken from the first pixel art:

Just a mockup of a dragon of fire. Hope it will not too difficult to script. ;)

A memory with Solarus!!! Solarus is so 8).  I want to improve my scripting skills before beginning to animate for example a boss with all its attacks.
The Memory will be a mini game, but I think it will be include it in my main project.

Your projects / Re: Solarus - ZL project
« on: October 11, 2015, 01:28:04 am »
I drew this background image which will be probably used for the credits . There are 11 colors.

Are the colors of the image correct? Clouds not too ugly ?
Things that are not corrects?

Development / Re: Scrolling credits
« on: October 10, 2015, 05:57:55 pm »
I share my script if you like. I think it's pretty simple to customize.

Development / Problem with fade_in and fade_out methods
« on: October 04, 2015, 06:53:51 pm »

I don't know if there is a bug with the following methods:
drawable:fade_in([delay], [callback])
drawable:fade_out([delay], [callback])

I make maybe some mistakes in the use of these methods. :-[
These methods work, but at the end, the chosen colors are not exactly the same.
When I picked the color in an image editor (e.g. Gimp), I can see it's darker.
It is as if the surface kept a little transparency at the end of my fade_in() . Even when I used surface:clear()

So instead of writing this,

I write this:
self.bg_surface:fade_in(20, function () self.bg_surface:set_opacity(255) end)

This workaround may not work with text_surface, because there is no text_surface:set_opacity(opacity)
Is there a solution?

Development / Re: Problems with dialog and HUD
« on: September 09, 2015, 12:19:28 am »
In game_manager.lua, I would replace

Code: ( lua) [Select]
  -- Function called when the player goes to another map.
   game.on_map_changed = function(game, map)
  -- Notify the HUD (some HUD elements need to know that).

by this:

Code: ( lua) [Select]
  -- Function called when the player goes to another map.
   function game:on_map_changed(map)
  -- Notify the HUD (some HUD elements need to know that).

If I were you , I would start with the basic menu of Zelda Mystery of Solarus DX, then I would adapt it to my needs. In fact, this is how I proceed. ;)

Just minor changes for the moment :-[
- A new hud for the hearts (link).
- Added an icon next to the caption text when the item is selected.
- Changed the size of icons in the dialog box. 16 pixels wide , it was too small for face sprites.
- The title of sub-menus is a text surface and not a picture. I also found a way to get a gradation of colors playing with several text surfaces.

Pages: 1 ... 5 6 [7] 8 9 10