How do you get a number and use it from sides having the same team name
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: How do you get a number and use it from sides having the same team name
There is a chance that it won't be as simple as you would want it to be...LordAwsomeness wrote: ↑May 10th, 2018, 1:23 am One more thing: do you perhaps know how to enable the ancient lich to advance from the lich?
Try the easy easy way... But i'm quite sure it won't work... somewhere in your prestart event add this code line:
{ENABLE_ANCIENT_LICH}
He doesn't use that.. it is used in
core/units
already by wesnoth creators, he is just trying to ask how to make use of it..
Code: Select all
[unit_type]
id=Ancient Lich
name= _ "Ancient Lich"
race=undead
image="units/undead-necromancers/ancient-lich.png"
profile="portraits/undead/ancient-lich.png"
hitpoints=80
movement_type=undeadfoot
movement=6
experience=200
level=4
alignment=chaotic
advances_to=null
#ifdef ENABLE_ANCIENT_LICH
[advancefrom]
unit=Lich
experience=250
[/advancefrom]
#endif
{AMLA_DEFAULT}
cost=100
Code: Select all
[event]
name=advance
first_time_only=no
[filter]
type=Lich
[/filter]
[store_unit]
[filter]
x=$unit.x
y=$unit.y
[/filter]
variable=ad_unit
[/store_unit]
{VARIABLE_OP ad_unit.experience add -$ad_unit.max_experience}
{VARIABLE_OP ad_unit.max_experience add $ad_unit.max_experience}
{VARIABLE ad_unit.type "Ancient Lich"}
[if]
[variable]
name=ad_unit.experience
greater_than_equal_to=$ad_unit.max_experience
[/variable]
[then]
## this avoids double level up.. which makes all kind of magic happen.. somehow.
{VARIABLE ad_unit.experience $ad_unit.max_experience}
{VARIABLE_OP ad_unit.experience add -1}
[/then]
[/if]
[unstore_unit]
variable=ad_unit
[/unstore_unit]
{CLEAR_VARIABLE ad_unit}
[/event]
Now to test if its working or not you could go to the same place where you found your ancient lich ifdef and modify original lich to have 10 experience, this way he will level up quick if you use him.. So go to your game :debug and right click somewhere to create unit, select Lich.. And then test what happens when he levels up...
WARNING: it MAY lose all objects and effects.. im not sure. There is a chance..
If it doesn't work I would say that the easiest way to make it 100% working would be to do something like:
Code: Select all
[event]
name=advance
first_time_only=no
[filter]
type=Lich
[/filter]
[store_unit]
[filter]
x=$unit.x
y=$unit.y
[/filter]
kill=yes
variable=unit_Lich
[/store_unit]
[unit]
x=$unit.x
y=$unit.y
name=$unit_Lich.name
type=Ancient Lich
[/unit]
[/event]
WARNING: it would lose all objects and effects... because original unit is dead..
There are MANY other ways... transform etc.. no idea how they work and what is their transformation specifics and side effects..
Re: How do you get a number and use it from sides having the same team name
Re: How do you get a number and use it from sides having the same team name
Is there, like any gamebreaking issue with using advancefrom in a mp environment ? need to know why its undesired, if there is an bug about it.
Re: How do you get a number and use it from sides having the same team name
It changes unit_type in unsynced way, causes oos when that unit is used in game where is someone without having installed that addon.
It works as expected, it is just not designed to be usable in mp context.
It works as expected, it is just not designed to be usable in mp context.
Re: How do you get a number and use it from sides having the same team name
So in this case 1.14 would not automatically install addon?
Re: How do you get a number and use it from sides having the same team name
No. Only addons that are used in current game are automatically installed. [advancefrom] corrupts units globally.
Re: How do you get a number and use it from sides having the same team name
I have observed campaigns wrapping the advancefrom into an ifdef when they use one, would doing so and invoking it in my addon prevent the out of addon corruption ?
Re: How do you get a number and use it from sides having the same team name
Only for campaign ifdefs, everything in MP shares MULTIPLAYER define.
Re: How do you get a number and use it from sides having the same team name
Well, thanks for telling me about it. I have just gone and changed the two addons which had been making use of advancefrom.
i can confirm that the above works.
Code: Select all
#the point of existence for this is to get transformed at moment of advancement
[unit_type]
id=Ogre E
[base_unit]
id=Ogre
[/base_unit]
advances_to=Great Ogre
hide_help=yes
do_not_list=yes
[/unit_type]
#and then inside the modification we do
[event]
name=pre advance
id=ogrecangreat
first_time_only=no
[filter]
type=Ogre
x,y=$x1,$y1
[/filter]
[transform_unit]
x,y=$x1,$y1
transform_to=Ogre E
[/transform_unit]
[/event]
#that way he levels up to new type instead amlaing.
Re: How do you get a number and use it from sides having the same team name
If you use event, you do not need extra unit type. You can transform_unit it into the advancement directly, or modify advances_to variable of the single advancing unit.
Similarly, if you use extra unit_type, then you can use that type in the first place, and have no need for event.
Similarly, if you use extra unit_type, then you can use that type in the first place, and have no need for event.
- LordAwsomeness
- Posts: 203
- Joined: August 12th, 2013, 2:20 pm
- Location: U.S.A.
Re: How do you get a number and use it from sides having the same team name
Omg! the variable version is so easy!! You can also remove other choices of advancement as well!! like you can make a Dark Sorcerer only level up to a Lich!
Code: Select all
[event]
name=post advance
# id=dark_lord
first_time_only=no
[filter]
id=dark_lord
type=Lich
x,y=$x1,$y1
[/filter]
[store_unit]
[filter]
id=dark_lord
[/filter]
variable=la_darklord_adv
kill=yes
[/store_unit]
{VARIABLE la_darklord_adv.advances_to "Ancient Lich"}
[unstore_unit]
variable=la_darklord_adv
[/unstore_unit]
[/event]
- Been playing Wesnoth since 2004 and the 1.0.x versions.
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA
- Creator of Undead Invasion MP Scenario Pack.
- Creator of Valeria MP Adventure
- Creator of LA_RPG ERA