Coding Advent Calendar II

The place to post your WML questions and answers.

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.
Post Reply
User avatar
Heindal
Posts: 1343
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Coding Advent Calendar II

Post by Heindal »

codingadventcalendar.png
codingadventcalendar.png (14.69 KiB) Viewed 1432 times
Last year I made a coding advent calendar. It presented a piece of code or a teaser every day.
viewtopic.php?p=660691#p660691

I'd like to continue this 'tradition' and will present a piece of code every day till the 24th of December. The main idea is to give you pieces of WML code you can use right away in your own projects. I'll try to make it beginner friendly and of course you may use, share and change the code as you like.
Why do I do this? Imho because the examples in the wiki aren't good. The wiki offers a good technical description of tags, but lacks good and working examples.

Note: As this is mostly for WML beginners, it might not be interesting for you. For those who are looking for challenges and coding puzzles you should check the project https://adventofcode.com/. Enjoy.

The topics of this thread:

01. change terrain and move to events
02. sounds, set variables, gold manipulation, print and messages
03. how to make a simple macro
04. random generated variables and event 'new turn'
05. how to make a scenario, examples for scenarios, main.cfg, server.pbl
06. the campaign DDD is now available to review the source code and testing
07. placing npc units and talk events, earn gold by selling your ore to the king
08. creating shops, dialogue options and spend gold
09. objects - different examples how to alter movement costs, defense, resistance and many more
10. refine ore - upgrade equipment with ore
11. Jonna teaches spellcasting, adding icons to menu
12. type in a password and check it: 'cheater option' and playable version 0.2
13. Creating own terrain, add a 'vein' terrain overlay
14. Mine a specific terrain without placing single events. (Reactive Terrain Part I)
15. Random dungeon: The 'Cheesehole Concept'.
How to use while loops.
16. Place random monsternests and random monsters into the dungeon.
17. Place 'biomes': add map parts using terrain_mask and place monsters on them.
18. Biome example: Placing random movement events, delayed_variable_substitution=no and ai_special=guardian.
19. Placing random leaders and factions. Side concepts.
20. Upgrades with scaling costs using variables.
22. Reactive terrain II: Shrines, Artifacts, Monsternest, Minecarts etc. Place 'events' with the map editor.
23. Making different dungeon types and dungeon levels.
24. The final version of DDD: how to make quests and advancement trees for units.
25. Advice on how to port an add-on from 1.14 to 1.16

Door 1:
Spoiler:

Door 2:
Spoiler:

Door 3:
Spoiler:

Door 4:
Spoiler:

Door 5:
Spoiler:

Door 6:
Spoiler:

Door 7:
Spoiler:

Door 8:
Spoiler:

Door 9:
Spoiler:

Door 10:
Spoiler:

Door 11 - 24 in the next post (due to text restrictions)
Last edited by Heindal on January 5th, 2022, 6:39 am, edited 9 times in total.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
Heindal
Posts: 1343
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Coding Advent Calendar II

Post by Heindal »

Apologies for the second post. Unfortunately there is a restriction to the text for one post (60,000 signs).


Door: 11
Spoiler:

Door: 12
Spoiler:

Door: 13
Spoiler:

Door: 14
Spoiler:

Door: 15
Spoiler:

Door: 16
Spoiler:

Door: 17
Spoiler:

Door: 18
Spoiler:

Door: 19
Spoiler:

Door: 20
Spoiler:

Door: 21
Spoiler:

Door: 22
Spoiler:
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
Heindal
Posts: 1343
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Coding Advent Calendar II

Post by Heindal »

Once again, to much signs per post.

Door: 23
Spoiler:

Door: 24
Spoiler:

Door: 25
Spoiler:
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
Post Reply