Ephraim's WML questions
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: Ephraim's WML questions
Provided you have unit in $unit {VARIABLE unit.variables.hp.upgrades 1} and unstore_unit then.
https://github.com/ProditorMagnus/Agele ... s.cfg#L197
For the record, the code you posted is not suitable for "To keep your code readable so that others can easily help you, make sure to indent it".
https://github.com/ProditorMagnus/Agele ... s.cfg#L197
For the record, the code you posted is not suitable for "To keep your code readable so that others can easily help you, make sure to indent it".
Re: Ephraim's WML questions
So:
Then, it should work correctly, or will happen that every time the unit buys an upgrade, the variable will reset to 1 again, since in the code says: literal=+1?
Code: Select all
[option]
label= +8hp
[command]
[modify_unit]
[filter]
x=$x1
y=$y1
[/filter]
max_hitpoints=+8
[/modify_unit]
[set_variable]
name=unit.variables.hp.upgrades
literal=+1
[/set_variable]
[unstore_unit]
variable=unit.variables.hp.upgrades
find_vacant=no
[/unstore_unit]
[/command]
[/option]
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
Future Project: History of Vindalf
Re: Ephraim's WML questions
I have not used literal enough to say what it should do, see documentation for that. But + is most likely string addition there. To actually change variables there is VARIABLE_OP.
Re: Ephraim's WML questions
But, for changing a variable with {VARIABLE_OP}, is necessary that the variable exists? Or if the variable doesn't exist, the VARIABLE_OP just creates one with value=+1 (if the addition in that case is +1, obviously)?Ravana wrote:I have not used literal enough to say what it should do, see documentation for that. But + is most likely string addition there. To actually change variables there is VARIABLE_OP.
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
Future Project: History of Vindalf
Re: Ephraim's WML questions
Most likely unspecified behavior, but I expect it starts with 0 when missing. Still it makes sense to initialise that variable yourself.
Re: Ephraim's WML questions
Hi, I would also not recommend using unit.variables.hp.upgrades it would be not lua-friendly (at least to the best of my abilities..), when I tried to code something with array inside variables in LUA, i couldn't.. so I had to change my path into something like unit.variables.hp_upgrades
It's not important, but I'm just sharing my negative experience
I think u need to use [unstore_unit] variable=unit
and not the full path, but maybe it works with full path too, idk
I wish I could help more, but same as Ravana I haven't used literals enough to commend anything. Same with labels in options or with +numbers, not sure if it will add 8 hp and not just try to concatenate string "8".
I think there was something special like "increase_maximum_hitpoints" or something similar.. to say for sure need to look documentation on [modify_unit].
Good luck
It's not important, but I'm just sharing my negative experience
I think u need to use [unstore_unit] variable=unit
and not the full path, but maybe it works with full path too, idk
I wish I could help more, but same as Ravana I haven't used literals enough to commend anything. Same with labels in options or with +numbers, not sure if it will add 8 hp and not just try to concatenate string "8".
I think there was something special like "increase_maximum_hitpoints" or something similar.. to say for sure need to look documentation on [modify_unit].
Good luck