[allow_undo] in moveto events

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.

[allow_undo] in moveto events

Postby Paulomat4 » June 30th, 2013, 11:11 pm

EDIT: This is my thread for wml questions. The actual question is most likely on the last page of this thread.


I tried to modify the regenerates ability to produce an ability that works a bit like photosynthesis.
This means, that it should work like the normal regenerates ability at day, only heal 4 HP at day and do nothing at night.
But sadly it doesn't work. Does anybody of you know where the error is?
Please excuse me if i'm overlooking some obvious error, that's my first try at a custom ability.
here's the code:
Code: Select all
[regenerate]
        id=photoregenerates
        name= _ "photoregenerates"
        female_name= _ "female^photorenerates"
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
        [filter_self]
            [filter_location]
                time_of_day=lawful
            value=8
            poison=cured
            [/filter_location]
        [/filter_self]
        [filter_self]
            [filter_location]
                time_of_day=liminal
            value=4
            [/filter_location]
        [/filter_self]
    [/regenerate]
Last edited by Paulomat4 on March 18th, 2017, 6:05 pm, edited 22 times in total.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Custom ability not working

Postby gfgtdf » June 30th, 2013, 11:20 pm

i suppose you cannot have the "value" and "poison" key in the filter tag, try using 2 [regenerate] tags with different values and fillters.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 843
Joined: February 10th, 2013, 2:25 pm

Re: Custom ability not working

Postby Paulomat4 » June 30th, 2013, 11:40 pm

tried it like this
Code: Select all
        id=photoregenerates
        name= _ "Photoregenerates"
        female_name= _ "female^photorenerates"
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
   [regenerate]
      [filter_self]
            [filter_location]
                time_of_day=lawful
            value=8
            poison=cured
            [/filter_location]
        [/filter_self]
   [/regenerate]
   [regenerate]
      [filter_self]
            [filter_location]
                time_of_day=lawful
            poison=cured
            [/filter_location]
        [/filter_self]
   [/regenerate]
   [regenerate]
        [filter_self]
            [filter_location]
                time_of_day=liminal
            value=4
            [/filter_location]
        [/filter_self]
    [/regenerate]

and like this:
Code: Select all
        id=photoregenerates
        name= _ "Photoregenerates"
        female_name= _ "female^photorenerates"
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
   [regenerate]
      [filter_self]
            [filter_location]
                time_of_day=lawful
            value=8
            poison=cured
            [/filter_location]
        [/filter_self]
   [/regenerate]
   [regenerate]
        [filter_self]
            [filter_location]
                time_of_day=liminal
            value=4
            [/filter_location]
        [/filter_self]
    [/regenerate]

but both don't even show up in the unit's sidebar like the original one i posted. :hmm:
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Custom ability not working

Postby gfgtdf » June 30th, 2013, 11:49 pm

you still have the "value" and "poison" inside the filter tag....
plus regenerate tags always have to be inside [abilities] tags
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 843
Joined: February 10th, 2013, 2:25 pm

Re: Custom ability not working

Postby Paulomat4 » June 30th, 2013, 11:56 pm

Code: Select all
        id=photoregenerates
        name= _ "Photoregenerates"
        female_name= _ "female^photorenerates"
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
   [/abilities]
       [regenerate]
           value=8
          poison=cured
          [filter_self]
                [filter_location]
                    time_of_day=lawful
                [/filter_location]
            [/filter_self]
       [/regenerate]
       [regenerate]
            [filter_self]
                [filter_location]
                    time_of_day=liminal
                [/filter_location]
            [/filter_self]
          value=4
        [/regenerate]
   [/abilities]

like this?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Custom ability not working

Postby gfgtdf » July 1st, 2013, 12:05 am

hmm :S this looks better than the code in the second post.

try this, (and forget my second post)
Code: Select all
[regenerate]
   id=photoregenerates
   name= _ "photoregenerates"
   female_name= _ "female^photorenerates"
   description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
   affect_self=yes
   value=8
   poison=cured
   [filter_self]
      [filter_location]
         time_of_day=lawful
      [/filter_location]
   [/filter_self]
[/regenerate]
[regenerate]
   value=4
   [filter_self]
      [filter_location]
         time_of_day=liminal
      [/filter_location]
   [/filter_self]
[/regenerate]
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 843
Joined: February 10th, 2013, 2:25 pm

Re: Custom ability not working

Postby Paulomat4 » July 1st, 2013, 12:12 am

Works now for daytime, but during twilight nothing happens.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Custom ability not working

Postby Pentarctagon » July 1st, 2013, 12:23 am

Could you just do use a [not] and change time_of_day=chaotic?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Pentarctagon
Forum Administrator
 
Posts: 2791
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Custom ability not working

Postby JaMiT » July 1st, 2013, 12:27 am

This looks like a case of not following documentation. Let's start with the [abilities] tag. As documented, this accepts a tag of any name, but no keys:
Code: Select all
[abilities]
    [regenerate]
    [/regenerate]
    [regenerate]
    [/regenerate]
[/abilities]
(Note that when creating a macro for this ability, you would omit "[abilities]" and "[/abilities]", leaving just the pair of [regenerate] tags.)

Next we look at the common keys and tags for every ability.
Code: Select all
[abilities]
    [regenerate]
        id=photoregenerates
        name= _ "Photoregenerates"
        female_name= _ "female^Photoregenerates" # <-- Spell check intervention
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
        [filter]
        [/filter]
    [/regenerate]
    [regenerate]
        id=photoregenerates_hidden
        # Note: no name nor description so that this ability does not get listed.
        # (In version 1.11 you might want to change this up a little, but worry about that later.)
        affect_self=yes
        [filter]
        [/filter]
    [/regenerate]
[/abilities]

Next would be the extra keys used by the [regenerate] ability (specifically value and poison):
Code: Select all
[abilities]
    [regenerate]
        id=photoregenerates
        name= _ "Photoregenerates"
        female_name= _ "female^Photoregenerates"
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
        value=8 # <-- extra key for [regenerate]
        poison=cured # <-- extra key for [regenerate]
        [filter]
        [/filter]
    [/regenerate]
    [regenerate]
        id=photoregenerates_hidden
        # Note: no name nor description so that this ability does not get listed.
        # (In version 1.11 you might want to change this up a little, but worry about that later.)
        affect_self=yes
        value=4 # <-- extra key for [regenerate]
        [filter]
        [/filter]
    [/regenerate]
[/abilities]

OK, so now we need to fill in [filter] with a StandardUnitFilter. If you look at the documentation for a SUF, you might notice that "value=" is not listed, nor is "poison=". So putting those keys in a SUF does absolutely nothing, just like you observed not happening. What we can fill a SUF with includes "[filter_location]":
Code: Select all
[abilities]
    [regenerate]
        id=photoregenerates
        name= _ "Photoregenerates"
        female_name= _ "female^Photoregenerates"
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
        value=8
        poison=cured
        [filter]
            [filter_location]
            [/filter_location]
        [/filter]
    [/regenerate]
    [regenerate]
        id=photoregenerates_hidden
        # Note: no name nor description so that this ability does not get listed.
        # (In version 1.11 you might want to change this up a little, but worry about that later.)
        affect_self=yes
        value=4
        [filter]
            [filter_location]
            [/filter_location]
        [/filter]
    [/regenerate]
[/abilities]

Moving on, StandardLocationFilter:
Code: Select all
[abilities]
    [regenerate]
        id=photoregenerates
        name= _ "Photoregenerates"
        female_name= _ "female^Photoregenerates"
        description= _ "Photoregenerates:
The unit will heal itself 8 HP per turn at day and cure itself. This unit will heal itself 4 HP at twilight."
        affect_self=yes
        value=8
        poison=cured
        [filter]
            [filter_location]
                time_of_day=lawful
            [/filter_location]
        [/filter]
    [/regenerate]
    [regenerate]
        id=photoregenerates_hidden
        # Note: no name nor description so that this ability does not get listed.
        # (In version 1.11 you might want to change this up a little, but worry about that later.)
        affect_self=yes
        value=4
        [filter]
            [filter_location]
                time_of_day=neutral # <-- "liminal" seems to be not implemented. (?)
            [/filter_location]
        [/filter]
    [/regenerate]
[/abilities]

Divide and conquer.

Edit: OK, I see. The "liminal" support within SLFs was lost during the "great reversion" of 2011. Not sure if that's a big deal, since it never was more than an alias for "neutral" in this context anyway. I've updated the wiki.
JaMiT
Developer
 
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Custom ability not working

Postby Paulomat4 » July 1st, 2013, 12:42 am

hmmmm, this is weird. the unit now regenerates 8 hitpoints during day and twilight, and regenerates 4 hitpoints at night? :?
about the liminal: sry, i didn't know this. My mistake.
Edit: Ah, i know why, it's because i tested this on a unit with illuminates.
Thanks to everybody who helped me. :D
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Game crushed when trying my add-on

Postby Paulomat4 » July 5th, 2013, 7:27 pm

When testing my own campaign, the game tries to load it, but gets stuck, and then crashes without a bug message.
I suppose it has something to do with this scenario, because it was the last i was working on. I tried a bit, but it has nothing to do with the custom schedule i'm using.
I just can't see what's wrong with it.
Code: Select all
[scenario]
  id=02_rescue
  next_scenario=03_conference
 
  name= _ "Rescue"
  map_data="{~add-ons/Rise_of_the_second_sun/maps/02_rescue.map}"
  {TURNS 20 25 30}

  {CUSTOM_SCHEDULE}
   
  {EXTRA_SCENARIO_MUSIC elvish-theme.ogg}
  {EXTRA_SCENARIO_MUSIC sylvan_sanctuary.ogg}
 
  music=battle.ogg
 
  [event]
    name=prestart
    [objectives]
      side=1
      [objective]
        description= _ "Survive until the night ends"
        condition=win
      [/objective]
     [objective]
        description= _ "Defeat the Necromancer"+{EARLY_FINISH_BONUS_FOOTNOTE}"
        condition=win
      [/objective]
      [objective]
        description= _ "Death of Fiannon"
        condition=lose
      [/objective]
    [/objectives]
   {PLACE_IMAGE scenery/mine-abandoned.png 19 29}
   [recall]
        id=Alasar
      x=20
        y=18
    [/recall]
  [/event]

  [story]
        [part]
            story= _ "The elves were happy do have drawn back the attackers. But the victory wasn't cheap, and many good elves died that day. "
            background=story/landscape-battlefield.jpg
        [/part]
        [part]
            story=_"But the worse was yet to come. When the night fell upon the outpost... "
            background=story/landscape-battlefield-night.jpg
        [/part]
        [part]
          story=_"...lead by the smell of fresh corpses and blood, a new threat arose. "
            background=story/Darkmage.png
        [/part]
   [/story]
   {BIGMAP_RESCUE}
   
  [side]
    side=1
    controller=human
    team_name=1
    user_team_name= _ "Fort of Astelva"

    type=Elvish Thunderer
    id=Fiannon
    name= _ "Fiannon"
   profile=portraits/Fiannon.png
    canrecruit=yes

    recruit=Elvish Fighter,Elvish Archer,Elvish Shaman,Elvish Scout
    {INCOME 2 0 -2}
    {FLAG_VARIANT long}
    [village]
    x=18
    y=12
    [/village]
    [village]
    x=16
    y=15
    [/village]
    [village]
    x=18
    y=18
    [/village]
    [village]
    x=19
    y=17
    [/village]
    [village]
    x=24
    y=17
    [/village]
    [village]
    x=24
    y=14
    [/village]
  [/side]
  [side]
    side=2
    controller=ai
    team_name=2
    user_team_name= _ "Undead"

    type="Dark Sorcerer"
    id=Lirak
    name= _ "Mal Lirak"
    canrecruit=yes

    recruit="Skeleton,Skeleton Archer,Walking Corpse,Vampire Bat"

    {GOLD 200 300 400}
    {INCOME 5 10 15}
    {FLAG_VARIANT ragged}
  [/side]
 
    {DEATHS}
 
    [event]
        name=start
      [message]
      speaker=Fiannon
      message=_ "Oh no! A Necromancer!"
      [/message]
      [message]
      speaker=Fiannon
      message=_ "What do you want?"
      [/message]
      [message]
      speaker=Lirak
      message=_ "Ha, try to guess!"
      [/message]
      [message]
      speaker=Fiannon
      message=_ "Ugh, i don't know if we will make it."
      [/message]
      [message]
      speaker=Fiannon
      message=_ "Soldiers, wake up and prepare your weapons!"
      [/message]
      [message]
      speaker=Alasar
      message=_ "Ha, I'm always ready. I'll not let anybody defile the bodys of our deads nor allow someone to ressurect those orcs."
      [/message]
   [/event]
   
   [event]
        name=turn_10
      [scroll_to]
      x=21
      y=27
      [/scroll_to]
      {FLASH_WHITE ()}
       [unit]
            id=Naia
            name= _ "Naia"
            unrenamable=yes
            type=Portal Mage
            random_traits=no
         gender=female
            side=1
            x=21
            y=27
            [modifications]
            {TRAIT_LOYAL}
            [/modifications]
            {IS_HERO}
        [/unit]
       [unit]
           id=mage
            type=Mage
            side=1
            x=20
            y=26
            [modifications]
            {TRAIT_LOYAL}
            {TRAIT_QUICK}
            [/modifications]
            {IS_LOYAL}
        [/unit]
       [unit]
            type=Bowman
            side=1
            x=22
            y=27
            [modifications]
            {TRAIT_LOYAL}
            {TRAIT_QUICK}
            [/modifications]
            {IS_LOYAL}
        [/unit]
       [unit]
            type=Spearman
            side=1
            x=22
            y=26
            [modifications]
            {TRAIT_LOYAL}
            {TRAIT_STRONG}
            [/modifications]
            {IS_LOYAL}
        [/unit]
       [unit]
            type=Fencer
            side=1
            x=21
            y=26
            [modifications]
            {TRAIT_LOYAL}
            {TRAIT_INTELLIGENT}
            [/modifications]
            {IS_LOYAL}
        [/unit]

        [message]
            speaker=narrator
            message= _ "WOOOSH"
         icon="halo/teleport-1.png"
        [/message]
        [message]
            speaker=Naia
            message= _ "Whoops, seems like i missed his camp."
        [/message]
        [message]
            speaker=Fiannon
            message= _ "Hey, where are you coming from?"
        [/message]
        [message]
            speaker=Naia
            message= _ "We'll i tried to teleport us directly into Liraks camp to confront him directly, but it seems like i still haven't fully understand the teleportationspell. We'll have to fight through their units to kill them."
        [/message]
        [message]
            speaker=Fiannon
            message= _ "You know him?"
        [/message]
        [message]
            speaker=Naia
            message= _ "Yes, he was one of the best students of our academy. Until he turned to the dark arts. I was send to purge this dark stain of our academy."
        [/message]
        [message]
            speaker=mage
            message= _ "What a shame, he could have become a great mage."
        [/message]
        [message]
            speaker=Naia
            message= _ "Anyway, he needs to be killed. Need a helping hand?"
        [/message]
      [message]
            speaker=Fiannon
            message= _ "Sure. Your magic will be very helpfull."
        [/message]
      
    [objectives]
      side=1
      [objective]
        description= _ "Survive until the night ends"
        condition=win
      [/objective]
     [objective]
        description= _ "Defeat the Necromancer"+{EARLY_FINISH_BONUS_FOOTNOTE}"
        condition=win
      [/objective]
      [objective]
        description= _ "Death of Fiannon"
        condition=lose
      [/objective]
      [objective]
        description= _ "Death of Naia"
        condition=lose
      [/objective]
    [/objectives]
    [/event]
   
  [/scenario]
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Game crushes when trying my add-on

Postby zookeeper » July 5th, 2013, 7:32 pm

This is at least one thing (but in two places) that's wrong:
Code: Select all
description= _ "Defeat the Necromancer"+{EARLY_FINISH_BONUS_FOOTNOTE}"
User avatar
zookeeper
WML Wizard
 
Posts: 9517
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Game crushes when trying my add-on

Postby Paulomat4 » July 5th, 2013, 7:55 pm

oh, thanks for the help. This has fixed it.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Game crushes when trying my add-on

Postby Paulomat4 » July 11th, 2013, 10:38 am

I'm getting a nested quoted string error, when opening a savefile of my campaign. Apparently it's in line 5 of this file. Perhaps it's obvious, but i can't see an error, as i was just pklaying around with the strong trait, doubling his effect.
Code: Select all
#define TRAIT_MIGHTY
    # Units with trait mighty get a +2 increment in hitpoints and melee damage.
    [trait]
        id=mighty
        male_name= _ "mighty"
        female_name= _ "female^mighty"
        [effect]
            apply_to=attack
            range=melee
            increase_damage=2
        [/effect]
        [effect]
            apply_to=hitpoints
            increase_total=2
        [/effect]
    [/trait]
#enddef

#define TRAIT_AGED2
    # Units with trait Aged get a 8 points HP decrease and have -1 movement and melee damage.
    [trait]
        id=aged2
        male_name= _ "aged"
        female_name= _ "female^aged"
        [effect]
            apply_to=hitpoints
            increase_total=-8
        [/effect]
        [effect]
            apply_to=attack
            range=melee
            increase_damage=-1
        [/effect]
    [/trait]
#enddef
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator
 
Posts: 666
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Game crushes when trying my add-on

Postby zookeeper » July 11th, 2013, 10:45 am

Doesn't look like anything's out of place there. I'm guessing you're probably interpreting the error message wrong.
User avatar
zookeeper
WML Wizard
 
Posts: 9517
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Next

Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 3 guests