Necromanteion [0.7.1]
Moderator: Forum Moderators
Re: Necromanteion
Oh, I think I see where the misunderstanding lies. My problem is that I want to have to following behaviour:
However, I will test it right now.
/edit: As I thought - doesn't work the way I want it to.
/edit2: I now doubled the complete code snippet and filtered it against the side number, making (for side 2):
This works, as I expected.
However: I am no programmer, but I know this can surely be done better in WML. Doubled code is not really well done WML, I think.
- Side 1 discovers the temple (moves a unit onto the temple hex for the first time): Message shown to side 1.
- Side 2 discovers the temple (like above): Message will be shown to side 2.
- After this the message shouldn't be shown again. (Therefore the first_time_only=yes)
However, I will test it right now.
/edit: As I thought - doesn't work the way I want it to.
/edit2: I now doubled the complete code snippet and filtered it against the side number, making (for side 2):
Code: Select all
[event]
name=moveto
first_time_only=yes
[filter]
side=2
x,y= 20,14
[/filter]
[message]
side_for=$side_number
duration=30
speaker=unit
message= _ "This has to be the temple we searched for. There's something written here... It's from the old legend:"
[/message]
[message]
side_for=$side_number
duration=30
caption= _"The Legend"
image="portraits/Kitty/undead-lich.png"
message= _ "As long as a true commander will search shelter in the temple, he shall be able to recruit those who are already dead to aid him. But alas, beware! Everyone who will search shelter in these walls will slowly suffer. The temple will ask for a part of his life in return for its help."
[/message]
[message]
side_for=$side_number
duration=30
speaker=unit
message= _ "It sounds dangerous, but I think, we will have no choice..."
[/message]
[/event]
However: I am no programmer, but I know this can surely be done better in WML. Doubled code is not really well done WML, I think.
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
Re: Necromanteion
Ok, I am new at this
Solved the duplication problem by using macros:
This seems the easiest way it can be achieved the way I want it to.
Of course a new key value for "first_time_only" called "yes_all_sides" would be great. I would expect such a key to work like this: execute the event for every side once and then delete the event from WML as it's now with "first_time_only=yes".
/edit: slight code change (replacing all $side_number with {SIDE})
Next steps:
- Making the temple hurt all non-undead creatures at start of turn (-10HP).
- Spawn undead units when temple is not occupied by a player's leader.
Solved the duplication problem by using macros:
Code: Select all
# send a message to player when occupying temple hex for the first time, explaining how it works
#define MESSAGE_TEMPLE_DISCOVERY SIDE
[event]
name=moveto
first_time_only=yes
[filter]
side={SIDE}
x,y= 20,14
[/filter]
[message]
side_for={SIDE}
duration=30
speaker=unit
message= _ "This has to be the temple we searched for. There's something written here... It's from the old legend:"
[/message]
[message]
side_for={SIDE}
duration=30
caption= _"The Legend"
image="portraits/Kitty/undead-lich.png"
message= _ "As long as a true commander will search shelter in the temple, he shall be able to recruit those who are already dead to aid him. But alas, beware! Everyone who will search shelter in these walls will slowly suffer. The temple will ask for a part of his life in return for its help."
[/message]
[message]
side_for={SIDE}
duration=30
speaker=unit
message= _ "It sounds dangerous, but I think, we will have no choice..."
[/message]
[/event]
#enddef
{MESSAGE_TEMPLE_DISCOVERY 1}
{MESSAGE_TEMPLE_DISCOVERY 2}
Of course a new key value for "first_time_only" called "yes_all_sides" would be great. I would expect such a key to work like this: execute the event for every side once and then delete the event from WML as it's now with "first_time_only=yes".
/edit: slight code change (replacing all $side_number with {SIDE})
Next steps:
- Making the temple hurt all non-undead creatures at start of turn (-10HP).
- Spawn undead units when temple is not occupied by a player's leader.
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
Re: Necromanteion
I am tired and stuck. I have written some more WML, but the event doesn't fire as it should.
(Yes, I know that I have the filters doubled in here. I'll address this later.)
However, if anyone finds a bug here, please let me know.
Me goes to bed now.
(Yes, I know that I have the filters doubled in here. I'll address this later.)
However, if anyone finds a bug here, please let me know.
Me goes to bed now.
Code: Select all
# drain 10 hp from every non-undead creature that starts its turn in the temple hex
[event]
name=new turn
first_time_only=no
[filter]
x,y=20,14
[not]
race=undead
[/not]
[/filter]
[store_unit]
[filter]
x,y=20,14
[not]
race=undead
[/not]
[/filter]
variable=temple_dweller
[set_variable]
name=temple_dweller.hitpoints
add=-10
[/set_variable]
[/store_unit]
[unstore_unit]
name=temple_dweller
[/unstore_unit]
[/event]
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
Re: Necromanteion
1. name=new turn events don't take a [filter], it doesn't make any sense in that context. When there's a new turn, there's no unit associated with that, unlike if when a unit moves, there's always a unit associated with it.
2. [set_variable] doesn't go inside [store_unit].
3. [unstore_unit] doesn't take a name=, but a variable=.
What you'd want is something like this:
2. [set_variable] doesn't go inside [store_unit].
3. [unstore_unit] doesn't take a name=, but a variable=.
What you'd want is something like this:
Code: Select all
# drain 10 hp from every non-undead creature that starts its turn in the temple hex
[event]
name=new turn
first_time_only=no
[if]
[have_unit]
x,y=20,14
[not]
race=undead
[/not]
[/have_unit]
[then]
[store_unit]
[filter]
x,y=20,14
[not]
race=undead
[/not]
[/filter]
variable=temple_dweller
[/store_unit]
[set_variable]
name=temple_dweller.hitpoints
add=-10
[/set_variable]
[unstore_unit]
variable=temple_dweller
find_vacant=no
text=_"-10"
{COLOR_HARM}
[/unstore_unit]
{CLEAR_VARIABLE temple_dweller}
[/then]
[/if]
[/event]
Re: Necromanteion
Perhaps you could include the lawful undead from Mirror Era? The generally-chaotic factions could recruit lawful undead, while the generally-lawful factions could recruit (standard) chaotic undead. This would increase the advantage of controlling the temple to every faction in an approximately equal way. The ability to gain lawful undead would probably even make the standard undead faction playable.Thanatos wrote:Hmm, I see.
1) As I stated above, no player should be allowed to play Undead on this map (if this is possible via WML. I don't know if I want to push this if I would have to create a fork of the default era only for that.)
2) Still, you are right of course, even if Undead themselves are not playable on the map. Drakes vs. Northerners for example would become a very messy matchup, allowing the Drakes to get good recruits for surviving the nights, while the Northerners gain nothing for the day.
This does have the downside of adding non-standard units and being somewhat difficult to explain (why do the lawful factions prefer chaotic undead, and why would the lawful undead side with chaotic factions?), but it should reduce the faction imbalance noted above and could prove an interesting twist.
Re: Necromanteion
@zookeeper:
Hah, I already thought about your number 2.
But I couldn't find some snippet that could prove me right last night. (Well, I think I will have to expand my sources beyond the WML Reference - which seems lacking examples - and Dovs Map Pack.)
Now I definately learned something about the "new turn" events.
After checking again the InternalActionsWML I think I now also understand the use of [have_unit]. And a look into DirectActionsWML made me understand better how [unstore_unit] works.
However, I don't understand the clearing. I thought, I read somewhere yesterday, that variables get cleared automatically - but that maybe wrong, I was tired. Still, in VariablesWML it says, you could use [clear_variable] to clear. What is the difference in using the macro? Just saving some lines, or is there some more complicated background?
Code implemented - of course it works as it should.
Updated credits to include zookeepers WML advice and support.
At least, my code wasn't sooo far away from the way it should be.
Hah, I already thought about your number 2.
But I couldn't find some snippet that could prove me right last night. (Well, I think I will have to expand my sources beyond the WML Reference - which seems lacking examples - and Dovs Map Pack.)
Now I definately learned something about the "new turn" events.
After checking again the InternalActionsWML I think I now also understand the use of [have_unit]. And a look into DirectActionsWML made me understand better how [unstore_unit] works.
However, I don't understand the clearing. I thought, I read somewhere yesterday, that variables get cleared automatically - but that maybe wrong, I was tired. Still, in VariablesWML it says, you could use [clear_variable] to clear. What is the difference in using the macro? Just saving some lines, or is there some more complicated background?
Code implemented - of course it works as it should.
Updated credits to include zookeepers WML advice and support.
At least, my code wasn't sooo far away from the way it should be.
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
Re: Necromanteion
While this is true and I also see the advantages for mirror matches you pointed to in another thread, I think it would spoil the atmossphere of the game.Loci wrote:Perhaps you could include the lawful undead from Mirror Era? The generally-chaotic factions could recruit lawful undead, while the generally-lawful factions could recruit (standard) chaotic undead. This would increase the advantage of controlling the temple to every faction in an approximately equal way. The ability to gain lawful undead would probably even make the standard undead faction playable.
In fact, "lawful undead" is a concept I don't want to work with. In my opionion the "chaotic" is pointing to the laws of nature which the undead abhorr by their simple existence. Dead creatures walking the earth is not what was intended by nature. (Especially not at broad daylight, if you count in, that the night was always the time of day most strongly related to magic and mysteries.)
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
Re: Necromanteion
The best (and quickest) way to find examples of whatever tag you wish is just grep/search mainline .cfg's for its occurrences and check out a couple of those.Thanatos wrote:@zookeeper:
Hah, I already thought about your number 2.
But I couldn't find some snippet that could prove me right last night. (Well, I think I will have to expand my sources beyond the WML Reference - which seems lacking examples - and Dovs Map Pack.)
No variables are ever cleared automatically. Except for the auto-stored $unit and similar variables (listed on VariablesWML).Thanatos wrote:Now I definately learned something about the "new turn" events.
After checking again the InternalActionsWML I think I now also understand the use of [have_unit]. And a look into DirectActionsWML made me understand better how [unstore_unit] works.
However, I don't understand the clearing. I thought, I read somewhere yesterday, that variables get cleared automatically - but that maybe wrong, I was tired.
Just saving some lines.Thanatos wrote:Still, in VariablesWML it says, you could use [clear_variable] to clear. What is the difference in using the macro? Just saving some lines, or is there some more complicated background?
The grep/search method also applies to macros. If you don't know what CLEAR_VARIABLE does and where it's defined, just search for #define CLEAR_VARIABLE in mainline .cfg's and check out what it contains. There's never a need to guess, you can easily just go check those things out yourself. I highly recommend anyone intending on writing any WML to get familiar with constantly doing that.
Re: Necromanteion
I will try to learn this by heart.zookeeper wrote:The grep/search method also applies to macros. If you don't know what CLEAR_VARIABLE does and where it's defined, just search for #define CLEAR_VARIABLE in mainline .cfg's and check out what it contains. There's never a need to guess, you can easily just go check those things out yourself. I highly recommend anyone intending on writing any WML to get familiar with constantly doing that.
However, the next step is to spawn undead units (wanderers in the area or defenders of the temple) while the temple is not occupied by a player's leading unit. For this, I have started to build my first nested event, because I want to give the players some advantage. Also note, that spawning all 5 undead units is not intended for final gameplay.
However, what has yet to be done with the code is:
1) randomize the spawned unit type from a list of pre-defined units.
2) randomize the spawn point (closest hex to 20,14 that is passable for the unit and occupies no other unit)
Code: Select all
# spawn undead if no leader occupies the temple hex
[event]
name=turn 5
[event]
name=new turn
first_time_only=no
[if]
[not]
[have_unit]
x,y=20,14
[and]
canrecruit=yes
[/and]
[/have_unit]
[/not]
[then]
{GENERIC_UNIT 3 "Skeleton" 20 8}
{GENERIC_UNIT 3 "Skeleton Archer" 21 8}
{GENERIC_UNIT 3 "Ghoul" 22 8}
{GENERIC_UNIT 3 "Ghost" 23 8}
{GENERIC_UNIT 3 "Walking Corpse" 24 8}
[/then]
[/if]
[/event]
[/event]
/edit2: Outlined a more dynamic approach. No time to work more on this today.
Code: Select all
# spawn undead if no leader occupies the temple hex
#define SELECT_RANDOM_UNDEAD
[set_variable]
name=rand_ud
rand=Ghost,Ghoul,Skeleton,Skeleton Archer,Walking Corpse
[/set_variable]
#enddef
#define SELECT_RANDOM_POS
[set_variable]
name=rand_posx
rand=15..25
[/set_variable]
[set_variable]
name=rand_posy
rand=9..19
[/set_variable]
[if]
[have_unit]
x,y=$rand_posx,$rand_posy
[/have_unit]
[then]
{SELECT_RANDOM_POS}
[/then]
[else]
[if]
[filter]
[filter_location]
terrain=Wo,Ww,Wwf,Mm^xm,Xu,Xv
[/filter_location]
[/filter]
[then]
{SELECT_RANDOM_POS}
[/then]
[/if]
[/else]
[/if]
#enddef
#define SPAWN_RANDOM_UNDEAD
{SELECT_RANDOM_UNDEAD}
{SELECT_RANDOM_POS}
{GENERIC_UNIT 3 rand_ud rand_posx rand_posy}
#enddef
[event]
name=turn 5
[event]
name=new turn
first_time_only=no
[if]
[not]
[have_unit]
x,y=20,14
[and]
canrecruit=yes
[/and]
[/have_unit]
[/not]
[then]
{SPAWN_RANDOM_UNDEAD}
{SPAWN_RANDOM_UNDEAD}
{SPAWN_RANDOM_UNDEAD}
{CLEAR_VARIABLE rand_ud}
{CLEAR_VARIABLE rand_posx}
{CLEAR_VARIABLE rand_posy}
[/then]
[/if]
[/event]
[/event]
/edit4: Quick and dirty try on SELECT_RANDOM_POS, including recursive macros (don't even know if that is supported by WML). Til later.
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
Re: Necromanteion
I'm not sure what else you need, but i'm willing to contribute if needed...
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
Re: Necromanteion
Welcome to my thread.
Actually, as far as I can tell, the scenario lacks four things at the moment:
1) a nice and fitting story background picture
2) a solution for the "player should not recruit undead" problem. (still not sure if that works)
3) a random positioning code (the one above makes Wesnoth crash on loading multiplayer)
4) a balanced battleground (map is yet blank grassland)
However, the WML issues first. I want to make sure the mechanics run smoothly before I start balancing the map and such stuff.
Actually, as far as I can tell, the scenario lacks four things at the moment:
1) a nice and fitting story background picture
2) a solution for the "player should not recruit undead" problem. (still not sure if that works)
3) a random positioning code (the one above makes Wesnoth crash on loading multiplayer)
4) a balanced battleground (map is yet blank grassland)
However, the WML issues first. I want to make sure the mechanics run smoothly before I start balancing the map and such stuff.
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
Re: Necromanteion
The only thing I can think of is killing Undead on sight, then making the player be able to choose the faction via message.Thanatos wrote: 2) a solution for the "player should not recruit undead" problem. (still not sure if that works)
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
Re: Necromanteion
Maybe you should create an era for your map that doesn't have Undead.
I'm just... a guy...
I'm back for now, I might get started on some work again.
I'm back for now, I might get started on some work again.
Re: Necromanteion
I thought about this earlier, because I surely would be the easiest way to do it. However, I am not sure if it would be the best way. The era would not have something new, it would just be a copy of the default era, without the undead being selectable for players.A Guy wrote:Maybe you should create an era for your map that doesn't have Undead.
ThanatoNoth | Necromanteion | Undead Rights Protection Society
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
"The gods can demand nothing of me. Even gods answer to me, eventually. [...] I cannot be bidden, I cannot be forced. I will do only that which I know to be right." (Death in Pratchett's "Mort")
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
Re: Necromanteion
No, like I said, if a player selects Undead, have an in game message that lets them select another faction. Easy, simple, and solves the problem.
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.