unit move on lava
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- Acho161293
- Posts: 32
- Joined: January 29th, 2020, 10:54 am
- Location: indonesian
- Contact:
unit move on lava
How to make new unit with movement type can move to lava.. . help.
I want to create new type movement unit with animation , if my unit standby on lava. too..
I want to create new type movement unit with animation , if my unit standby on lava. too..
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: unit move on lava
Split from here. Please make your own thread instead of posting unrelated questions in other people's threads.Acho161293 wrote: ↑February 7th, 2020, 11:47 am How to make new unit with movement type can move to lava.. . help.
I want to create new type movement unit with animation , if my unit standby on lava. too..
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: unit move on lava
Lava uses unwalkable type.
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: unit move on lava
To overwrite some aspects of unit movement, use the
Given that lava is a variation of / alias of unwalkable terrain, you will have to change movement on the
Note that the defence tag defines the chance to get hit, not the chance to evade an attack. Thus, a value of 60 translates into a 40% defense on that terrain ingame.
[movement_costs]
and [defense]
tags as described here.Given that lava is a variation of / alias of unwalkable terrain, you will have to change movement on the
unwalkable=
key of the tags named above. To allow your unit to walk on lava, include the following code into your [unit]
tag:Code: Select all
[movement_costs]
unwalkable=1
[/movement_costs]
[defense]
unwalkable=60
[/defense]
Default L0 Era - Level 1 leaders with level 0 recruits!
- Acho161293
- Posts: 32
- Joined: January 29th, 2020, 10:54 am
- Location: indonesian
- Contact:
Re: unit move on lava
Sure. ,But if my unit move to abyss or chasm . It will drift
- Acho161293
- Posts: 32
- Joined: January 29th, 2020, 10:54 am
- Location: indonesian
- Contact:
Re: unit move on lava
how can I make my unit move in lava but cannot move to the abyss. because both have the same type of terrain that is ...unwalkable....
Re: unit move on lava
No simple way. Options are event to knock back units that move where they shouldnt, or creating new terrain type.
- Acho161293
- Posts: 32
- Joined: January 29th, 2020, 10:54 am
- Location: indonesian
- Contact:
Re: unit move on lava
can you help me.. how to make that option.. give me example ..
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: unit move on lava
You could use an enter_hex [event], use a [filter] to check for the terrain type(s) that shouldn't be moved over, and then if they match move the unit back to the previous hex.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: unit move on lava
There's an example in Under the Burning Sun's 06a_In_the_Tunnels_of_the_Trolls, using a
Please ignore any comment about lava being an alias of snow, that's an ancient issue which was fixed in d4d5160543950a1cbeeff5553cc57144daa81428, before Wesnoth 1.3.1. The comment itself is still in 1.14, but will be removed from 1.15.3.
^Yl
terrain overlay defined in data/campaigns/Under_the_Burning_Suns/utils/terrain.cfg.Please ignore any comment about lava being an alias of snow, that's an ancient issue which was fixed in d4d5160543950a1cbeeff5553cc57144daa81428, before Wesnoth 1.3.1. The comment itself is still in 1.14, but will be removed from 1.15.3.
- Acho161293
- Posts: 32
- Joined: January 29th, 2020, 10:54 am
- Location: indonesian
- Contact:
Re: unit move on lava
Hmm. Ok . I will try it..Pentarctagon wrote: ↑February 8th, 2020, 3:48 pm You could use an enter_hex [event], use a [filter] to check for the terrain type(s) that shouldn't be moved over, and then if they match move the unit back to the previous hex.
Re: unit move on lava
Honestly, I wouldn't bother. You may achieve that the unit can't cross unwalkable terrain, but it will not be obvious.
For example, If the shortest place to the destination is over the unwalkable tile, the engine will chose this path when clicking onto the destination tile.
To spin this further, the player may have reached the destination also on a different route without passing over unwalkable terrain. The event about which we talk, would place the unit onto the tile adjacent to the unwalkable tile, the one from which the unwalkable one was entered. But this doesn't have to be the hex from which the move was started, just one which got passed. Depending on the map and unit, the player may now not anymore be able to reach the destination tile.
A completely different problem: You may want to give the unit back the movement points for walking onto the unwalkable tile. You can get this information from the units movement costs, that's easy so far. But if the unit is slowed, you'll have to take that into account too.
In short — using crazy events to overcome limitations usually causes more problems than it solves.
My advice would be to instead adjust the unit's theme to the gameplay: This is a lava unit, which can walk onto lava hexes, and which may also float over unwalkable terrain.
For example, If the shortest place to the destination is over the unwalkable tile, the engine will chose this path when clicking onto the destination tile.
To spin this further, the player may have reached the destination also on a different route without passing over unwalkable terrain. The event about which we talk, would place the unit onto the tile adjacent to the unwalkable tile, the one from which the unwalkable one was entered. But this doesn't have to be the hex from which the move was started, just one which got passed. Depending on the map and unit, the player may now not anymore be able to reach the destination tile.
A completely different problem: You may want to give the unit back the movement points for walking onto the unwalkable tile. You can get this information from the units movement costs, that's easy so far. But if the unit is slowed, you'll have to take that into account too.
In short — using crazy events to overcome limitations usually causes more problems than it solves.
My advice would be to instead adjust the unit's theme to the gameplay: This is a lava unit, which can walk onto lava hexes, and which may also float over unwalkable terrain.
Try out the dark board theme.
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: unit move on lava
On the contrary, my advice would be to make a copy of the lava terrain that's not unwalkable and use that instead of the default lava anywhere. This is perhaps a little complex, as you'd also need to add a new terrain archetype, but it would certainly be the best way of getting the desired result.