traits
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.
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
traits
How can i convert traits from specific campaigns to those traits that come by default (like skirmisher or submerge)
I wanted to just copy everything (imo) relevant to "disengage" trait but it doesn't work properly (actually it doesn't work at all, only the description)
also why this doesn't work, its a dumb question but i need to know why it doesn't work
#define ABILITY_NINJA
[hides]
id=ninja
name= _ "ninja"
description= _ "This unit can hide like a true ninja"
special_note=_"This unit can hide in the forest or in villages, except water ones. And can become almost invisible at night."
affect_self=yes
[filter]
[filter_location]
terrain=*^V*,*^F*,D*^*
[/filter_location]
[filter_location]
time_of_day=chaotic
[/filter_location]
[/filter]
[/hides]
#enddef
I wanted to just copy everything (imo) relevant to "disengage" trait but it doesn't work properly (actually it doesn't work at all, only the description)
also why this doesn't work, its a dumb question but i need to know why it doesn't work
#define ABILITY_NINJA
[hides]
id=ninja
name= _ "ninja"
description= _ "This unit can hide like a true ninja"
special_note=_"This unit can hide in the forest or in villages, except water ones. And can become almost invisible at night."
affect_self=yes
[filter]
[filter_location]
terrain=*^V*,*^F*,D*^*
[/filter_location]
[filter_location]
time_of_day=chaotic
[/filter_location]
[/filter]
[/hides]
#enddef
Re: traits
You should clarify what you mean by doesnt work.
Maintainer of Ageless Era. Ravana's Multiplayer Works
-
- Posts: 1266
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: traits
Yeah, "doesn't work" isn't much to go on. I wonder if this will help (from a [unit] declaration):
Code: Select all
[modifications]
[advancement]
[effect]
apply_to=new_ability
[abilities]
{ABILITY_NINJA}
[/abilities]
[/effect]
[/advancement]
[/modifications]
Speak softly, and carry Doombringer.
- Lord-Knightmare
- Discord Moderator
- Posts: 2370
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Re: traits
What you mean by traits are "abilities" (submerge/skirmisher).
Disengage is not the ability definition itself, rather has a global event which is used in every scenario of that campaign (UtbS) to make it work.
Also, ability Ninja might now work since you have two "[filter_location]" tags. You might wish to combine them into one:
Disengage is not the ability definition itself, rather has a global event which is used in every scenario of that campaign (UtbS) to make it work.
Also, ability Ninja might now work since you have two "[filter_location]" tags. You might wish to combine them into one:
Code: Select all
[filter_location]
terrain=*^V*,*^F*,D*^*
[or]
time_of_day=chaotic
[/or]
[/filter_location]
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
Re: traits
sorry) didn't know how to put it otherwise, bc the only thing i see is it doesn't work, i don't know why or what else can i add to be more specificwhite_haired_uncle wrote: ↑April 16th, 2024, 2:37 am Yeah, "doesn't work" isn't much to go on. I wonder if this will help (from a [unit] declaration):
Code: Select all
[modifications] [advancement] [effect] apply_to=new_ability [abilities] {ABILITY_NINJA} [/abilities] [/effect] [/advancement] [/modifications]
UPD: thank you a lot for helping me out, your code wasn't actually needed at all and all i need to do was what Lord-Knightmare has written, i.e. to combine two filters into one, i added this update bc you wondered if your code helped and i thought an answer might be welcomed from me
Last edited by KanoFromMK on April 16th, 2024, 11:11 am, edited 1 time in total.
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
Re: traits
sorry, yes you're right, i was thinking about abilities, not traitsLord-Knightmare wrote: ↑April 16th, 2024, 8:13 am What you mean by traits are "abilities" (submerge/skirmisher).
Disengage is not the ability definition itself, rather has a global event which is used in every scenario of that campaign (UtbS) to make it work.
Also, ability Ninja might now work since you have two "[filter_location]" tags. You might wish to combine them into one:Code: Select all
[filter_location] terrain=*^V*,*^F*,D*^* [or] time_of_day=chaotic [/or] [/filter_location]
UPD: yes, this indeed has worked, now "my" ninja ability works properly, thank you very much, take this +200 to your karma
UPD2: btw, if this disengage ability is tied to every scenario in UTBS campaign, is it possible to create an analog ability with the same effect to add it to undead units? if yes can you help me please with it?
Last edited by KanoFromMK on April 16th, 2024, 11:39 am, edited 2 times in total.
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
Re: traits
it meant exactly that, didn't clarify because i didn't know what else to add and/or what is relevant
i know its dumb to come to people and ask for help not specifying what the problem is in the first place but i really didn't know what else to add
thanks for advice though, ill try to be more clear and attentive in the future, if possible
- Lord-Knightmare
- Discord Moderator
- Posts: 2370
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Re: traits
I mean sure. If you can describe what you want the ability to do, I am sure me or some other dev/veteran coder here would be very happy to lend a hand.UPD2: btw, if this disengage ability is tied to every scenario in UTBS campaign, is it possible to create an analog ability with the same effect to add it to undead units? if yes can you help me please with it?
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Re: traits
From code review, unit should be hidden during night on specific terrain. You did not say what situations you tested.
Maintainer of Ageless Era. Ravana's Multiplayer Works
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
Re: traits
that's true, my bad, i've tested on village OR at night OR in the forest, but not anything combined
sorry about that
btw a good Knight here helped me with it so no more questions about that))
Last edited by KanoFromMK on April 16th, 2024, 5:10 pm, edited 1 time in total.
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
Re: traits
ill try to explainLord-Knightmare wrote: ↑April 16th, 2024, 2:12 pmI mean sure. If you can describe what you want the ability to do, I am sure me or some other dev/veteran coder here would be very happy to lend a hand.UPD2: btw, if this disengage ability is tied to every scenario in UTBS campaign, is it possible to create an analog ability with the same effect to add it to undead units? if yes can you help me please with it?
so this ability works only in one campaign (UTBS specifically) because it is somehow linked to it, so how can i make an ability that have the exactly same effect but is not tied in any way to a specific campaign, like usual abilities that work in every scenario by default (submerge and fearless for example)
If i create through debug command a unit in any campaign normal abilities work, the Ninja ability that is mentioned above works too, how to create an "disengage" ability that works as a normal one?
UPD: the other thing i want to do is to give it to all undead creatures, but that is easy to do so no questions about that
Re: traits
All abilities that are "somehow linked" rely on [event] or their Lua equivalent. You need to locate where they are, and bring them over to your addon. Search by ability id help to find them.
Maintainer of Ageless Era. Ravana's Multiplayer Works
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
Re: traits
we have this
Code: Select all
#define ABILITY_DISENGAGE
[dummy]
id=disengage
name= _ "disengage"
female_name= _ "female^disengage"
description= _ "If this unit doesn’t move before attacking, it will retain its movement points after the attack."
special_note=_"This unit can move either before or after attacking."
[/dummy]
#enddef
Code: Select all
#define ABILITY_DISENGAGE_EVENTS
[event]
name=attack end
first_time_only=no
[filter]
ability=disengage
[not]
[filter_wml]
moves=$this_unit.max_moves
[/filter_wml]
[/not]
[/filter]
{VARIABLE unit.moves 0}
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/event]
#enddef
if yes, where do i find it and how can i use it? is there a wesnoth-wiki page about "events and how to use them"?
if not, what's the event i'm looking for? you said it is related to every scenario in that campaign, is this event somehow defined in the .cfg of those scenarios or is it somewhere else?
-
- Posts: 1266
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
-
- Posts: 17
- Joined: April 1st, 2024, 10:35 pm
Re: traits
oh hey, thanks, ill return someday with the results, thanks again