new campaign's questions and ideas
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.
- ChrundleTheGreat
- Posts: 84
- Joined: May 3rd, 2023, 1:25 am
- Location: The land of chapaqueños
new campaign's questions and ideas
hi everybody!!
im working on a new short, yet complicated campaign to teach myself more complex wml stuff:
if you think its a good/bad idea or you have suggestions i would apreciate the feedback.
anything really is appreciated...
thanks y'all!
--chrundle
im working on a new short, yet complicated campaign to teach myself more complex wml stuff:
- the campaign its only two scenarios long
- the campaign uses no amlas
- the campaign follows the story of a mage
- he recruits small lvl one one "orbs",
- the orbs are recruited using xp and not gold
- the mage has very high maximum xp, (9999 or so)
- all xp goes to the mage, whether the enemy unit is killed by the mage or the orbs
- not the mage nor the orbs lvl up
- orbs have weak attacks and are not very durable, but have zone of control
- each orb can be used (one time only) as a spell,
- the orb then dies.
- this spells can be:
- fireball: an strong area attack.
- freeze: a medium area attack that slows down enemies
- healing: it heals 8 points to any nearby units
if you think its a good/bad idea or you have suggestions i would apreciate the feedback.
anything really is appreciated...
thanks y'all!
--chrundle
- ChrundleTheGreat
- Posts: 84
- Joined: May 3rd, 2023, 1:25 am
- Location: The land of chapaqueños
Re: new campaign's questions and ideas
oh and the story takes place on a labyrinth, for anyone who's interested...
its a bit inspired by harry potter...
its a bit inspired by harry potter...
Re: new campaign's questions and ideas
Start by creating unit types.
- ChrundleTheGreat
- Posts: 84
- Joined: May 3rd, 2023, 1:25 am
- Location: The land of chapaqueños
Re: new campaign's questions and ideas
i made a unit for the orbs (Emperor zombie knight helped), it works well enough although it waits until a second attack is made in order to transfer xp to my mage unit...
Code: Select all
#textdomain wesnoth-wmlg
[unit_type]
id=magic_orb
name= _ "magic_orb"
race=mechanical
hitpoints=30
movement=6
experience=100
{AMLA_DEFAULT}
level=1
cost=10
alignment=neutral
advances_to=null
movement_type=smallfly
usage=archer
image="units/orb.png"
[attack]
name=beam
description=_ "beam"
icon="attacks/beam-sky-1.png"
type=pierce
range=ranged
[specials]
{WEAPON_SPECIAL_MAGICAL}
[/specials]
damage=4
number=6
movement_used=0
[/attack]
[event]
name=attack end
[filter]
side = 1
[not]
id=tommas
[/not]
[/filter]
{VARIABLE xp_transfer $unit.experience}
[modify_unit]
[filter]
id=$unit.id
[/filter]
experience=0
[/modify_unit]
[modify_unit]
[filter]
id=tommas
[/filter]
[effect]
apply_to=experience
increase=$xp_transfer
[/effect]
[/modify_unit]
first_time_only=no
[/event]
[event]
name=attack end
first_time_only=no
[filter_second]
side = 1
[not]
id=tommas
[/not]
[/filter_second]
{VARIABLE xp_transfer $second_unit.experience}
[modify_unit]
[filter]
id=$second_unit.id
[/filter]
experience=0
[/modify_unit]
[modify_unit]
[filter]
id=tommas
[/filter]
[effect]
apply_to=experience
increase=$xp_transfer
[/effect]
[/modify_unit]
[/event]
[/unit_type]
- ChrundleTheGreat
- Posts: 84
- Joined: May 3rd, 2023, 1:25 am
- Location: The land of chapaqueños
Re: new campaign's questions and ideas
im also facing the main next two issues; i want to recruit with xp, not gold, and i want a menu for transforming orbs into spells...
any ideas?
any ideas?
Re: new campaign's questions and ideas
You could update gold to be equal to xp. If you recruit, reduce xp. If you fight, increase gold.
-
- Posts: 1444
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: new campaign's questions and ideas
You're using attack end, I wonder if that happens before or after the unit is granted experience. If it's before, he'll have nothing to give on the first attack (or the third, fifth...).ChrundleTheGreat wrote: ↑May 15th, 2024, 7:21 pm
i made a unit for the orbs (Emperor zombie knight helped), it works well enough although it waits until a second attack is made in order to transfer xp to my mage unit...
I've never seen [event] inside [unit_type]. Since your event doesn't have an id, I wonder if you get one (well, two in this case) for every unit that is created? That would be interesting. I'm sure tommas would approve.
I don't see a {CLEAR_VARIABLE xp_transfer} in there anywhere.
The indentation is lacking. If you're not familiar with it, I'd recommend you look at wmlindent.
I notice that a decent part of both of those events are the same. You might look into creating your own macro, or adding a third event and using [fire_event] (I suspect the latter approach might be frowned on). You're going to want to learn to create macros at some point, while it's not all necessary to do it here it would be a fine time to learn (or not, nothing wrong with the way you're doing it now, IMO).
These are not the easiest things to do if you're new to WML. You seem to be making good progress, so I don't doubt you'll figure them out, but they're not trivial.ChrundleTheGreat wrote: ↑May 15th, 2024, 7:28 pm im also facing the main next two issues; i want to recruit with xp, not gold, and i want a menu for transforming orbs into spells...
any ideas?
There are events that happen when recruit happens. You could probably intercept the recruiting process, check for adequate experience, adjust player gold and leader XP, etc. I'm not sure how you would block the recruit if leader doesn't have enough XP besides killing it, which is a little odd, you probably would want to disallow the recruiting at all ([allow_recruit] and [disallow_recruit] might help, although you'd get a "no units available to recruit" type message, not "you don't have enough XP, loser" message).
https://wiki.wesnoth.org/EventWML
Not sure what transforming orb (a unit) into a spell means. If a spell is just another unit, there's a [transform_unit] action and/or macro. If you mean kill the unit and give tommas an new one-time-only attack, that's doable, but it's going to be a little complicated.
Of course, when you say menu [set_menu_item] immediately comes to mind. Not sure how you would do it on a specific unit without using lua, though.
Last edited by white_haired_uncle on May 15th, 2024, 9:24 pm, edited 1 time in total.
Speak softly, and carry Doombringer.
Re: new campaign's questions and ideas
Macro is easy dirty way, but unless you have performance issues there is no need to optimize code with fire_event.
{CLEAR_VARIABLE xp_transfer} is part of code quality improvement, but does not affect what your code does. Both events start by resetting it anyways.
{CLEAR_VARIABLE xp_transfer} is part of code quality improvement, but does not affect what your code does. Both events start by resetting it anyways.
- ChrundleTheGreat
- Posts: 84
- Joined: May 3rd, 2023, 1:25 am
- Location: The land of chapaqueños
Re: new campaign's questions and ideas
yes! thats whats happening, how could i fix that?white_haired_uncle wrote: ↑May 15th, 2024, 9:08 pm
You're using attack end, I wonder if that happens before or after the unit is granted experience. If it's before, he'll have nothing to give on the first attack (or the third, fifth...).
im using wml_guide as a template (by beetlenaut), and it suggested to include events in unit files, could you teach me about making macros?white_haired_uncle wrote: ↑May 15th, 2024, 9:08 pm I've never seen [event] inside [unit_type]. Since your event doesn't have an id, I wonder if you get one (well, two in this case) for every unit that is created? That would be interesting. I'm sure tommas would approve.
...
I notice that a decent part of both of those events are the same. You might look into creating your own macro, or adding a third event and using [fire_event] (I suspect the latter approach might be frowned on). You're going to want to learn to create macros at some point, while it's not all necessary to do it here it would be a fine time to learn (or not, nothing wrong with the way you're doing it now, IMO).
thanks, i am still interested in learning, .white_haired_uncle wrote: ↑May 15th, 2024, 9:08 pm These are not the easiest things to do if you're new to WML. You seem to be making good progress, so I don't doubt you'll figure them out, but they're not trivial.
There are events that happen when recruit happens. You could probably intercept the recruiting process, check for adequate experience, adjust player gold and leader XP, etc. I'm not sure how you would block the recruit if leader doesn't have enough XP besides killing it, which is a little odd, you probably would want to disallow the recruiting at all ([allow_recruit] and [disallow_recruit] might help, although you'd get a "no units available to recruit" type message, not "you don't have enough XP, loser" message).
Not sure what transforming orb (a unit) into a spell means. If a spell is just another unit, there's a [transform_unit] action and/or macro. If you mean kill the unit and give tommas an new one-time-only attack, that's doable, but it's going to be a little complicated.
for now i guess "no units available to recruit" would do.
i was thinking a menu appears, you select a spell and the unit (orb) dies, leaving behind one out of three effects,
- tommas recovers 10 hp
- every unit around the dying orb takes a high amount of damage (fire type)
- every unit takes a lower amount of damage and gets slowed down
white_haired_uncle wrote: ↑May 15th, 2024, 9:08 pm
Of course, when you say menu [set_menu_item] immediately comes to mind. Not sure how you would do it on a specific unit without using lua, though.
- ChrundleTheGreat
- Posts: 84
- Joined: May 3rd, 2023, 1:25 am
- Location: The land of chapaqueños
Re: new campaign's questions and ideas
Reducing xp after recruit is easier. Once you have that working I can help with Lua to
1) disable kill xp
2) disable fight xp
3) manually give kill and fight xp at attack end
4) update gold at attack end.
1) disable kill xp
2) disable fight xp
3) manually give kill and fight xp at attack end
4) update gold at attack end.
- ChrundleTheGreat
- Posts: 84
- Joined: May 3rd, 2023, 1:25 am
- Location: The land of chapaqueños
Re: new campaign's questions and ideas
could you explain how to do 3?
-
- Posts: 1444
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: new campaign's questions and ideas
I don't know that there is an event that happens "after attack end". The only thing I can think of is to:ChrundleTheGreat wrote: ↑May 15th, 2024, 10:31 pmyes! thats whats happening, how could i fix that?white_haired_uncle wrote: ↑May 15th, 2024, 9:08 pm
You're using attack end, I wonder if that happens before or after the unit is granted experience. If it's before, he'll have nothing to give on the first attack (or the third, fifth...).
1. Add a turn end event to transfer the XP from all orbs to tommas.
2. Add another attack event that transfers the XP. If you don't do this, you'll need to make sure orbs cannot advance (you should probably do that anyway).
Item 2 will probably require the use of [store_unit] with a filter to populate an array with all orbs on side 1 and then a for/foreach loop to run over that array. This is something you'll want to learn anyway.
[/quote]
This explains it better than I canChrundleTheGreat wrote: ↑May 15th, 2024, 10:31 pm im using wml_guide as a template (by beetlenaut), and it suggested to include events in unit files, could you teach me about making macros?
https://wiki.wesnoth.org/PreprocessorRef
You could use [set_menu_item] three times, or you could use [set_menu_item] and have it open a [message] with [option]s.ChrundleTheGreat wrote: ↑May 15th, 2024, 10:31 pm i was thinking a menu appears, you select a spell and the unit (orb) dies, leaving behind one out of three effects,
- tommas recovers 10 hp
- every unit around the dying orb takes a high amount of damage (fire type)
- every unit takes a lower amount of damage and gets slowed down
The trick is to only have the menu item available when an orb is selected, and to be able to identify which unit is selected when you do. I'll look into that.
Okay it looks like x1,y1 are set to the active tile when you open a menu item. The following will only show the menu item "Items" if the mouse is over a unit. You can modify this to check specifically if there is an orb there, and use x1,y1 in a filter to identify the orb:
Code: Select all
[set_menu_item]
id=3dropping
description=_"Items"
use_hotkey=yes
[default_hotkey]
key=i
shift=yes
[/default_hotkey]
[show_if]
[have_unit]
x,y=$x1,$y1
side=$side_number
[not]
[filter_wml]
[variables]
cant_pick=yes
[/variables]
[/filter_wml]
[/not]
[/have_unit]
[/show_if]
[command]
[show_inventory]
x,y=$x1,$y1
[/show_inventory]
[/command]
[/set_menu_item]
Speak softly, and carry Doombringer.
Re: new campaign's questions and ideas
You do not need to do 3. If you do "Reducing xp after recruit" I will do 1-4 for you.
- lhybrideur
- Posts: 408
- Joined: July 9th, 2019, 1:46 pm
Re: new campaign's questions and ideas
You could store xp in a variable in an attack event (start of the attack) and compare it to the xp in the attack_end even.
Then you reduce the xp by the difference and gives it to the leader.
Then you reduce the xp by the difference and gives it to the leader.