Werewolves that change at night.

It's not easy creating an entire faction or era. Post your work and collaborate in this forum.

Moderator: Forum Moderators

Post Reply
Larceny
Posts: 10
Joined: September 23rd, 2011, 3:38 am

Werewolves that change at night.

Post by Larceny »

For starters, I'm somehow stupid and thusly cannot publish my era. Not that it works, which is why I'm here.
Without further ado, here's the code:

BTW: It works aside from not being able to store the original loyalist/werefolk unit, which results in a total die-off at dawn.

Code: Select all

[event] #this is the transformations
name=new_turn

first_time_only=no

        [store_time_of_day]
            variable=time_of_day
        [/store_time_of_day]

 [switch]
    variable=time_of_day.lawful_bonus # I use lawful bonus 'cuz it works
    [case]
       value=25 # If it's day...
    [store_unit]
        [filter]
		race=werefolk
		type=Beta,Husky,Alpha,Darkwolfe # and you are in werewolf form now...
        [/filter]

        variable=MODIFY_UNIT_store # we store you.
        kill=yes
    [/store_unit]

    {FOREACH MODIFY_UNIT_store MODIFY_UNIT_i}
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.hitpoints # here I attempt to set the new form's HP proportionally to the original's. It's buggy, but it's the least of my worries right now, since it's rather spotty, too.
            value=$($MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.max_hitpoints|/$MODIFY_UNIT_store[$MODIFY_UNIT_i].max_hitpoints|*$MODIFY_UNIT_store[$MODIFY_UNIT_i].hitpoints|)
        [/set_variable]
        [set_variable] # this is the crux of the affair. I cannot set the stored unit within the stored unit to store a unit.
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.variables.wereform
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i]|
        [/set_variable]
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.x # setting it's location...
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i].x|
        [/set_variable]
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.y # setting it's location...
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i].y|
        [/set_variable]
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.side # setting it's side...
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i].side|
        [/set_variable]

        [unstore_unit]
            variable=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform # and finally unstoring the unit stored in the stored unit.
            find_vacant=no
        [/unstore_unit]
    {NEXT MODIFY_UNIT_i}
    {CLEAR_VARIABLE MODIFY_UNIT_store}
    [/case]

    [case]
       value=-25
    [store_unit]                   # This code is virtually identical, simply reversed. The meat is the same.
        [filter]
		race=werefolk
			[not]
			type=Beta,Husky,Alpha,Darkwolfe
			[/not]
        [/filter]

        variable=MODIFY_UNIT_store
        kill=yes
    [/store_unit]

    {FOREACH MODIFY_UNIT_store MODIFY_UNIT_i}
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.hitpoints
            value=$($MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.max_hitpoints|/$MODIFY_UNIT_store[$MODIFY_UNIT_i].max_hitpoints|*$MODIFY_UNIT_store[$MODIFY_UNIT_i].hitpoints|)
        [/set_variable]
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.variables.wereform
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i]|
        [/set_variable]
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.x
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i].x|
        [/set_variable]
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.y
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i].y|
        [/set_variable]
        [set_variable]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.side
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i].side|
        [/set_variable]

        [unstore_unit]
            variable=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform
            find_vacant=no
        [/unstore_unit]
    {NEXT MODIFY_UNIT_i}
    [/case]
    [else]
       
    [/else]

 [/switch]
	[clear_variable]
		name=time_of_day
        [/clear_variable]
[/event]
User avatar
doofus-01
Art Director
Posts: 4178
Joined: January 6th, 2008, 9:27 pm
Location: USA

Re: Werewolves that change at night.

Post by doofus-01 »

Doesn't one of the mainline campaigns do this? Liberty, I think? Sorry I don't remember which scenario, but I think it uses a non-standard "death-squire" or something like that. The Loyalists turn undead at night, then they turn human in daytime. Does that sound familiar to anyone?
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
User avatar
Boldek
Posts: 576
Joined: April 14th, 2011, 6:37 pm

Re: Werewolves that change at night.

Post by Boldek »

the scenario 'unlawful orders' has a bunch of soldiers that become undead at sunset. third scenario in campaign liberty. probably best bet for your code.
Guys I never thought I'd come back to this forum after 8 years this is wild
Larceny
Posts: 10
Joined: September 23rd, 2011, 3:38 am

Re: Werewolves that change at night.

Post by Larceny »

I know. I looked into that, but it's not what I want. They don't have separate units. My code allows for you to have a Peasant that turns level 3 at night, and have proportional health to go with, so you don't have a Peasant with >50 health. Which wouldn't make sense at all.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Werewolves that change at night.

Post by zookeeper »

Code: Select all

        [set_variable] # this is the crux of the affair. I cannot set the stored unit within the stored unit to store a unit.
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.variables.wereform
            value=$MODIFY_UNIT_store[$MODIFY_UNIT_i]|
        [/set_variable]
Ok, a couple of misunderstandings here. Firstly, keys (such as value=) can only take string values. $MODIFY_UNIT_store[$MODIFY_UNIT_i]| cannot resolve to a string, because that variable reference is pointing to a whole tag, not another key. Doing that is, for all intents and purposes, always wrong. Secondly, [set_variable] cannot copy around whole tags anyway, for that you need [set_variables]:

Code: Select all

        [set_variables]
            name=MODIFY_UNIT_store[$MODIFY_UNIT_i].variables.wereform.variables.wereform
            to_variable=MODIFY_UNIT_store[$MODIFY_UNIT_i] # note the missing $ and the confusingly-named to_variable key
        [/set_variables]
Larceny
Posts: 10
Joined: September 23rd, 2011, 3:38 am

Re: Werewolves that change at night.

Post by Larceny »

COOL! Thanks. It works now. But the hp is still doing weird things. :x

EDIT: Well, everything works now. I figured it out on my own. WML division (either that or my storing and modifying hitpoints directly) made it so there was no decimal places. So, I just put the division last. :P

If you want the completed code, ask. Else I won't bother.

EDIT: Era is on server (at least for 1.8 [shtupid emoticons]) just search for werewol no other mod applies.
User avatar
Atreides
Posts: 1243
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off

New and Improved Version 1.2.0 uploaded

Post by Atreides »

I ported this from Wesnoth 1.8 to 1.14/16. Just a quick job buuuut I decided to fiddle with it a little and bam:

NEW & IMPROVED! (What is this? Laundry detergent? Maybe the werewolves got a nice shampooing.) :)
The crappy werewolf sprites have been replaced. (and shampooed)
The night is shorter. (dawn is no longer were-time although it might be Miller-time if you survived the night)
I've worked on this some and the newly added 'Default Werewolf Era' might be balanced. They only get level 0 humans as recruits and a level 1 leader. Costs have been adjusted. Now they are very weak in the day and still monsters at night.
The old era is still there for those with a need to ruthlessly savage some victims, hehehe. Well the victims are now from AoH so they might resist a few seconds longer. <wide grin>
User avatar
Atreides
Posts: 1243
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off

Werewolf Era for 1.18

Post by Atreides »

Ported to 1.18.

Interesting note: The core loyalist swordsman has new sprites but has lost the Indian Jones-esque sword twirling idle animation. I've kept the original sprite set for those afflicted with Lycanthropy. Old stats (1.8?) too of course.
Larceny
Posts: 10
Joined: September 23rd, 2011, 3:38 am

Re: Werewolves that change at night.

Post by Larceny »

Huh. Neat.
I hadn't imagined anyone would play the mod, let alone update it.

I have thoughts, if you want to read them...
You say you killed the infinite nesting? Nice.
It's really nice to have actual sprites that don't make your eyes bleed.
I feel like the attack sound should be a fist one like the Troll Whelp and Skelly Archer instead of the Wose one.
human version stored in more apropriate manform variable (clarity)
Funny etymology thing: "were" in "werewolf" actually meant "man" originally: https://www.merriam-webster.com/word-of ... 2017-10-31
It's crazy what you can learn in over 10 years.

I also see you made statuses transfer.
I didn't do that 'cause I didn't know how, so props on that. I just rationalized it with "I feel like a werewolf's human form could be sick and you wouldn't notice it at night".
It also let poison be an actual threat to them, since the wolf-form's regeneration and big HP pool would pretty well wash out the threat.

On that note, I see you took away their regeneration. I'm not a huuuge fan of that, 'cause:
- Regeneration is a fairly common werewolf myth attribute
- It makes werewolves want to sit on villages for healing, which feels a little weird. It might even make sense for werewolves to have bad evasion on cities. Would the Feral trait do that?
- The free healing is somewhat balanced out by the HP being scaled back down when the sun comes up.
- It's partly compensation for the loss of all your units' unique abilities at night, like good ranged combat or Skirmisher.
That said, it's a nerf, and they did probably need nerfs.

The level 0 units were supposed to "average out" to level 1 because they're level 2 at night.
It was a sort of "tech demo" for having different-level units, but it's also supposed to inject some build variety since it amplifies the normal Werefolk power curve/cycle.
Also, making all wolf forms start higher level is really overkill, especially since the wolf units are already pretty powerful for their level. If I wanted to make them more overpowered, I'd have just made the level 1 stronger.
...that said, this wasn't ever really balanced for multiplayer anyway.
(On the note of "multiplayer balance", I don't think I'd considered how (in the mirror match) player 1 has a massive advantage in being able to use the wolf-form's mobility and damage first. I don't think that's cleanly fixable, but it is pretty funny.)

The new "default" version that only has level 0s is sorely lacking in build variety.
Werefolk were already pretty samey because they have no non-humans (horses, mermen) and all become the same unit type at night, but this is on another level.
Also, it entirely rules out getting mages in your army, which means you can't access the fourth wolf unit type whose name now pains me to read.

Speaking of the Mage of Light thing, it makes me slightly negative on the "transform back for the dawn turn". thing.
If you have to get to a level 3 unit (and one that takes that much experience) to gain any more control of the transformation cycle, "you get to stay transformed for dawn turns in this small area" feels like a pretty sad payoff.
...on the other hand, it still lets you stay human all the time, and you get a leveled wolf form "for free".
Maybe it makes sense.


Anyhow, it was fun walking down memory lane.
Thanks
Post Reply