1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Unit to be replaced gets duplicated instead

Discussion in 'World Editor Help Zone' started by Eagle XI, Nov 21, 2015.

  1. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    When an unit with stoneform ability is supposed to get replaced through trigger it is getting duplicated instead, what may cause this and how to fix ?
    This is the triggered ability:
    • Fel Infusion
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Fel Infusion
        • (Race of (Target unit of ability being cast)) Equal to Demon
      • Actions
        • Set FelInf_Unit = (Target unit of ability being cast)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Grunt (fel)
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Grunt (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Worg Rider (fel)
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Worg Rider (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Spearthrower (fel)
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Spearthrower (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Drummer
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Drummer (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Drake Rider
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Drake Rider (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Black Drake
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Black Drake (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Warlock
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Warlock (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Dread Knight
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Dread Knight (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Stalker
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Stalker (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Fel Ogre
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Fel Ogre (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Fel Ogre
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Fel Ogre (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Peon (fel)
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Peon (chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Peon (upgraded)
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Peon (upgraded,chaos) using The old unit's relative life and mana
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of FelInf_Unit) Equal to Guard
          • Then - Actions
            • Unit - Replace FelInf_Unit with a Guard (chaos) using The old unit's relative life and mana
          • Else - Actions

    below part checks and displays error message blablah
    • Fel Infusion check
      • Events
        • Unit - A unit Is issued an order targeting an object
      • Conditions
        • (Issued order) Equal to (Order(rejuvination))
        • (Level of Fel Infusion for (Triggering unit)) Greater than 0
      • Actions
        • Set caster = (Triggering unit)
        • Set target = (Target unit of issued order)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of target) Not equal to (Owner of caster)
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
              • Then - Actions
                • Unit - Pause caster
                • Unit - Order caster to Stop
                • Unit - Unpause caster
                • -------- Display error message that you must target your own units --------
                • Custom script: if udg_ErrorSound == null then
                • Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
                • Custom script: endif
                • Set ErrorMessage = You need to target one of your own units
                • Set ErrorPlayer = (Owner of caster)
                • Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
                • Custom script: call ClearTextMessages()
                • Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
                • Custom script: call StartSound(udg_ErrorSound)
                • Custom script: endif
              • Else - Actions
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Race of target) Not equal to (Race of caster)
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
              • Then - Actions
                • Unit - Pause caster
                • Unit - Order caster to Stop
                • Unit - Unpause caster
                • -------- Display error message that you cant target that unit --------
                • Custom script: if udg_ErrorSound == null then
                • Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
                • Custom script: endif
                • Set ErrorMessage = You cant target allied, mercenary, summoned, or units that already have chaos damage.
                • Set ErrorPlayer = (Owner of caster)
                • Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
                • Custom script: call ClearTextMessages()
                • Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
                • Custom script: call StartSound(udg_ErrorSound)
                • Custom script: endif
              • Else - Actions
          • Else - Actions


    TL;DR: Ability itself functions as intended, except duplicating this particular Fel Ogre unit, which has an Sleep ability based on Stoneform.
    unitname(fel) are set to daemon race, unitname(chaos) are set race to orc
     
  2. Radicool

    Radicool

    Joined:
    Mar 27, 2011
    Messages:
    1,148
    Resources:
    4
    Maps:
    4
    Resources:
    4
    I'm not sure about this one, but I think you should nest your if statements within the first trigger. Put each if statement within the else branch. A small performance increase I think.
     
  3. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    So this spell isn't supposed to transform the caster, but the targeted unit of the ability?
     
  4. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    This is an ultimate skill for the Archon hero in my map, tooltip:
    In order to get it function right each chaos unit race is set to otherwise unused demon and has an clone with chaos dmg with race orc. Also the first check makes it sure you cant cast it on an ally, even if he too is playing Fel horde. (tooltip refers to Felhorde as Chaos)
    If this part can get fixed:
    then map with Fel horde will be my next release, so please help me ^^'
     
  5. Ceday

    Ceday

    Joined:
    Feb 22, 2010
    Messages:
    1,114
    Resources:
    0
    Resources:
    0
    Seriously, you have two if blocks for "Fel Ogre" unit, remove one of them.
     
  6. Eagle XI

    Eagle XI

    Joined:
    Mar 9, 2012
    Messages:
    1,359
    Resources:
    117
    Models:
    2
    Icons:
    109
    Packs:
    4
    Skins:
    2
    Resources:
    117
    >.<
    Ok, fixed in the map.
    That second block was supposed to be for converting an already sleeping ogre.

    I mean, its solved, ofcourse :p
     
    Last edited: Nov 22, 2015