how give all unit a abilitie?
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.
how give all unit a abilitie?
i hope make a add-on,player can choose "give all units abilitie" to start
I want to choose different abilitie for different side in the start settings
Or ask to select the abilitie right after the game starts
If it is selected after the game starts, I hope that all players can know the choices of all players, and can choose multiple or not
I want to choose different abilitie for different side in the start settings
Or ask to select the abilitie right after the game starts
If it is selected after the game starts, I hope that all players can know the choices of all players, and can choose multiple or not
Last edited by ERROR1025 on January 28th, 2023, 2:19 am, edited 1 time in total.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: how give all unit a abilitie?
I can't see any way to have a different list of choices for different factions in the start settings, but you can do this right after the game starts. You can use [message] with an [option] for each ability that allows the user to choose what they want. Then, you would use [object] in the option's [command] in order to add the ability to the unit. The [object] will have an [effect] with the key
Your question refers to a project with many different parts. You would get better help if you asked a more specific question, but this information should get you started on one way to do it.
apply_to=new_ability
. You can look up those things in the wiki to see how they work.Your question refers to a project with many different parts. You would get better help if you asked a more specific question, but this information should get you started on one way to do it.
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: how give all unit a abilitie?
I don't understand how to add abilitie for "all units", can you provide a sample WML? This will give leadership to "all units" for the side 1
Re: how give all unit a abilitie?
I didn't test it, so you may need to de-bug it...
I suggest you read the WML guide about [event], [object], [effect] and [filter].
Using [filter], you can limit the "effect" to only certain types of units.
Code: Select all
[event]
name=start, recruit
first_time_only=no
[modify_unit]
[filter]
side=1
[/filter]
[object]
[effect]
apply_to=new_ability
{ABILITY_LEADERSHIP}
[/effect]
[/object]
[/modify_unit]
[/event]
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: how give all unit a abilitie?
You can also use [foreach] to loop through all the units one at a time so they can each have a different ability. However, you should make it work for just one faction and just one unit first. Don't try to do everything at the same time.
Helmet's code is close, but the macro needs to be inside an [abilities] tag under [effect].
Code: Select all
[event]
name=start
[store_unit]
[filter]
side=1
[/filter]
variable=all_units
[/store_unit]
[foreach]
array=all_units
[do]
[object]
[filter]
# Variable this_item is automatically stored by [foreach].
id=$this_item.id
[/filter]
[effect]
apply_to=new_ability
[abilities]
{ABILITY_LEADERSHIP}
[/abilities]
[/effect]
[/object]
[message]
speaker=$this_item.id
message="I just got leadership."
[/message]
[/do]
[/foreach]
[/event]
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: how give all unit a abilitie?
why my wml can not work?
log is:
Mandatory WML child missing yet untested for.Please report
not have more info
log is:
Mandatory WML child missing yet untested for.Please report
not have more info
- Attachments
-
- _main.cfg
- (664 Bytes) Downloaded 25 times
Re: how give all unit a abilitie?
[if] is not allowed as toplevel tag.
[event] is not recognized condition https://wiki.wesnoth.org/ConditionalAct ... ition_Tags.
To start you can move [event] under [modification] and remove [if].
[event] is not recognized condition https://wiki.wesnoth.org/ConditionalAct ... ition_Tags.
To start you can move [event] under [modification] and remove [if].
Re: how give all unit a abilitie?
but i need the event only work on 1UR=1
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: how give all unit a abilitie?
The [if] will work inside the [event].
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: how give all unit a abilitie?
the WML can not work too
i hope it give all side 1 unit LEADERSHIP,if 1UR=yes
i hope it give all side 1 unit LEADERSHIP,if 1UR=yes
- Attachments
-
- ProWesnothStart-modf.zip
- (656 Bytes) Downloaded 28 times
Re: how give all unit a abilitie?
I don't know what's wrong, but I noticed you had some code in the beginning, but not in your recent version.
Did you leave it out on purpose?
Good luck.
Code: Select all
#ifdef MULTIPLAYER
[binary_path]
path=data/add-ons/ProWesnothStart-modf/
[/binary_path]
. . .
#endif
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: how give all unit a abilitie?
purposeHelmet wrote: ↑February 2nd, 2023, 2:07 amI don't know what's wrong, but I noticed you had some code in the beginning, but not in your recent version.
Did you leave it out on purpose?
Good luck.
Code: Select all
#ifdef MULTIPLAYER [binary_path] path=data/add-ons/ProWesnothStart-modf/ [/binary_path] . . . #endif
I referenced the WML for XP Modification and I noticed that these deleted WMLs were not needed
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: how give all unit a abilitie?
Your [effect] is missing an [abilities] tag. The rest looks good now though.
Code: Select all
[effect]
apply_to=new_ability
[abilities]
{ABILITY_LEADERSHIP}
[/abilities]
[/effect]
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: how give all unit a abilitie?
Code: Select all
[modification]
id=PWSM
name="ProWesnothStart-modf(PWSM)"
#define PWSMR V
[resistance]
max_value=100
add={V}
[/resistance]
#enddef
[options]
[checkbox]
id=S1R
default=false
name=_"SIDE 1 R"
description=_"side 1"
[/checkbox]
[slider]
id=S1RV
default=0
min=-100
max=100
step=1
name=_"1 R"
description=_"P1 R"
[/slider]
[checkbox]
id=S2R
default=false
name=_"SIDE 2 R"
description=_"side 2"
[/checkbox]
[slider]
id=S2RV
default=0
min=-100
max=100
step=1
name=_"2 R"
description=_"P2 R"
[/slider]
[/options]
[event]
name=start, recruit
first_time_only=no
[if]
[variable]
name=S1R
equals=yes
[/variable]
[then]
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to=new_ability
[abilities]
{PWSMR S1RV}
[/abilities]
[/effect]
[/modify_unit]
[/then]
[/if]
[/event]
[event]
name=start, recruit
first_time_only=no
[if]
[variable]
name=S2R
equals=yes
[/variable]
[then]
[modify_unit]
[filter]
side=2
[/filter]
[effect]
apply_to=new_ability
[abilities]
{PWSMR S2RV}
[/abilities]
[/effect]
[/modify_unit]
[/then]
[/if]
[/event]
[/modification]
all side1 unit resistance *2(i need +10)
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: how give all unit a abilitie?
If you had used :inspect to look at a side 1 unit, you would have seen this line in the new resistance section:
add="S1RV"
. You need a $
in front of the values you send to the macro. (You also need to indent in a normal way if you are going to share your code. It is very hard to read.)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