HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Multiinstanceability help

09-08-2006, 05:19 PM#1
zeroXD
I need some help making a spell of mine multiinstanceable (in the way all the players can use it at one time, one hero for each of them) ive tried it, but i couldnt figure it out. It is supposed to work just like the meat hook in dota, and it does. I just need help making it multiinstanceable.

Heres the triggers:
Trigger:
Meat Hook
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Meat Hook
Collapse Actions
Unit Group - Remove all units from HookDummies[(Player number of (Owner of (Triggering unit)))]
Unit Group - Add (Triggering unit) to HookDummies[(Player number of (Owner of (Triggering unit)))]
Set HookAngle[(Player number of (Owner of (Triggering unit)))] = (Angle from (Position of (Triggering unit)) to (Target point of ability being cast))
Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
Set HookCaster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
Set HookInteger[(Player number of (Owner of (Triggering unit)))] = 1
Set HookExpanding[(Player number of (Owner of (Triggering unit)))] = True
Unit - Create 1 Dummy Chain for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing HookAngle[(Player number of (Owner of (Triggering unit)))] degrees
Set HookDummy[0] = (Last created unit)

Trigger:
Meat Hook Moving
Collapse Events
Time - HookTimer expires
Conditions
Collapse Actions
Collapse For each (Integer HookLoopInteger) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookExpanding[HookLoopInteger] Equal to True
Collapse Then - Actions
Unit - Create 1 Dummy Chain for (Owner of HookCaster[HookLoopInteger]) at ((Position of HookDummy[(HookInteger[HookLoopInteger] - 1)]) offset by 25.00 towards HookAngle[HookLoopInteger] degrees) facing HookAngle[HookLoopInteger] degrees
Unit Group - Add (Last created unit) to HookDummies[HookLoopInteger]
Set HookDummy[HookInteger[HookLoopInteger]] = (Last created unit)
Collapse Unit Group - Pick every unit in (Units within 70.00 of (Position of HookDummy[HookInteger[HookLoopInteger]]) matching ((((Matching unit) is in HookDummies[HookLoopInteger]) Equal to False) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)) and do (Actions)
Collapse Loop - Actions
Set HookTarget[HookLoopInteger] = (Picked unit)
Unit - Turn collision for HookTarget[HookLoopInteger] Off
Set HookExpanding[HookLoopInteger] = False
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) belongs to an enemy of (Owner of HookCaster[HookLoopInteger])) Equal to True
Collapse Then - Actions
Unit - Cause HookCaster[HookLoopInteger] to damage (Picked unit), dealing (150.00 x (Real((Level of Meat Hook for HookCaster[HookLoopInteger])))) damage of attack type Hero and damage type Force
Special Effect - Create a special effect attached to the chest of HookTarget[HookLoopInteger] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
Special Effect - Destroy (Last created special effect)
Collapse Else - Actions
Do nothing
Set HookInteger[HookLoopInteger] = (HookInteger[HookLoopInteger] + 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookInteger[HookLoopInteger] Greater than or equal to 42
Collapse Then - Actions
Set HookExpanding[HookLoopInteger] = False
Collapse Else - Actions
Do nothing
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookInteger[HookLoopInteger] Greater than or equal to 2
Collapse Then - Actions
Unit - Remove HookDummy[HookInteger[HookLoopInteger]] from the game
Set HookDummy[HookInteger[HookLoopInteger]] = No unit
Set HookInteger[HookLoopInteger] = (HookInteger[HookLoopInteger] - 1)
Unit - Move HookTarget[HookLoopInteger] instantly to ((Position of HookTarget[HookLoopInteger]) offset by 25.00 towards (HookAngle[HookLoopInteger] + 180.00) degrees)
Collapse Else - Actions
Unit - Remove HookDummy[HookInteger[HookLoopInteger]] from the game
Unit - Unpause HookCaster[HookLoopInteger]
Unit - Turn collision for HookTarget[HookLoopInteger] On
Unit Group - Remove all units from HookDummies[HookLoopInteger]
Animation - Reset HookCaster[HookLoopInteger]'s animation
Set HookDummy[HookInteger[HookLoopInteger]] = No unit
Set HookCaster[HookLoopInteger] = No unit
Set HookTarget[HookLoopInteger] = No unit

Trigger:
Hook Dust SFX
Collapse Events
Time - HookDustTimer expires
Conditions
Collapse Actions
Collapse For each (Integer HookDustLoop) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookTarget[HookDustLoop] Not equal to No unit
Collapse Then - Actions
Special Effect - Create a special effect at (Position of HookTarget[HookDustLoop]) using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
Special Effect - Destroy (Last created special effect)
Collapse Else - Actions
Do nothing

Help needed.
09-08-2006, 05:28 PM#2
Captain Griffen
Trigger:
Set HookDummy[0] = (Last created unit)

Also, Do Nothing does nothing but take up processing time.
09-08-2006, 05:28 PM#3
blu_da_noob
Your hook dummy units are overwriting each other in the array at the moment. Perhaps try (in your first trigger) setting HookInteger[Player number of owner of casting unit] = ((Player number of owner of casting unit) - 1) * 100 + 1. (And change the condition in the second trigger to If HookInteger[HookLoopInteger] modulo 100 >= 42 or >= 2 for the different cases) You would also need to set the first one (the one you currently set to 0 in the array) to be at the HookInteger[Player number of owner of casting unit] - 1 in the HookDummy array.
09-08-2006, 05:35 PM#4
The)TideHunter(
Leaks fixed, use below.
Btw, your still leaking groups, but i have a headache.
Trigger:
Meat Hook
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Meat Hook
Collapse Actions
set TempPoint = Position of (Triggering unit)
set TargPoint = (Target point of ability being cast)
Unit Group - Remove all units from HookDummies[(Player number of (Owner of (Triggering unit)))]
Unit Group - Add (Triggering unit) to HookDummies[(Player number of (Owner of (Triggering unit)))]
Set HookAngle[(Player number of (Owner of (Triggering unit)))] = (Angle from TempPoint) to TargPoint)
Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
Set HookCaster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
Set HookInteger[(Player number of (Owner of (Triggering unit)))] = 1
Set HookExpanding[(Player number of (Owner of (Triggering unit)))] = True
Unit - Create 1 Dummy Chain for (Owner of (Triggering unit)) at (TempPoint) facing HookAngle[(Player number of (Owner of (Triggering unit)))] degrees
Set HookDummy[0] = (Last created unit)
Custom Script: call RemoveLocation(udg_TempPoint)
Custom Script: call RemoveLocation(udg_TargPoint)

Trigger:
Meat Hook Moving
Collapse Events
Time - HookTimer expires
Conditions
Collapse Actions
set HookDummyLoc = (Position of HookDummy[(HookInteger[HookLoopInteger] - 1)])
set HookTargetLoc = (Position of HookTarget[HookLoopInteger])
Collapse For each (Integer HookLoopInteger) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookExpanding[HookLoopInteger] Equal to True
Collapse Then - Actions
Unit - Create 1 Dummy Chain for (Owner of HookCaster[HookLoopInteger]) at HookDummyLoc offset by 25.00 towards HookAngle[HookLoopInteger] degrees) facing HookAngle[HookLoopInteger] degrees
Unit Group - Add (Last created unit) to HookDummies[HookLoopInteger]
Set HookDummy[HookInteger[HookLoopInteger]] = (Last created unit)
Collapse Unit Group - Pick every unit in (Units within 70.00 of (Position of HookDummy[HookInteger[HookLoopInteger]]) matching ((((Matching unit) is in HookDummies[HookLoopInteger]) Equal to False) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)) and do (Actions)
Collapse Loop - Actions
Set HookTarget[HookLoopInteger] = (Picked unit)
Unit - Turn collision for HookTarget[HookLoopInteger] Off
Set HookExpanding[HookLoopInteger] = False
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) belongs to an enemy of (Owner of HookCaster[HookLoopInteger])) Equal to True
Collapse Then - Actions
Unit - Cause HookCaster[HookLoopInteger] to damage (Picked unit), dealing (150.00 x (Real((Level of Meat Hook for HookCaster[HookLoopInteger])))) damage of attack type Hero and damage type Force
Special Effect - Create a special effect attached to the chest of HookTarget[HookLoopInteger] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
Special Effect - Destroy (Last created special effect)
Collapse Else - Actions
Do nothing
Set HookInteger[HookLoopInteger] = (HookInteger[HookLoopInteger] + 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookInteger[HookLoopInteger] Greater than or equal to 42
Collapse Then - Actions
Cinematic - Ping minimap for (All players) at HookDummyLoc for 5.00 seconds
Set HookExpanding[HookLoopInteger] = False
Collapse Else - Actions
Do nothing
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookInteger[HookLoopInteger] Greater than or equal to 2
Collapse Then - Actions
Unit - Remove HookDummy[HookInteger[HookLoopInteger]] from the game
Set HookDummy[HookInteger[HookLoopInteger]] = No unit
Set HookInteger[HookLoopInteger] = (HookInteger[HookLoopInteger] - 1)
Unit - Move HookTarget[HookLoopInteger] instantly to (HookTargetLoc offset by 25.00 towards (HookAngle[HookLoopInteger] + 180.00) degrees)
Collapse Else - Actions
Unit - Remove HookDummy[HookInteger[HookLoopInteger]] from the game
Unit - Unpause HookCaster[HookLoopInteger]
Unit - Turn collision for HookTarget[HookLoopInteger] On
Unit Group - Remove all units from HookDummies[HookLoopInteger]
Animation - Reset HookCaster[HookLoopInteger]'s animation
Set HookDummy[HookInteger[HookLoopInteger]] = No unit
Set HookCaster[HookLoopInteger] = No unit
Set HookTarget[HookLoopInteger] = No unit
Custom Script: call RemoveLocation(udg_HookDummyLoc)
Custom Script: call RemoveLocation(udg_HookTargetLoc)

Trigger:
Hook Dust SFX
Collapse Events
Time - HookDustTimer expires
Conditions
Collapse Actions
set HookTargetLoc = (Position of HookTarget[HookDustLoop])
Collapse For each (Integer HookDustLoop) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookTarget[HookDustLoop] Not equal to No unit
Collapse Then - Actions
Special Effect - Create a special effect at HookTargetLoc using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
Special Effect - Destroy (Last created special effect)
Collapse Else - Actions
Do nothing
Custom Script: RemoveLocation(udg_HookTargetLoc)
09-08-2006, 06:32 PM#5
moyack
I've added some lesser but effective optimizations
Trigger:
Meat Hook
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Meat Hook
Collapse Actions
Custom script: local location udg_TempPoint
Custom script: local location udg_TargPoint
set TempPoint = Position of (Triggering unit)
set TargPoint = (Target point of ability being cast)
Unit Group - Remove all units from HookDummies[(Player number of (Owner of (Triggering unit)))]
Unit Group - Add (Triggering unit) to HookDummies[(Player number of (Owner of (Triggering unit)))]
Set HookAngle[(Player number of (Owner of (Triggering unit)))] = (Angle from TempPoint) to TargPoint)
Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
Set HookCaster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
Set HookInteger[(Player number of (Owner of (Triggering unit)))] = 1
Set HookExpanding[(Player number of (Owner of (Triggering unit)))] = True
Unit - Create 1 Dummy Chain for (Owner of (Triggering unit)) at (TempPoint) facing HookAngle[(Player number of (Owner of (Triggering unit)))] degrees
Custom Script: call RemoveLocation(udg_TempPoint)
Custom Script: call RemoveLocation(udg_TargPoint)
Custom script: set udg_TempPoint = null
Custom script: set udg_TargPoint = null

I suggest to check this tutorials to convert triggers to JASS. Check here and here
09-08-2006, 09:10 PM#6
oNdizZ
Last time i was around the "local global... exploit?" only worked with one global.
09-08-2006, 09:14 PM#7
Captain Griffen
It does. Also, no point using the local trick where there is no wait, as you can just use a temporary global. Speed difference probably favours globals, as well, though there is basically no difference.
09-09-2006, 08:37 AM#8
zeroXD
Quote:
Originally Posted by Captain Griffen
Trigger:
Set HookDummy[0] = (Last created unit)

Also, Do Nothing does nothing but take up processing time.

It may take up processing time, but the spell currently runs lag-free at my laptop (its 6 years old). However, its just some old stuff i got used too. Ill remove it.

And i will try using TideHunters trigger first...

EDIT: The minimap ping was just a check to see if my locations was right during multiinstance testing

Reconfigured the triggers, using TideHunters ones. Now testing

Works excactly as my own triggers, only possible difference is less processing capacity use. Fucks up once two ore more players cast it at same time... Then a lot of stuff comes from the map center... Dont work onless only one cast it at same time. Current plan is to check Moyacks tips and convert the stuff into JASS.
09-09-2006, 08:45 AM#9
blu_da_noob
TideHunter didn't do anything about the MUI of the spell. The version he posted has the same problem I described above.
09-09-2006, 09:17 AM#10
zeroXD
Yeah, lol, i saw that... But excactly WHERE shall i input your math? Might you copy my trigger text, input your math and show me excact where?

Now i even discovered ONLY player 1 can cast it too, lol... Else the hook casts from the map center. Didnt see that cause i placed my multiinstance tester at map center.
09-09-2006, 09:38 AM#11
blu_da_noob
I did tell you where. Your triggers are too long for me to modify the bits easily (seeing as I can't just c+p into WE). You also learn a lot more if you fix stuff yourself, which is why other people shouldn't just make your triggers and fix everything for you. Helping you find mistakes is fine, rewriting your triggers to fix your mistakes so that you end up learning nothing is not.
09-09-2006, 12:47 PM#12
The)TideHunter(
My post just removed your location leaks.
The MUI part i could not find, blu has the answers! rawr.
09-09-2006, 08:12 PM#13
zeroXD
Now im testing your modulo stuff, hopefully works, but its easier if you write it as a trigger, instead of that stuff it is currently written as: evrything spread over two or three lines, making it difficult to see wats seperated and whats not. Anyways, i think i put it together right, so im testing now.
09-09-2006, 08:56 PM#14
zeroXD
It is still buggy, i dont know if i have written your math right (sry, im just 15 years old, or actually 14, 15 tomorrow...), but i have a feeling the problem lies in this trigger:
Trigger:
Meat Hook Moving
Collapse Events
Time - HookTimer expires
Conditions
Collapse Actions
Collapse For each (Integer HookLoopInteger) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookExpanding[HookLoopInteger] Equal to True
Collapse Then - Actions
Set HookDummyLoc = (Position of HookDummy[(HookInteger[HookLoopInteger] - 1)])
Unit - Create 1 Dummy Chain for (Owner of HookCaster[HookLoopInteger]) at (HookDummyLoc offset by 25.00 towards HookAngle[HookLoopInteger] degrees) facing HookAngle[HookLoopInteger] degrees
Unit Group - Add (Last created unit) to HookDummies[HookLoopInteger]
Set HookDummy[HookInteger[HookLoopInteger]] = (Last created unit)
Collapse Unit Group - Pick every unit in (Random 1 units from (Units within 70.00 of (Position of HookDummy[HookInteger[HookLoopInteger]]) matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)) and ((((Matching unit) is in HookDummies[HookLoopInt and do (Actions)
Collapse Loop - Actions
Set HookTarget[HookLoopInteger] = (Picked unit)
Unit - Turn collision for HookTarget[HookLoopInteger] Off
Set HookExpanding[HookLoopInteger] = False
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) belongs to an enemy of (Owner of HookCaster[HookLoopInteger])) Equal to True
Collapse Then - Actions
Unit - Cause HookCaster[HookLoopInteger] to damage (Picked unit), dealing (150.00 x (Real((Level of Meat Hook for HookCaster[HookLoopInteger])))) damage of attack type Hero and damage type Force
Special Effect - Create a special effect attached to the chest of HookTarget[HookLoopInteger] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
Special Effect - Destroy (Last created special effect)
Else - Actions
Set HookInteger[HookLoopInteger] = (HookInteger[HookLoopInteger] + 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookInteger[(HookLoopInteger mod 100)] Greater than or equal to 42
Collapse Then - Actions
Set HookExpanding[HookLoopInteger] = False
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HookInteger[(HookLoopInteger mod 100)] Greater than or equal to 2
Collapse Then - Actions
Set HookTargetLoc = (Position of HookTarget[HookLoopInteger])
Unit - Remove HookDummy[HookInteger[HookLoopInteger]] from the game
Set HookDummy[HookInteger[HookLoopInteger]] = No unit
Set HookInteger[HookLoopInteger] = (HookInteger[HookLoopInteger] - 1)
Unit - Move HookTarget[HookLoopInteger] instantly to (HookTargetLoc offset by 25.00 towards (HookAngle[HookLoopInteger] + 180.00) degrees)
Collapse Else - Actions
Unit - Remove HookDummy[HookInteger[HookLoopInteger]] from the game
Unit - Unpause HookCaster[HookLoopInteger]
Unit - Turn collision for HookTarget[HookLoopInteger] On
Unit Group - Remove all units from HookDummies[HookLoopInteger]
Animation - Reset HookCaster[HookLoopInteger]'s animation
Set HookDummy[HookInteger[HookLoopInteger]] = No unit
Set HookCaster[HookLoopInteger] = No unit
Set HookTarget[HookLoopInteger] = No unit
Custom script: call RemoveLocation(udg_HookDummyLoc)
Custom script: call RemoveLocation(udg_HookTargetLoc)

If it isnt this triggers fault, it gotto be the initiate trigger:
Trigger:
Meat Hook
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Meat Hook
Collapse Actions
Set TempPoint = (Position of (Triggering unit))
Set TargPoint = (Target point of ability being cast)
Unit Group - Remove all units from HookDummies[(Player number of (Owner of (Triggering unit)))]
Unit Group - Add (Triggering unit) to HookDummies[(Player number of (Owner of (Triggering unit)))]
Set HookAngle[(Player number of (Owner of (Triggering unit)))] = (Angle from TempPoint to TargPoint)
Set HookCaster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
Set HookInteger[(Player number of (Owner of (Triggering unit)))] = ((((Player number of (Owner of (Triggering unit))) - 1) x 100) + 1)
Set HookExpanding[(Player number of (Owner of (Triggering unit)))] = True
Unit - Create 1 Dummy Chain for (Owner of (Triggering unit)) at TempPoint facing TargPoint
Unit - Add a 0.10 second Generic expiration timer to (Last created unit)
Unit Group - Add (Last created unit) to HookDummies[(Player number of (Owner of (Triggering unit)))]
Set HookDummy[((Player number of (Owner of (Triggering unit))) - 1)] = (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TargPoint)

I tried your math stuff, blu_da_noob, but if it aint right, its propably my fault. Problem is, only player 1 can cast hook... And it starts at center of map. I think ill post the whole thing here...

EDIT: Sry for posting two posts in a row, my fault. I know im now supposed to double-post....

Check the map below (yes, blu_da_noob, this means it is possible to c+p, + you can see excactly whats wrong, you can either enable the MUI check trigger, or use the other unit to cast it. Shared units.)
09-09-2006, 09:59 PM#15
blu_da_noob
Ok, you mostly just got some of your bracketing wrong now (which is why I hate GUI, the arithmatic is so messy to use).

Trigger:
Set HookDummy[((Player number of (Owner of (Triggering unit))) - 1)] = (Last created unit)
Should be:
Trigger:
Set HookDummy[(HookInteger[(Player number of (Owner of (Triggering unit)))] - 1)] = (Last created unit)

Trigger:
HookInteger[(HookLoopInteger mod 100)] Greater than or equal to 42
Should be:
Trigger:
(HookInteger[HookLoopInteger] mod 100) Greater than or equal to 42
(And the other one the same change, but with >= 2)

I'm attaching the version I modified to fix those, so you can see the changes more easily (and I did test it and it worked fine, including with two casting simultaneously; I even had them hook each other at the same time :P).
Attached Files
File type: w3xMeat Hook.w3x (35.8 KB)