Stupid Questions (see last post)
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: Stupid Questions (see last post)
What do you mean "didn't work"? What happened? Was there any error message on-screen or on stderr / the log file? Did you try including a "hello world" event (an event that displays a message and does nothing else)?TrashMan wrote: ↑March 23rd, 2019, 10:43 pm All the code is just on recruitment/recall/placement events anyway that adds abilities or attacks to units.
So basically, if I just put all the code at the bottom, just before [/campaign], it should work?
Off, because I started a new campaign after clearing cache and it didn't work.
"Units" and "Unit types" aren't the same thing. If you want to make a new unit type then yes you need to give it an id different from the id of the base unit type, you can see an example of this in DiD. That's a good idea anyway because it makes it easier to mix and match your units with the mainline units they're based on. The [base_unit] tag may help. However, can you give an example of what kind of tweak you'd like to make? Maybe custom unit types aren't the best approach for whatever effect you're after.
Re: Stupid Questions (see last post)
The campaign loaded, but no unit changes happened.
This was either because the code was in the [modification]block and didn't load, or because it was outside of the [campaign] block
But I have hero units that I want to have custom AMLAS.
So far the only way in which custom AMLAS seem to work is by creating a new unit type*...however that requires the entire unit progression - Lvl1 unit, LVL2, LVL3 - all have to be tweaked.
Alternatively, I could only tweak the final LVL 3/4 unit and have each scenario check for the ID of heroes on levelup to change the unit type if it's final level.
* I have tried to add amlas on unit creation, but it doesn't work. All get instantly applied instead of being levelup options
All of this seems strange to me. I've been modding games for almost 2 decades and NOT being able to override core files seems bizzare.
This was either because the code was in the [modification]block and didn't load, or because it was outside of the [campaign] block
Well, adding some attacks and abilitites to human and elven mages, schocktroopers and tweaking progression a bit. All of that is simple enough, and the code works as separate modification."Units" and "Unit types" aren't the same thing. If you want to make a new unit type then yes you need to give it an id different from the id of the base unit type, you can see an example of this in DiD. That's a good idea anyway because it makes it easier to mix and match your units with the mainline units they're based on. The [base_unit] tag may help. However, can you give an example of what kind of tweak you'd like to make? Maybe custom unit types aren't the best approach for whatever effect you're after.
But I have hero units that I want to have custom AMLAS.
So far the only way in which custom AMLAS seem to work is by creating a new unit type*...however that requires the entire unit progression - Lvl1 unit, LVL2, LVL3 - all have to be tweaked.
Alternatively, I could only tweak the final LVL 3/4 unit and have each scenario check for the ID of heroes on levelup to change the unit type if it's final level.
* I have tried to add amlas on unit creation, but it doesn't work. All get instantly applied instead of being levelup options
All of this seems strange to me. I've been modding games for almost 2 decades and NOT being able to override core files seems bizzare.
Light travels much faster than sound, that's why some people seem bright until you hear them speak.
>>> MY LITTLE LAB! <<<
>>> MY LITTLE LAB! <<<
Re: Stupid Questions (see last post)
Yeah, so try an hello world event.
TrashMan wrote: ↑March 25th, 2019, 9:07 am But I have hero units that I want to have custom AMLAS.
So far the only way in which custom AMLAS seem to work is by creating a new unit type*...however that requires the entire unit progression - Lvl1 unit, LVL2, LVL3 - all have to be tweaked.
Alternatively, I could only tweak the final LVL 3/4 unit and have each scenario check for the ID of heroes on levelup to change the unit type if it's final level.
* I have tried to add amlas on unit creation, but it doesn't work. All get instantly applied instead of being levelup options
new_advancement
in https://wiki.wesnoth.org/EffectWML should do what you want. If it doesn't, post the WML code you tried.I'm not sure whether that's a deliberate design choice or simply that no one ever took the time to write a
modify_unit_type
WML/Lua API, but in either case, let's focus on getting things to work under 1.14.6 first and on designing new WML/Lua APIs for future Wesnoth releases second.Re: Stupid Questions (see last post)
Aha..so basically this confirms that the ONLY way to change AMLAS is trough a new unit type?
I guess this isn't an issue for a custom hero unit, but when a hero can be a dozen different unit types, making a dozen variations just for advancement is meh. Alternatively, having to have a copy of every unit to have better advacement...
For example, I have:
{AMLA_ENDURANCE}
{AMLA_STRENGTH}
{AMLA_SPEED}
{AMLA_RESISTANCE}
{AMLA_QUICKSTRIKE}
{AMLA_DEFENSE}
{AMLA_FORTRESS}
{AMLA_SURESTRIKE}
{AMLA_TOUGH}
for my heroes.
I guess this isn't an issue for a custom hero unit, but when a hero can be a dozen different unit types, making a dozen variations just for advancement is meh. Alternatively, having to have a copy of every unit to have better advacement...
For example, I have:
{AMLA_ENDURANCE}
{AMLA_STRENGTH}
{AMLA_SPEED}
{AMLA_RESISTANCE}
{AMLA_QUICKSTRIKE}
{AMLA_DEFENSE}
{AMLA_FORTRESS}
{AMLA_SURESTRIKE}
{AMLA_TOUGH}
for my heroes.
Last edited by TrashMan on March 25th, 2019, 3:58 pm, edited 2 times in total.
Light travels much faster than sound, that's why some people seem bright until you hear them speak.
>>> MY LITTLE LAB! <<<
>>> MY LITTLE LAB! <<<
Re: Stupid Questions (see last post)
Another question:
I wanted to make a modification that doubles the HP of all units, but the HP goes into thousands, as it seems like it keeps incrementing the same variable over and over for each unit. How to fix this?
I wanted to make a modification that doubles the HP of all units, but the HP goes into thousands, as it seems like it keeps incrementing the same variable over and over for each unit. How to fix this?
Code: Select all
[binary_path]
path=data/add-ons/Double_HP/
[/binary_path]
[modification]
id=DOUBLE_HP
name=_"Double HP"
description=_"Doubles the HP of all units to make the RNG more fair."
require_modification=yes
type=hybrid
####Double HP
[event]
name=recruit,recall,post advance,unit placed
first_time_only=no
id=hp
[modify_unit]
[filter]
[/filter]
hitpoints = "$($this_unit.hitpoints * 2)"
[/modify_unit]
[/event]
[/modification]
Light travels much faster than sound, that's why some people seem bright until you hear them speak.
>>> MY LITTLE LAB! <<<
>>> MY LITTLE LAB! <<<
Re: Stupid Questions (see last post)
No. You should be able to give a unit an object that uses EffectWML to give that unit new advancements.
I already proposed [base_unit].
Re: Stupid Questions (see last post)
There are two problems in your code: 1) The event modifies all units, not only the unit it was called for, because an empty filter matches everything 2) The event runs more than once for each unit, for example, when a unit is recruited both
unit placed
and recruit
fire.To fix 1) add
id=$unit.id
to your filter. To fix 2) remove everything but unit placed
from your event.I think there's an addon that doubles all units hitpoints (and weapon damage and so on) but I can't find it.
Re: Stupid Questions (see last post)
Thanks.
Ok, I wrote this:
So if I put this in a mission (or inside the campaign tag) it should when any of the mentioned units reaches max level, alter them to give them these AMLAS, correct?
Ok, I wrote this:
Code: Select all
[event]
name=recruit,recall,post advance,unit placed
first_time_only=no
id=give_newamlas
[modify_unit]
[filter]
id=Rohan,Merle,Walsh
level=3
[/filter]
[object]
id=new_amals
silent=yes
duration=forever
[effect]
apply_to=new_advancement
replace=yes
[advancement]
{AMLA_ENDURANCE}
{AMLA_STRENGTH}
{AMLA_SPEED}
{AMLA_PRECISION}
{AMLA_RESISTANCE}
[/advancement]
[/effect]
[/object]
[/modify_unit]
[/event]
Light travels much faster than sound, that's why some people seem bright until you hear them speak.
>>> MY LITTLE LAB! <<<
>>> MY LITTLE LAB! <<<
Re: Stupid Questions (see last post)
I add status to units that are already modified. Then no matter how many times it is called it will not be applied multiple times. (filter by that status)
Though note that your solution doubles current hp, not max hp, so in some cases the unstable hp will be dropped silently.
Though note that your solution doubles current hp, not max hp, so in some cases the unstable hp will be dropped silently.
Re: Stupid Questions (see last post)
Yes, though I think you meant each of the {AMLA_FOO} macro to be surrounded by its own [advancement][/advancement] tags, like this:
Code: Select all
[advancement]
{AMLA_ENDURANCE}
[/advancement]
[advancement]
{AMLA_STRENGTH}
[/advancement]
[advancement]
{AMLA_SPEED}
[/advancement]
[advancement]
{AMLA_PRECISION}
[/advancement]
[advancement]
{AMLA_RESISTANCE}
[/advancement]
Re: Stupid Questions (see last post)
So this:
Code: Select all
[event]
name=recruit,recall,post advance,unit placed
first_time_only=no
id=give_newamlas
[modify_unit]
[filter]
id=Rohan,Merle,Walsh
level=3
[not]
status=amlad
[/not]
[/filter]
[object]
id=new_amals
silent=yes
duration=forever
[effect]
apply_to=new_advancement
replace=yes
[advancement]
{AMLA_ENDURANCE}
[/advancement]
[advancement]
{AMLA_STRENGTH}
[/advancement]
[advancement]
{AMLA_SPEED}
[/advancement]
[advancement]
{AMLA_PRECISION}
[/advancement]
[advancement]
{AMLA_RESISTANCE}
[/advancement]
[/effect]
[effect]
apply_to=status
add=amlad
[/effect]
[/object]
[/modify_unit]
[/event]
Doesn't hitpoints affect both HP AND max HP?Though note that your solution doubles current hp, not max hp, so in some cases the unstable hp will be dropped silently.
So what do I do? Add increase_totals?
Light travels much faster than sound, that's why some people seem bright until you hear them speak.
>>> MY LITTLE LAB! <<<
>>> MY LITTLE LAB! <<<
Re: Stupid Questions (see last post)
oh, forgot to ask, adding amals like this - if I switch unit types, do these amlas still stick? Do the upgrades gained go *poof*?
Light travels much faster than sound, that's why some people seem bright until you hear them speak.
>>> MY LITTLE LAB! <<<
>>> MY LITTLE LAB! <<<
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Stupid Questions (see last post)
No, hitpoints and max_hitpoints are separate.
Use unit.max_hitpoints instead of unit.hitpoints.
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: Stupid Questions (see last post)
OK, the WML code adding new amlas...does not work as intended.
What I SHOULD be getting is in the attached image below - this is what my custom units get. (also, WTF is this Pango error???)
What happens isthat on levelup I get a similar screen, but instead of AMLA icons and description, I get 5 images of the unit with no text and clicking on any of them doesn't modify any stats. It looks like the unit levelsup, but no stat increases, no heal.
Trying to get this to work is driving me bonker. Unless someone has a better idea, I belive my best bet is to simply make new version of the units and instead of applying new AMLAS, I check each individually and change unit type to the new one.
What I SHOULD be getting is in the attached image below - this is what my custom units get. (also, WTF is this Pango error???)
What happens isthat on levelup I get a similar screen, but instead of AMLA icons and description, I get 5 images of the unit with no text and clicking on any of them doesn't modify any stats. It looks like the unit levelsup, but no stat increases, no heal.
Trying to get this to work is driving me bonker. Unless someone has a better idea, I belive my best bet is to simply make new version of the units and instead of applying new AMLAS, I check each individually and change unit type to the new one.
Light travels much faster than sound, that's why some people seem bright until you hear them speak.
>>> MY LITTLE LAB! <<<
>>> MY LITTLE LAB! <<<
Re: Stupid Questions (see last post)
In short, you need to escape the
<
or >
characters in your string. I don't know how but I guess in the XML style, <
and >
. That's because <
is used to introduce escape sequences that do coloring etc.So the contents of the [advancement] tags is probably wrong. There's really nothing more we can say unless you post your actual code..TrashMan wrote: ↑March 27th, 2019, 9:59 am What happens isthat on levelup I get a similar screen, but instead of AMLA icons and description, I get 5 images of the unit with no text and clicking on any of them doesn't modify any stats. It looks like the unit levelsup, but no stat increases, no heal.
Trying to get this to work is driving me bonker. Unless someone has a better idea, I belive my best bet is to simply make new version of the units and instead of applying new AMLAS, I check each individually and change unit type to the new one.