• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Stance Change Trigger

Status
Not open for further replies.
Level 2
Joined
Aug 9, 2012
Messages
19
I've made a trigger where a unit can switch between 3 different stances but the unit will only switch between 2 stances.

Here's the trigger I'm having trouble with:
  • Attune Element Water to Fire
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attune Fire (R)
    • Actions
      • Set Elementalist_UnitWF = (Triggering unit)
      • Set Elementalist_Level = (Hero level of Elementalist_UnitWF)
      • Set Elementalist_QSkills = (Level of Snap Freeze for Elementalist_UnitWF)
      • Set Elementalist_WSkills = (Level of Frost Armor for Elementalist_UnitWF)
      • Unit - Remove Elementalist_UnitWF from the game
      • Unit - Create 1 Elementalist (Fire) for (Owner of Elementalist_UnitWF) at (Position of Elementalist_UnitWF) facing Default building facing degrees
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Snap Freeze for (Triggering unit)) Greater than or equal to 1
        • Then - Actions
          • Unit - Add Fireball to (Last created unit)
          • Unit - Set level of Fireball for (Last created unit) to Elementalist_QSkills
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Frost Armor for (Triggering unit)) Greater than or equal to 1
        • Then - Actions
          • Unit - Add Draining Flame to (Last created unit)
          • Unit - Set level of Draining Flame for (Last created unit) to Elementalist_WSkills
        • Else - Actions
      • Hero - Set (Last created unit) Hero-level to Elementalist_Level, Hide level-up graphics
      • Hero - Modify unspent skill points of (Last created unit): Set to 0 points
      • Unit - Add Attune Water (E) to (Last created unit)
      • Unit - Add Attune Air (R) to (Last created unit)
      • Selection - Select (Last created unit) for (Owner of Elementalist_UnitWF)
I have other triggers if you need to see them, but they look almost the same as this one
 
Level 25
Joined
Sep 26, 2009
Messages
2,390
Well, there are some things that don't make sense imo. Not sure how WCIII handles this stuff... Anyway you remove unit from the game - afaik you will lose all reference to that unit because it no longer exists (why should the game remember stuff about removed unit when there is no way to recover said unit). After that you refer to that non-existing unit to find out at what levels it had some ability (in those ITEs).

Apart from this, some efficiency stuff and some memory leaks, there will be quite an annoyance for anyone who plays it, because you only save that unit's level, but not that unit's experience.
So let's say I need 10 XP out of 600 to get to new level. I change stances and I ultimately lost 590 XP, because I start that level anew.

Apart from this all, I don't see any problem.
I would actually do the whole thing differently though. When player picks this hero (I just assume you pick heroes in that map), I would create immediately all three heroes (all three stances) and hide two of them and change their owner to neutral passive. When any hero learns an ability, learn that ability's equivalent to the other two stances.
When your hero levels up, level up the other two heroes.

Now when your hero changes stance, you just copy and paste the amount of XP to the stance he changes into and swap those two heroes. So the one who was hidden and owned by neutral hostile will be unhidden and owned by the player.
 
Level 2
Joined
Aug 9, 2012
Messages
19
Yeah I could of done it a simpler way but I was just going step by step to set this up. But I didn't even think about the XP thing, thanks for that. I'm just finding it weird that this one (and 2 others, switching to the same stance) won't work when the other ones do.
 
Status
Not open for further replies.
Top