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 Coding Problems - Modify Xp Reward
No, you can't use enemy.level instead of second_unit.level unless you explicitly do [store_unit] variable=enemy.
Re: ghype's Coding Problems - Modify Xp Reward
you put variable change after you unstored the unit.. so it doesnt affect anything, it just changes the second_unit array.. without putting that modified unit on map:
should be
Code: Select all
[unstore_unit]
variable=second_unit
find_vacant=no
animate=no
fire_event=no
[/unstore_unit]
{CLEAR_VARIABLE fightrew}
{VARIABLE second_unit.name testname}
{VARIABLE second_unit.name testname}
before [unstore_unit]
, then it will change after you unstore (if code works)
Code: Select all
{VARIABLE second_unit.name testname}
[unstore_unit]
variable=second_unit
find_vacant=no
animate=no
fire_event=no
[/unstore_unit]
{CLEAR_VARIABLE fightrew}
Re: ghype's Coding Problems - Modify Xp Reward
thanks for the suggestions. I indeed forgot the filters, hence no events were used for my abilities. Also I used the [message] key in order to see which event comes through and which don't.
(1) for {ABILITY_NO_XP}, which is used for gate, only the second event (name=die) got through.The first one (name=attack end) however did not came through.
(2) for {ABILITY_REDUCE_XP}, which is used for the attacker, it is the exact opposite. the first event (name=attack) got through.The second one (name=die) however did not came through.
What I remark is that if I use for (1) on the first event name=attack instead of name=attack end , there might be a chance that both event come through as name=attack did for (2). But even if so, none of these four events actually did something. No experience was reduced or denied...
so I am still at the same place.
(1) for {ABILITY_NO_XP}, which is used for gate, only the second event (name=die) got through.The first one (name=attack end) however did not came through.
code:
(2) for {ABILITY_REDUCE_XP}, which is used for the attacker, it is the exact opposite. the first event (name=attack) got through.The second one (name=die) however did not came through.
code:
What I remark is that if I use for (1) on the first event name=attack instead of name=attack end , there might be a chance that both event come through as name=attack did for (2). But even if so, none of these four events actually did something. No experience was reduced or denied...
so I am still at the same place.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
I think this is a mistake here:
you dont need to use dollar sign before unit.experience, but you need to use $ sign before enemy.level
you have couple of them.. or maybe im tired.. idk
{VARIABLE_OP $unit.experience sub enemy.level}
you dont need to use dollar sign before unit.experience, but you need to use $ sign before enemy.level
you have couple of them.. or maybe im tired.. idk
Re: ghype's Coding Problems - Modify Xp Reward
For attack events, unit and second_unit depend on who starts attack. For some cases you might want [filter_second].
Re: ghype's Coding Problems - Auto-defeat/Confusing Unit ID
For the "Modify Xp Reward" thing i will wait till 1.15 and take a look again at the situation.
I just came up with two smaller issues.
(1) In my campaign scenarion, I used to have an auto-defeat on start up because i forgot to add
There must be something I quite have't figured out yet, what am I missing in my
(2) I have a small
I just came up with two smaller issues.
(1) In my campaign scenarion, I used to have an auto-defeat on start up because i forgot to add
recruit=
in order to make my main character not being able to recruit. This fixed the auto-defeat back than. Now I added a couple more ai sides and I get an auto-defeat on start up again.There must be something I quite have't figured out yet, what am I missing in my
[side]
's ?code:
PLACE_UNIT
macro which I allows me to place unit of any type. For the type i need to use the ID. But for units with two words (such as Giant Rat, Giant Scorpion, Vampire Bat) it will not recognise the given ID. Spoiler:
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Auto-defeat/Confusing Unit ID
1) there should be some key that makes side never defeated
2) it is recognized as problem https://github.com/wesnoth/wesnoth/issues/1847 but for now you need to use it as https://wiki.wesnoth.org/PreprocessorRe ... inclusions
2) it is recognized as problem https://github.com/wesnoth/wesnoth/issues/1847 but for now you need to use it as https://wiki.wesnoth.org/PreprocessorRe ... inclusions
Re: ghype's Coding Problems - Auto-defeat/Confusing Unit ID
for these as far as I can see you just need to use it like this:ghype wrote: ↑November 28th, 2018, 3:47 pm (2) I have a smallPLACE_UNIT
macro which I allows me to place unit of any type. For the type i need to use the ID. But for units with two words (such as Giant Rat, Giant Scorpion, Vampire Bat) it will not recognise the given ID.Code: Select all
{PLACE_UNIT side Vampire Bat X Y} {PLACE_UNIT side Vampire_Bat X Y} {PLACE_UNIT side VAMPIRE BAT X Y} {PLACE_UNIT side VAMPIRE_BAT X Y}
a)
{PLACE_UNIT side "Vampire Bat" X Y}
b)
{PLACE_UNIT side (Vampire Bat) X Y}
Otherwise your macro thinks that Bat is the next variable (X), then for x, it thinks its Y, and then for the last one it thinks it's an extra one.. so I'm sure it gives you error something like that "you have 5 variables but is expected 4", so you need to show macro that "Vampire Bat" is a single variable, not 2 variables..
For the recruit thing.. if it was working before 1.14 and now on 1.14 it doesnt work anymore, then..
have you tried to change
Recruit=
into something else? For example Recruit=""
or just remove it completely.. 1.14 had too many changes that affect too many things.. comparing to 1.12.. otherwise i have no idea..Re: ghype's Coding Problems - Modify Xp Reward
thanks ravana & enclave.
(1)
(2)
(1)
defeat_condition=never
will do it temporarily, since I do not know what exactly I want with the sides.(2)
{PLACE_UNIT side "Vampire Bat" X Y}
worked just as finestuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Ability Work Only On Hit
So here is was thinking to use UtbS weapon special Shock, but I have one problem with it lore-wise. The ability assumes the unit is so shocked, that it cannot attack with its full strike, but with one less. The problem is, how can the unit be be "shocked" if the user misses every time? That's why I want to make this ability work only on hit, like slow or poison. I cannot find the default coding for slow but i guess I wouldn have to add more then just a line.
What do I have to do in order to make this special work only on slow?
Here is the code:
What do I have to do in order to make this special work only on slow?
Here is the code:
Code: Select all
#define WEAPON_SPECIAL_SHOCK
# Canned definition of the Shock ability to be included in a
# [specials] clause.
[attacks]
id=shock
name= _ "shock"
description= _ "When this attack is used on offense, the opponent will retaliate with one less strike than normally, to a minimum of one strike."
sub=1
active_on=offense
apply_to=opponent
[filter_base_value]
greater_than=1
[/filter_base_value]
[/attacks]
#enddef
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Ability Work Only On Hit
You mean it's not possible with adding only one line? That you would need more then just one line?
I can imagine that this could work with some sort of filter that controls wether the opponent unit has a different hp count as before the hit, that should be possible though, right?
I can imagine that this could work with some sort of filter that controls wether the opponent unit has a different hp count as before the hit, that should be possible though, right?
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Ability Work Only On Hit
It might be possible with adding one line (stateful lua_function), but I expect you would instead need to simulate entire combat for that.
Re: ghype's Coding Problems - Ability Work Only On Hit
I cannot find the default coding for slow
Here is slow and poison weapon specials. The logic is not coded in WML.
Code: Select all
[slow]
id=slow
name= _ "slows"
description= _ "This attack slows the target until it ends a turn. Slow halves the damage caused by attacks and the movement cost for a slowed unit is doubled. A unit that is slowed will feature a snail icon in its sidebar information when it is selected."
[/slow]
[poison]
id=poison
name= _ "poison"
description= _ "This attack poisons living targets. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP. Poison cannot, of itself, kill a unit."
[/poison]
The unit may be shocked not because it is hit by the weapon. But because the weapon is dreadful. UtbS shock is much more predictable than yours, maybe just use it as is?how can the unit be be "shocked" if the user misses every time?
If you still want the shock applied only on hit, I can try to code it using events.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.
Re: ghype's Coding Problems - Ability Work Only On Hit
hey sergey,
yes i found these and was referring to the logic.
yes i found these and was referring to the logic.
that would be awesome. it would save us some time.
stuff I worked on: Dunefolk Rework - ghype's Daily Art