Author Topic: Id like that i need to do something, wich make possible to leave the town map  (Read 3595 times)

20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
Hi i have build in Solarus some town. The player start from a home, the player can get out of his home, but can not get out of the first town if the player has not done some action. Like talk to a wise men, that after could give him an item wich would make possible to go outside of town. Or like the player would open some chess wich have some item, this would make possible to go outside of town. Like some thing would block to some teleport, that go to some other map; if some action would not have been done.

It is also important that when some item is taken as a sword, that the item sword can not be taken again; and that entering and beeing into this town. The player dont need to do again some action to get outside of town. I wonder how to do it and how to script it?

The other thing id like to do is that when the player in front of a mailbox, a caracter or other. That it show's some text with the action button. Also if some event have not have been done the caracter, mailbox or other; this can create new events. Like a player can look at the mailbox and say it have nothing, do some event after go to the same mailbox read some new text or even have some item (potion/rubys/etc). Same thing as do some event and talk to some caracter that say others or/and give item.

I'll have more questions trough time, as i am a beginner. I try to understand and do the youtube tutorial videos and read the documentation; but find it hard as a none-programmer.

Thank's for your time and help. A+

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
If you need to check if the hero have some items before leaving it I recommand using a sensor 8pixels before the teleport thing.
And in your map script, grab the sensor name. it should look like this (sword)

Code: (lua) [Select]
function my_sensor:on_interaction()
local sword = game:get_item("sword")
if sword:get_ability("sword") == 0 then
message and movement
else
my_sensor:remove()
end
end

I'm not sure if this is the right thing to do, I don't have solarus in the computer I'm using, I'm skeptin about the get_ability line, but this shall do the work
« Last Edit: October 27, 2015, 09:31:15 pm by Username »

20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
I wonder how to create a sensor? I dont see in the top menu of Solarus the word "Sensor". I see as "Teleport/Jump/Wall/etc"

I wonder if by placing a wall, if it can act as a sensor?

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
I wonder how to create a sensor? I dont see in the top menu of Solarus the word "Sensor". I see as "Teleport/Jump/Wall/etc"

I wonder if by placing a wall, if it can act as a sensor?

It's in the map toolbox (the pannel up to the map you're making), the sensor is the question mark icon

20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
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.

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

froggy77

  • Full Member
  • ***
  • Posts: 128
    • View Profile
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)


20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
I try to understand the document. I read it say to put some script on the map page that have the sensor. Here is what i have writen, but not sure if i understand correctly.

Code: [Select]
-- This create the sensor on the VR map
function vr_exit_sensor:on_interaction()
  local sword = game:get_item("sword")
    if sword:get_ability("sword") == 0 then
      map:get_game():start_dialog("village.vr.exit")
      hero:set_direction(x+20)
    else
    vr_exit_sensor:remove()
  end
end

function vr_exit_sensor_2:on_interaction()
  local sword = game:get_item("sword")
    if sword:get_ability("sword") == 0 then
      map:get_game():start_dialog("village.vr.exit")
      hero:set_direction(x+20)
    else
    vr_exit_sensor_2:remove()
  end
end

The "vr" is the name of the map. The "village.vr.exit" is some dialog. The "vr_exit_sensor_2" is an other sensor on the map. I have seen in the document "hero:set_direction()" indicate to make the hero go in some direction. So i have think to say that the hero X coordinate say the current position + "plus" 20; wich i think go on the right.

I'm not sure if this kind of script is ok?

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Or else you could create a custom entity that handle this, it works the same way than the sensor, but this time you don't need to copy paste the script on the map script and on every sensors.
It works like a sensor, but everything is centralised in a single script

Code: (lua) [Select]
local entity = ...

local function movement_hero()
local hero = entity:get_game():get_hero()
    local movement = sol.movement.create("straight")
    local angle = hero:get_direction() * math.pi / 2 -- opposite of the current direction
    movement:set_speed(88) -- default hero speed
    movement:set_angle(angle)
    movement:set_smooth(false)
    movement:set_max_distance(32) -- 32 pixels
    movement:start(hero)
end

function entity:on_interaction()
  local sword = entity:get_item("sword")
    if sword:get_ability("sword") == 0 then
      map:get_game():start_dialog("village.vr.exit", function() -- after the text, move the hero
      movement_hero() end)
    else
    self:remove()
  end
end

« Last Edit: October 28, 2015, 03:17:07 pm by Username »

20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
I have tryed the code dont know why it dont seem to work. Maybe there are things i must do? I'm not so good compared to most peoples here beside me, that are genius beside me; but i try to learn to do things as to program correctly.

Ive created a Github account, but still try to figure out how can i put the folder "data" so you can see what ive done so far with the Solarus Quest Editor. Most sprites, maps, items come from the game Solarus DX. It is only a personnal project. Not a project to make some money and not a project to make any profits of any kinds at any times. So some family member can play the game and some friends.

Also i try to understand how to put my folder "map", of the outside world that 81 maps are linked; so that peoples can see better my vision of the personnal project. There is really not much done, but it is a big size project with much to do.

I hope finding out how to put the Solarus "data" folder on Github, that it will help?

Once again thank's for your help! A+

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
I have tryed the code dont know why it dont seem to work. Maybe there are things i must do? I'm not so good compared to most peoples here beside me, that are genius beside me; but i try to learn to do things as to program correctly.

Ive created a Github account, but still try to figure out how can i put the folder "data" so you can see what ive done so far with the Solarus Quest Editor. Most sprites, maps, items come from the game Solarus DX. It is only a personnal project. Not a project to make some money and not a project to make any profits of any kinds at any times. So some family member can play the game and some friends.

Also i try to understand how to put my folder "map", of the outside world that 81 maps are linked; so that peoples can see better my vision of the personnal project. There is really not much done, but it is a big size project with much to do.

I hope finding out how to put the Solarus "data" folder on Github, that it will help?

Once again thank's for your help! A+

There might be some error since I didn't tested it and because I'm not on my PC that have Solarus, there might be some tweaks to do.

20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
Solarus is an awsome software, i can even say a great piece of art. I have uploaded on the web what ive done at the time beeing and put it on wikisend. Wikisend say it will keep the file for 7 days, i have put it today.

So if peoples want to see the project i have made, they can download it. It have the "data" folder that have the folders as (ennemys/entities/fonts/script/sprites/tileset/etc). Also have "main.lua", "project_db.dat", "quest.dat"; briefly can help my self. Also can make others help me to understand better the great soft Solarus Quest Editor.

The link i'm gonna write here go to the zip file that contain the "data" folder also it have some folder of the idea of mine of some "world map", but it is a quite basic image with some legend. A world of 81 maps, the image of the basic wold map simply indicate the places that the players can pass from one map to an other (scroll). It indicate the place that have some village and the place position that have an entrance to some dungeon.

But each outside maps details has not been done, like the villages, the houses, the dungeons. It's only as i say, a starting incomplete project. That can progress trough time.

There is only the village at the center of the world ive made and there is only one house map that is made. Ive also made in the "language" the intro story. There are a lot of files that are from Solarus DX source. I'm still at a beginner learning person with the solarus editor.

Even if the zip file has no virus, i encourage peoples that want to take a look of what ive done to simply antivirus check the files. The zipped file is near the size of 6.81mb, here is the link so it might help me:
http://wikisend.com/download/655242/29oct2015_rick_son_of_link.zip

Thank's Username and thank's to the other peoples that have helped me. Id like to impress some family member and some friend for this personnal, none commercial game. So they could play this personnal creation. Maybe some peoples would like to put there talents into it. Ive always dreamed to create my own zelda super nintendo style game for a long time ago.

Once again thank's to all. A+

20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
Hi there.

It seem that there is someone who have replaced the zip file with some other file. I write this for peoples safety. It's been more then 7 days. When i open it with notepad ++ i see a lot of "nul" and other strange things that i dont know. Also i see some text file that is writen some (pbx ip) and say some password??

I wonder what all this mean??