Werewolves that change at night.
Moderator: Forum Moderators
Werewolves that change at night.
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.
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]
Re: Werewolves that change at night.
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
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
Re: Werewolves that change at night.
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
Re: Werewolves that change at night.
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.
Re: Werewolves that change at night.
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]
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]
Re: Werewolves that change at night.
COOL! Thanks. It works now. But the hp is still doing weird things. 
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.
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.

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.

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.
- Atreides
- Posts: 1234
- 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
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>
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>
- Atreides
- Posts: 1234
- 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
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.
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.