Any easier way to do shop locations?
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.
Any easier way to do shop locations?
Currently most shop code I see needs the 6 hexes surrounding the shop unit listed.
I tried something else...
[show_if]
[have_unit]
[filter_adjacent]
x=20
y=20
is_enemy=no
[/filter_adjacent]
side=$side_number
[/have_unit]
[/show_if]
This does actually detect and call up the shop if you are next to it, unfortunately, it can be accessed by any unit on the same side.
I am wondering if there is another way to filter it so that it would only detect the unit next to the shop unit.
To keep the code smaller, I made all healers one shop since they serve the same purpose, where ever they are. And the code above does detect if a unit is at the xy so dead shop keepers (if the players get sloppy) won't allow shopping.
Any ideas?
I tried something else...
[show_if]
[have_unit]
[filter_adjacent]
x=20
y=20
is_enemy=no
[/filter_adjacent]
side=$side_number
[/have_unit]
[/show_if]
This does actually detect and call up the shop if you are next to it, unfortunately, it can be accessed by any unit on the same side.
I am wondering if there is another way to filter it so that it would only detect the unit next to the shop unit.
To keep the code smaller, I made all healers one shop since they serve the same purpose, where ever they are. And the code above does detect if a unit is at the xy so dead shop keepers (if the players get sloppy) won't allow shopping.
Any ideas?
Re: Any easier way to do shop locations?
[have_unit] asks a question about does any unit exist matching this?
maybe you intended to ask a question about the unit at $x1,$y1 instead.
try this:
maybe you intended to ask a question about the unit at $x1,$y1 instead.
try this:
Code: Select all
[show_if]
[have_unit]
x,y=$x1,$y1
[filter_adjacent]
x=20
y=20
is_enemy=no
[/filter_adjacent]
side=$side_number
[/have_unit]
[/show_if]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."