ghype's Problems:
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.
Re: ghype's Problem: [side] + custom unit
Thanks a lot ! it worked.Lord-Knightmare wrote: ↑November 25th, 2020, 6:22 pm The problem is where I suspected. Your custom unit is inunits/dunefolk
but you are not including that subdirectory in your[+units][/units]
. Thus, it will never be loaded in game. You have to include it with:
Do I have to include every subdirectory of untis there?
Thanks for noticing!beetlenaut wrote: ↑November 25th, 2020, 6:39 pm You also have to fix the end tags of the attacks in the unit file or it will still fail to load.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ghype's Problem: [side] + custom unit
Yes. The standard way of organizing the unit files (if you have a lot of them) is to use prefixes in the file names instead of using subdirectories. Take a look at the undead in core to see what I mean: All the filenames start with a prefix like Spirit or Skele.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: ghype's Problem: [side] + custom unit
I'll keep that in mind. Probably won't have that many.beetlenaut wrote: ↑November 25th, 2020, 8:32 pm Yes. The standard way of organizing the unit files (if you have a lot of them) is to use prefixes in the file names instead of using subdirectories. Take a look at the undead in core to see what I mean: All the filenames start with a prefix like Spirit or Skele.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
ghype's Problems: adding custom ability
Last one for 2day. I seem to struggle at the most basic things ...
so now I tried to implement my first ever event based ability into a campaign. This is the error I get:
the abilities.cfg lays in my utils subdirectory and as shown earlier the binary paths are included:
According to the error, the engine finds the ability on the unit I want it to be used on. The ability it self is not found in the ability.cfg where I defined it. Here is the structure of the ability and I wonder if something is wrong
with the structure or the ability itself.
The Ability intends to add 5 mp when ever the current mp of the unit becomes 0.
Since I cannot test due to the error above and it is the first time I use variables to that excess, I don't know if that even works as intended.
So if you have some thoughts on that, they would be appreciated. Thansk.
so now I tried to implement my first ever event based ability into a campaign. This is the error I get:
Code: Select all
Macro/file 'PL_ABILITY_ENDLESS_MP' is missing
at ~add-ons/Plagued/units/dunefolk/Khyret.cfg:20
included from ~add-ons/Plagued/_main.cfg:67
binary_path
with the structure or the ability itself.
Code: Select all
#textdomain wesnoth-Plagued
#define PL_ABILITY_ENDLESS_MP
[dummy]
id=PL_endless_mp
name= _ " "
description=_" "
[/dummy] # wmlxgettext: [abilities]
[/abilities]
[event]
name=no_mp
first_time_only=no
id=PL_endless_mp
[set_variable]
name=no_mp
value=0
[/set_variable]
[store_unit]
[filter]
ability=PL_endless_mp
[/filter]
variable=endless_mp
[/store_unit]
[if]
[variable]
name=endless_mp.moves
equals=no_mp
[/variable]
[/if]
[then]
{VARIABLE_OP furious.moves add 5}
[/then]
[unstore_unit]
variable=endless_mp
[/unstore_unit]
[/event]
[+abilities] # wmlxgettext: [/abilities]
#enddef
Since I cannot test due to the error above and it is the first time I use variables to that excess, I don't know if that even works as intended.
So if you have some thoughts on that, they would be appreciated. Thansk.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ghype's Problems
You only define the macro after trying to use it in your unit file. You need to include the utils folder before [+units].
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
ghype's Problems: [ability] adding mp
seems legit. it found it now and had some syntax errors meaning that it found the ability.beetlenaut wrote: ↑November 26th, 2020, 1:46 am You only define the macro after trying to use it in your unit file. You need to include the utils folder before [+units].
however, i realised that the initial draft for the ability, which should add 5mp once all mp are consumed, was not doing that. (mostly because if forgot the
[fire_event]
tag). So I rewrote it and I am think I got the structure right.Sadly it still doesn't do anything, but it also does not give me any errors.
Any one can tell me what I have to change in order for it to do something?
Code: Select all
#define PL_ABILITY_ENDLESS_MP
[dummy]
id=PL_endless_mp
name= _ " "
description=_" "
[/dummy] # wmlxgettext: [abilities]
[abilities]
[event]
name=no_mp
first_time_only=no
[store_unit]
[filter]
ability=PL_endless_mp
[/filter]
variable=endless_mp
[/store_unit]
{VARIABLE_OP endless_mp.moves add 5}
[unstore_unit]
variable=endless_mp
[/unstore_unit]
[/event]
[fire_event]
name=no_mp
[filter_condition]
[variable]
name=endless_mp
euqals=0
[/variable]
[/filter_condition]
[/fire_event]
[/abilities] # wmlxgettext: [/abilities]
#enddef
stuff I worked on: Dunefolk Rework - ghype's Daily Art
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ghype's Problems: [ability] adding mp
All tags are only allowed in specific places. You can't use [event] or [fire_event] inside [abilities]. They are only allowed under [scenario], [unit_type], and [era]. If you use them anywhere else, they are ignored. You are probably using this inside an [abilities] tag already, so you have to drop out of it temporarily (with [/abilities]) to define the events inside [unit_type]. Then use [+abilities] at the end to go back to the original tag.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: ghype's Problems: [ability] adding mp
yeah, i had that initially that way as every event based ability seems to be that way. I however was confused by the [/ability] in the start of the code as I didn't knew whatbeetlenaut wrote: ↑November 26th, 2020, 7:29 pm You are probably using this inside an [abilities] tag already, so you have to drop out of it temporarily (with [/abilities]) to define the events inside [unit_type]. Then use [+abilities] at the end to go back to the original tag.
# wmlxgettext: [abilities]
was for. But now I understood that is for exactly that: temporarily jumping out of the ability tag. So thanks for clearing that up.Nonetheless, it still doesn't do anything. The [event] I coded seems straight forward. Is the [fire_event] wrong?
Code: Select all
#define PL_ABILITY_ENDLESS_MP
# wmlxgettext: [abilities]
[dummy]
id=PL_endless_mp
name= _ " "
description=_" "
[/dummy]
[/ability]
[event]
name=no_mp
first_time_only=no
[store_unit]
[filter]
ability=PL_endless_mp
[/filter]
variable=endless_mp
[/store_unit]
{VARIABLE_OP endless_mp.moves add 5}
[unstore_unit]
variable=endless_mp
[/unstore_unit]
[/event]
[fire_event]
name=no_mp
[filter_condition]
[variable]
name=endless_mp
euqals=0
[/variable]
[/filter_condition]
[/fire_event]
[+abilities]
# wmlxgettext: [/abilities]
#enddef
stuff I worked on: Dunefolk Rework - ghype's Daily Art
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ghype's Problems: [ability] adding mp
You used [/ability] instead of [/abilities] in the end tag. You also spelled "equals" wrong.
I didn't notice before, but [fire_event] won't work here either. That filter should just be part of the event.
The wmlgettext comments are ignored by the game and don't do anything in your code. They are only read by the wmlgettext program, which is used by translators. It can't process tags correctly when they are broken up, so fake beginning and ending tags are put in to keep it happy.
I didn't notice before, but [fire_event] won't work here either. That filter should just be part of the event.
The wmlgettext comments are ignored by the game and don't do anything in your code. They are only read by the wmlgettext program, which is used by translators. It can't process tags correctly when they are broken up, so fake beginning and ending tags are put in to keep it happy.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: ghype's Problems: [ability] adding mp
If I revert to the fake tags, i get this error. It finds the [/abilities] as closing tag for the [unit_type]. Seems like my fake tags won't work. The code remained the same as before, I just fixed the "equals" as well.beetlenaut wrote: ↑November 26th, 2020, 10:05 pm You used [/ability] instead of [/abilities] in the end tag. You also spelled "equals" wrong.
Code: Select all
Found invalid closing tag [/abilities] for tag [unit_type]
opened at ~add-ons/Plagued/units/dunefolk/Khyret.cfg:3
included from ~add-ons/Plagued/_main.cfg:68
closed at ~add-ons/Plagued/utils/abilities.cfg:10
included from ~add-ons/Plagued/_main.cfg:65
included from ~add-ons/Plagued/units/dunefolk/Khyret.cfg:20
included from ~add-ons/Plagued/_main.cfg:68
beetlenaut wrote: ↑November 26th, 2020, 10:05 pm I didn't notice before, but [fire_event] won't work here either. That filter should just be part of the event.
I initially had that filter in the [even] tag as well. Then I read / remembered that custom events need an [fire_event] in order to be triggered. If I remove that, how else is it gonna be triggered?
UPDATE:
Hejnewar showed me an easier way to code it with event enter/exit hex, so i wont need the [fire_event] no longer. But I still need to make the dummy work. I won't get around that error.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ghype's Problems: [ability] adding mp
Just take out the wmlgettext lines for the time being. They aren't doing anything, and they can't cause or fix any errors, but they are confusing the issue. You don't need them until your campaign is getting translated.
You must have another error where this code is included. You may have misspelled the [abilities] opening tag in the unit file.
That's what the name key is for: it describes when the event is triggered. That's how all events are triggered. You probably do want
name=enter_hex
. [fire_event] is rarely needed. It's for more complex code than this.Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: ghype's Problems: [ability] adding mp
The problem is that you wrote ability in singular, but the tag is called abilities nevertheless.
Let me throw in a variant with [heal_unit] instead of storing & unstoring:
The part with the [+abilities] tag is just trickery, the event's could also be inserted separately somewhere else without that.
For the [fire_unit] part, maybe below code makes clear the usage. moveto / enter_hex (with space as well as underscore) is one of the few events fired by the engine, all others are only fired by us:
Let me throw in a variant with [heal_unit] instead of storing & unstoring:
Code: Select all
#define PL_ABILITY_ENDLESS_MP
# wmlxgettext: [abilities]
[dummy]
id=PL_endless_mp
name= _ "…"
description= _ "…"
[/dummy]
[/abilities]
[event]
name=moveto
# ID is needed here, so that if two units with the ability exist
# the event will only be inserted once
id=no_mp
first_time_only=no
[filter]
ability=PL_endless_mp # so it's not triggering for say a Spearman
x,y=$x1,$y2 # so it's only for that one unit, not every with the ability
[/filter]
[heal_unit]
[filter]
id=$unit.id
[/filter]
amount=0
restore_statuses=no
moves=full
[/heal_unit]
{CLEAR_VARIABLE heal_amount} # [heal_unit] always sets this variable
[/event]
[+abilities]
# wmlxgettext: [/abilities]
#enddef
For the [fire_unit] part, maybe below code makes clear the usage. moveto / enter_hex (with space as well as underscore) is one of the few events fired by the engine, all others are only fired by us:
Code: Select all
[event]
name=moveto
id=no_mp
first_time_only=no
[filter]
ability=PL_endless_mp
x,y=$x1,$y2
[/filter]
[fire_event]
name=another event
[primary_unit]
id=$unit.id
[/primary_unit]
[/fire_event]
[/event]
[event]
name=another event
first_time_only=no
[heal_unit]
[filter]
id=$unit.id
[/filter]
amount=0
restore_statuses=no
moves=full
[/heal_unit]
{CLEAR_VARIABLE heal_amount} # [heal_unit] always sets this variable
[/event]
Try out the dark board theme.
ghype's Problems: endless mp
Thank you guys for your efforts. I really cannot tell why this ain't work. When I developed and implemented my era into Ageless_Era for example, I had no problem with the dummy events. Now for some reason It won't work any more just as easy.
Does that might be the reason?
-------------------------
Anyhow, as mentioned in my last post, Hejnewar showed me a very simple way to make this "ability" work.
And it works! Placed in the prestart event.
Then I was thinking, OK how do I turn it on and off. Purpose of the ability is able to explore a vast map without having to end turns all the time. Certainly it should not work once you get in combat.
So I was thinking to set a variable and as long that variable has a certain value (0 or 1) it does that event. That way I can set it to 0 right before a combat. So this is what I came up with. This is placed in the prestart event:
It sadly does it now fails to load the entire scenario. I was thinking that I could do it also with an [if] but the [while] seemed better suiting for the purpose. As simple as it seems, what did I not take in account?
This I already fixed in the previous version of my code.
I used your suggestions and I cannot check if they work as I still get the same error as before.
I don't use the [abilities] tag at all in my unit file. I use the macro {PL_ABILITY_ENDLESS_MP} for example.beetlenaut wrote: ↑November 27th, 2020, 6:21 pm You must have another error where this code is included. You may have misspelled the [abilities] opening tag in the unit file.
Does that might be the reason?
-------------------------
Anyhow, as mentioned in my last post, Hejnewar showed me a very simple way to make this "ability" work.
Code: Select all
## making endless movepoints
[event]
name = moveto
first_time_only = no
[modify_unit]
[filter]
side = 1
[/filter]
moves = 5
[/modify_unit]
[/event]
Then I was thinking, OK how do I turn it on and off. Purpose of the ability is able to explore a vast map without having to end turns all the time. Certainly it should not work once you get in combat.
So I was thinking to set a variable and as long that variable has a certain value (0 or 1) it does that event. That way I can set it to 0 right before a combat. So this is what I came up with. This is placed in the prestart event:
Code: Select all
## making endless movepoints
[set_variable]
name=exploration
value=1
[/set_variable]
[while]
[variable]
name=exploration
equals=1
[/variable]
[do]
[event]
name = moveto
first_time_only = no
[modify_unit]
[filter]
side = 1
[/filter]
moves = 5
[/modify_unit]
[/event]
[/do]
[/while]
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Problems: endless mp
You could use [filter_condition] on the moveto event to turn it on and off.
Maybe, you could also add unit.id in the filter instead of modifying all of side 1 in every movement.
The while loop seems to go into an infinite loop. And I think it will create many many moveto event and all of them will trigger on any movement!
Maybe, you could also add unit.id in the filter instead of modifying all of side 1 in every movement.
The while loop seems to go into an infinite loop. And I think it will create many many moveto event and all of them will trigger on any movement!
Re: ghype's Problems: endless mp
I changed according to your suggestion and keeps on working:
Code: Select all
## making endless movepoints
[event]
[set_variable]
name=exploration
value=1
[/set_variable]
name=moveto
first_time_only=no
[modify_unit]
[filter]
side=1
[filter_condition]
name=exploration
equals=1
[/filter_condition]
[/filter]
moves=5
[/modify_unit]
[/event]
Code: Select all
# this somehwere later in another event
[set_variable]
name=exploration
value=0
[/set_variable]
stuff I worked on: Dunefolk Rework - ghype's Daily Art