ForestDragon'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.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
oh, ok. EDIT: works now, thanks!Pentarctagon wrote:You didn't need to add.value
it toXP_bank_start
.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
I'm making yet another MP mod. So, I'm trying to store all sides' default team names, but it seems I messed something up with variables again. here's the current work-in-progress code of the mod:
Code: Select all
#define STORE_DEFAULT_ALLEGIANCE SIDE
[store_side]
side={SIDE}
variable=side{SIDE}_stored
[/store_side]
#enddef
[modification]
id=Alliances_Mod
name="Alliance Mod"
description="allows players to make/break alliances with eachother."
require_modification=no
# [options]
# [/options]
[event]
name=start
{STORE_DEFAULT_ALLEGIANCE 1}
{STORE_DEFAULT_ALLEGIANCE 2}
{STORE_DEFAULT_ALLEGIANCE 3}
{STORE_DEFAULT_ALLEGIANCE 4}
{STORE_DEFAULT_ALLEGIANCE 5}
{STORE_DEFAULT_ALLEGIANCE 6}
{STORE_DEFAULT_ALLEGIANCE 7}
{STORE_DEFAULT_ALLEGIANCE 8}
{STORE_DEFAULT_ALLEGIANCE 9}
[set_menu_item]
id=alliance_menu
description="Alliance Menu"
# image=".png"
# [default_hotkey]
# key="~"
# [/default_hotkey]
[show_if]
[have_unit]
x=$x1
y=$y1
side=$side_number
canrecruit=yes
[/have_unit]
[/show_if]
[command]
[message]
speaker=narrator
image=portraits/humans/transparent/marshal.png
caption="Alliances Menu"
message="What do you want?"
[option]
message= {MENU_IMG_TXT "misc/red-x.png" "Return To Game"}
[command]
[/command]
[/option]
[option]
message= {MENU_IMG_TXT "icons/crossed_sword_and_hammer.png" "Break all your current alliances"}
[command]
[modify_side]
side=$side_number
team_name=$side[$side_number]_stored.team_name
[/modify_side]
[/command]
[/option]
[/message]
[/command]
[/set_menu_item]
[set_menu_item]
description=_ "Send alliance request to this side"
id="send_request"
# image="misc/cross-white.png"
[show_if]
[have_unit]
[filter_side]
[not]
[allied_with]
side=$side_number
[/allied_with]
[or]
controller=ai
[/or]
[/not]
[/filter_side]
canrecruit="yes"
x="$x1"
y="$y1"
[/have_unit]
[and]
[not]
[have_unit]
x="$x1"
y="$y1"
side=$side_number
[/have_unit]
[/not]
[/and]
[/show_if]
[command]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
variable=thisleader
kill=no
[/store_unit]
[store_unit]
[filter]
side=$side_number
canrecruit=yes
[/filter]
variable=thisleader2
kill=no
[/store_unit]
[message]
speaker=narrator
image=portraits/humans/transparent/marshal.png
# for_side=$thisleader.side
caption="Alliances Menu"
message="player $side_number| ($thisleader2.name|) wants to ally with you."
[option]
message= {MENU_IMG_TXT "misc/red-x.png" "Decline"}
[command]
[message]
speaker=narrator
image=portraits/humans/transparent/marshal.png
for_side=$side_number
caption="Alliances Menu"
message="player $thisleader.side| ($thisleader.name|) declined your alliance request."
[/message]
[/command]
[/option]
[option]
message= {MENU_IMG_TXT "icons/crossed_sword_and_hammer.png" "Agree"}
[command]
[modify_side]
side=$side_number
team_name=$side[$side_number]_stored.team_name|,alliance
# user_team_name="Alliance"
[/modify_side]
[modify_side]
side=$thisleader.side
team_name=$side[thisleader.side]_stored.team_name|,alliance
# user_team_name="Alliance"
[/modify_side]
[message]
speaker=narrator
image=portraits/humans/transparent/marshal.png
for_side=$side_number
caption="Alliances Menu"
message="player $thisleader.side| ($thisleader.name|) accepted your alliance request."
[/message]
[/command]
[/option]
[/message]
[/command]
[/set_menu_item]
[/event]
[/modification]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: ForestDragon's WML questions
side{SIDE}_stored
doesn't put it in an array. It means there are variables literally called side1_stored
, side2_stored
, etc. So rather than$side[$side_number]_stored.team_name
, I believe you would want $side$side_number|_stored.team_name
.Your modification, if meant only for MP, should also specify
type=mp
.99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
Works perfectly, thanks!Pentarctagon wrote:side{SIDE}_stored
doesn't put it in an array. It means there are variables literally calledside1_stored
,side2_stored
, etc. So rather than
$side[$side_number]_stored.team_name
, I believe you would want$side$side_number|_stored.team_name
.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
small question: is it possible to filter debug by using #ifdef? (to add debug-exclusive features, like add-on specific debug features)
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
It is possible to check debug state during game at least.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
could you please explain what exactly do you mean?
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
ok, thanks.Ravana wrote: ↑April 6th, 2018, 2:52 pm https://wiki.wesnoth.org/LuaWML/Misc#we ... ame_config has debug key.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
Does anyone know if there's a way to embed [terrain_graphics] into an event? (like the animated mausoleum, for instance)
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ForestDragon's WML questions
That question doesn't really make sense. [terrain_graphics] defines the look of some type of terrain. It doesn't perform any action. If you want some animated terrain to appear in an event, what you would have to do is create a custom terrain with [terrain_type] that corresponds to a [terrain_graphics] rule that sets the graphics you want, then switch to your custom terrain with the event. You would probably have to read up on terrain to get it working. You could also look at SotA. It has a fair amount of custom terrain (for a mainline campaign anyway), and some of it is animated.
([terrain_graphics] can also define the look of a specific tile, which is what is done for the mausoleum and campfire, but that probably won't help you in this case.)
([terrain_graphics] can also define the look of a specific tile, which is what is done for the mausoleum and campfire, but that probably won't help you in this case.)
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
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
ok, thanks.beetlenaut wrote: ↑June 4th, 2018, 7:10 am That question doesn't really make sense. [terrain_graphics] defines the look of some type of terrain. It doesn't perform any action. If you want some animated terrain to appear in an event, what you would have to do is create a custom terrain with [terrain_type] that corresponds to a [terrain_graphics] rule that sets the graphics you want, then switch to your custom terrain with the event. You would probably have to read up on terrain to get it working. You could also look at SotA. It has a fair amount of custom terrain (for a mainline campaign anyway), and some of it is animated.
([terrain_graphics] can also define the look of a specific tile, which is what is done for the mausoleum and campfire, but that probably won't help you in this case.)
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
And if you don't want to actually create a custom terrain, you can create scenario-specific ([scenario][terrain_graphics]) rules (which is what the mausoleum is) and simply craft it so that it matches when you for example add the impassable overlay (or whichever non-visual change is most convenient) someplace in an event. That would be the easiest way to do it in some cases.beetlenaut wrote: ↑June 4th, 2018, 7:10 am That question doesn't really make sense. [terrain_graphics] defines the look of some type of terrain. It doesn't perform any action. If you want some animated terrain to appear in an event, what you would have to do is create a custom terrain with [terrain_type] that corresponds to a [terrain_graphics] rule that sets the graphics you want, then switch to your custom terrain with the event. You would probably have to read up on terrain to get it working. You could also look at SotA. It has a fair amount of custom terrain (for a mainline campaign anyway), and some of it is animated.
([terrain_graphics] can also define the look of a specific tile, which is what is done for the mausoleum and campfire, but that probably won't help you in this case.)
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
True, but I already added custom terrain (it's not that difficult, after all)zookeeper wrote: ↑June 4th, 2018, 9:36 am And if you don't want to actually create a custom terrain, you can create scenario-specific ([scenario][terrain_graphics]) rules (which is what the mausoleum is) and simply craft it so that it matches when you for example add the impassable overlay (or whichever non-visual change is most convenient) someplace in an event. That would be the easiest way to do it in some cases.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
Hi. So, was working on implementing long-ranged attacks for AI (for my upcoming addon), and while the code works fine on 1.12.x, it fails to do so on the latest stable (1.14.2)
*removed*
EDIT: Nevermind, it works now.
*removed*
EDIT: Nevermind, it works now.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic