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

Request: Drag to MUI please

Status
Not open for further replies.
Level 3
Joined
Sep 25, 2010
Messages
33
I dont know if this request has been done but (or too old to be done) but here now its MUI using hashtables sorry for lack of documentation feel free to do any stupid things to it
:ogre_haosis:

Edit: posted the bugless version here so i dont need to use the pastebin
its unefficient consult an expert to make it efficient forgot to preload but meh not like its a major thing to do

[Trigger=Drag initalization]Drag initialization
Events
Map initialization
Conditions
Actions
-------- Creates a hashtable then set it into a variable --------
Hashtable - Create a hashtable
Set DragHastable = (Last created hashtable)
-------- The aoe of the spell --------
-------- 1.if you are gonna make more lvls of the skill set more of the array variable --------
Set DragAoe[1] = 300.00
Set DragAoe[2] = 420.00
Set DragAoe[3] = 460.00
Set DragAoe[4] = 500.00
-------- The damages of the Aoe --------
-------- 4 Arrays means 4 levels --------
Set DragDamage[1] = 100.00
Set DragDamage[2] = 250.00
Set DragDamage[3] = 280.00
Set DragDamage[4] = 300.00
-------- We have finished setup of globals and the hashtable --------
-------- now we destroy the trigger cuz we dont need it anymore --------
-------- it can also lessen lag --------
Custom script: call DestroyTrigger(GetTriggeringTrigger())[/Trigger]

[Trigger=Drag Cast] Drag Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Drag
Actions
Set DragTarget = (Target unit of ability being cast)
Set DragCaster = (Triggering unit)
-------- Kinda found a bug myself --------
-------- Checks if the unit is already casted with drag if yes we do action if no we do something --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Load (Key Casted) of (Key (Target unit of ability being cast)) from DragHastable) Equal to True
Then - Actions
Set Dragged = False
Unit Group - Remove DragTarget from DragGroup
For each (Integer C) from 1 to 6, do (Actions)
Loop - Actions
Special Effect - Destroy (Load C of (Key (Target unit of ability being cast)) in DragHastable)
Hashtable - Clear all child hashtables of child (Key (Target unit of ability being cast)) in DragHastable
Set Dragged = True
Hashtable - Save Dragged as (Key Casted) of (Key (Target unit of ability being cast)) in DragHastable
Else - Actions
Set Dragged = True
Hashtable - Save Dragged as (Key Casted) of (Key (Target unit of ability being cast)) in DragHastable
Hashtable - Save Handle OfDragCaster as 0 of (Key (Target unit of ability being cast)) in DragHastable
Set DragPoints[0] = (Position of DragCaster)
Set DragPoints[1] = (Position of DragTarget)
Unit - Turn collision for DragTarget Off
-------- Create the Special effect and save it into a hashtable loading it later using a loop --------
Special Effect - Create a special effect attached to the foot,right of DragTarget using Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
Hashtable - Save Handle Of(Last created special effect) as 1 of (Key (Target unit of ability being cast)) in DragHastable
Special Effect - Create a special effect attached to the foot,left of DragTarget using Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
Hashtable - Save Handle Of(Last created special effect) as 2 of (Key (Target unit of ability being cast)) in DragHastable
Special Effect - Create a special effect attached to the hand,left of DragTarget using Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
Hashtable - Save Handle Of(Last created special effect) as 3 of (Key (Target unit of ability being cast)) in DragHastable
Special Effect - Create a special effect attached to the hand,right of DragTarget using Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
Hashtable - Save Handle Of(Last created special effect) as 4 of (Key (Target unit of ability being cast)) in DragHastable
Special Effect - Create a special effect attached to the chest of DragTarget using Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
Hashtable - Save Handle Of(Last created special effect) as 5 of (Key (Target unit of ability being cast)) in DragHastable
Special Effect - Create a special effect attached to the chest of DragTarget using Abilities\Weapons\DemonHunterMissile\DemonHunterMissile.mdl
Hashtable - Save Handle Of(Last created special effect) as 6 of (Key (Target unit of ability being cast)) in DragHastable
Unit - Create 1 Dummy for (Owner of DragCaster) at DragPoints[0] facing Default building facing degrees
Unit - Add Drag(prey(dummy)) to (Last created unit)
Unit - Set level of Drag(prey(dummy)) for (Last created unit) to (Level of Drag for DragCaster)
Unit - Order (Last created unit) to Human Sorceress - Invisibility DragCaster
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Unit - Pause DragTarget
-------- Add target to group --------
Unit Group - Add DragTarget to DragGroup
-------- Leak Destroy --------
Custom script: call RemoveLocation(udg_DragPoints[0])
Custom script: call RemoveLocation(udg_DragPoints[1])
-------- Turn on the Loop trigger --------
Trigger - Turn on Drag Loop <gen> [/trigger]


[Trigger=Drag Loop] Drag Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in DragGroup) Less than or equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Skip remaining actions
Else - Actions
Unit Group - Pick every unit in DragGroup and do (Actions)
Loop - Actions
-------- Loads needed values from the unit --------
Set DragCaster = (Load 0 of (Key (Picked unit)) in DragHastable)
Set DragPoints[0] = (Position of DragCaster)
Set DragPoints[1] = (Position of (Picked unit))
Set DragPoints[2] = (DragPoints[1] offset by 18.00 towards (Angle from DragPoints[1] to DragPoints[0]) degrees)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between DragPoints[0] and DragPoints[1]) Greater than 55.00
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain pathing at DragPoints[2] of type Walkability is off) Equal to True
Then - Actions
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\AvengerMissile\AvengerMissile.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at DragPoints[1] using Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\AcidBomb\BottleMissile.mdl
Special Effect - Destroy (Last created special effect)
Unit - Turn collision for (Picked unit) On
For each (Integer D) from 1 to 6, do (Actions)
Loop - Actions
Special Effect - Destroy (Load D of (Key (Picked unit)) in DragHastable)
Unit Group - Pick every unit in (Units within DragAoe[(Level of Drag for DragCaster)] of DragPoints[1] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of DragCaster)) Equ and do (Actions)
Loop - Actions
Unit - Cause DragCaster to damage (Picked unit), dealing DragDamage[(Level of Drag for DragCaster)] damage of attack type Spells and damage type Force
Set Dragged = False
Hashtable - Save Dragged as (Key Casted) of (Key (Target unit of ability being cast)) in DragHastable
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in DragHastable
Unit Group - Remove (Picked unit) from DragGroup
Else - Actions
Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_DragPoints[2]))
Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_DragPoints[2]))
Else - Actions
Unit Group - Pick every unit in (Units within DragAoe[(Level of Drag for DragCaster)] of DragPoints[1] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of DragCaster)) Equ and do (Actions)
Loop - Actions
Unit - Cause DragCaster to damage (Picked unit), dealing DragDamage[(Level of Drag for DragCaster)] damage of attack type Spells and damage type Force
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\AvengerMissile\AvengerMissile.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\AcidBomb\BottleMissile.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at DragPoints[1] using Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl
Special Effect - Destroy (Last created special effect)
-------- The Aoe --------
Unit - Turn collision for (Picked unit) On
-------- Here wuz the problem --------
-------- Instead of picked unit i inputted it in DragTarget --------
Unit - Unpause (Picked unit)
-------- Load the SFx then destroy it --------
Unit - Create 1 Dummy for (Owner of DragCaster) at DragPoints[0] facing Default building facing degrees
Unit - Add Drag(prey(dummy)) to (Last created unit)
Unit - Set level of Drag(prey(dummy)) for (Last created unit) to (Level of Drag for DragCaster)
Unit - Order (Last created unit) to Human Sorceress - Invisibility DragCaster
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
For each (Integer D) from 1 to 6, do (Actions)
Loop - Actions
Special Effect - Destroy (Load D of (Key (Picked unit)) in DragHastable)
Set Dragged = False
Hashtable - Save Dragged as (Key Casted) of (Key (Target unit of ability being cast)) in DragHastable
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in DragHastable
Unit Group - Remove (Picked unit) from DragGroup
Custom script: call RemoveLocation(udg_DragPoints[0])
Custom script: call RemoveLocation(udg_DragPoints[1])
Custom script: call RemoveLocation(udg_DragPoints[2]) [/trigger]
 

Attachments

  • Drag NOW MUI AND BUGLESS.w3x
    1 MB · Views: 36
Last edited:
Status
Not open for further replies.
Top