• 🏆 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!

[General] Need a help with burrowed model

Status
Not open for further replies.
Level 4
Joined
Feb 9, 2010
Messages
48
Greetings,

I'm trying to create following spell:

Burrow
Unit burrows, losing ability to move, but gains increased damage, range and becomes permamently invisible.

Unit base is Barbed Arachnathid. The spell I use for this one is 'Bear Form', which basically switches between two units, "Unburrowed version" and "Burrowed version". Everthing works fine...

Except for the problem that Alternate form of Arachnathid model (So the burrowed one) wasn't created for units that can attack. So basically, when the burrowed unit attacks, it displayes 'regular attack' animation. So ingame you see unit attacking, while what I want is the unit to stand still and do nothing, just keep the "Stand Alternate" animation.

That's why I tried implementing a trigger which after the ability is cast, plays the "Stand Alternate" animation and changes the speed of animation for unit to 0%.

It didn't fix the problem, as now the unit's model disappears when it's attacking.

Another thing I tried was creating a dummy unit with the Alternate Stand animation at the location of Burrowed unit, which worked just perfectly, but I can't seem to remove the dummy unit after burrowed unit uses bear form again or dies.

I'm using:
Event Finishes casting spell
Condition: Ability being cast equal to burrow, unit type equal to unburrowed version
Actions: Set TempLoc = Location of casting unit
Set Tempgroup = Units in 50 range of Temploc matching condition: (Unit type equal to dummy unit)
Pick tempgroup and do actions:
- Remove picked unit

Somehow the tempgroup doesn't want to recognize the dummy units inside it.

Anyone has an idea of how to fix it? Thanks in advance.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
If the dummy has the locust ability it cannot be picked with the action of Units within range. You can however use units owned by player to enumerate through units with locust.

Bear in mind however that if multiple units need to cast this its advisable to index this spell so the proper unit is always removed.
 
Level 4
Joined
Feb 9, 2010
Messages
48
Hmm, that explains why it wasn't working.

Yeah, multiplty units will be using that spell and they will be changing (Aka some dying, some getting added via production, but overall the number is limited to 12).

How to create the proper trigger for it then? I know a bit of variables, but I don't know anything about hashtables or JASS. I don't know how to create a trigger that will remove the dummy unit that is just next to the "Burrowed unit" (Ontop of it actually). And only that dummy unit.
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
I don't know how to create a trigger that will remove the dummy unit that is just next to the "Burrowed unit" (Ontop of it actually). And only that dummy unit.
Whenever you make a dummy unit to appear burrowed, add it to DummyGroup, then do:
  • Events
    • Unit - a unit dies
    • Unit - a unit starts the effect of an ability
  • Conditions
    • Or - Any conditions are true
      • (Unit type of (Triggering unit)) equal to <Burrower>
      • (Ability being cast) equal to <Un bear form again>
  • Actions
    • Set Tmp_Pt = Position of (triggering unit)
    • Unit Group - Pick every unit in DummyGroup and do (Actions)
      • Loop - Actions
        • Set Tmp_Pt2 = Position of (Picked unit)
        • If (all conditions are true) then do (actions) else do (actions)
          • If - conditions
            • (Distance between Temp_Pt and Tmp_Pt2) less than or equal to THRESHHOLD //Probably can do 1.00
          • Then - Actions
            • Unit Group - Remove (picked unit) from DummyGroup
            • Unit - Remove (Picked Unit)
          • Else - Actions
        • Custom script: call RemoveLocation(udg_Tmp_Pt2)
    • Custom script: call RemoveLocation(udg_Tmp_Pt)
 
Level 4
Joined
Feb 9, 2010
Messages
48
Whenever you make a dummy unit to appear burrowed, add it to DummyGroup, then do:
  • Events
    • Unit - a unit dies
    • Unit - a unit starts the effect of an ability
  • Conditions
    • Or - Any conditions are true
      • (Unit type of (Triggering unit)) equal to <Burrower>
      • (Ability being cast) equal to <Un bear form again>
  • Actions
    • Set Tmp_Pt = Position of (triggering unit)
    • Unit Group - Pick every unit in DummyGroup and do (Actions)
      • Loop - Actions
        • Set Tmp_Pt2 = Position of (Picked unit)
        • If (all conditions are true) then do (actions) else do (actions)
          • If - conditions
            • (Distance between Temp_Pt and Tmp_Pt2) less than or equal to THRESHHOLD //Probably can do 1.00
          • Then - Actions
            • Unit Group - Remove (picked unit) from DummyGroup
            • Unit - Remove (Picked Unit)
          • Else - Actions
        • Custom script: call RemoveLocation(udg_Tmp_Pt2)
    • Custom script: call RemoveLocation(udg_Tmp_Pt)

Works as intended, thanks a lot.

Edit: Apparently I can't +rep you, because I need to give rep to 5 other people first. Well, more's the pity.
 
Status
Not open for further replies.
Top