• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

A spell problem

Status
Not open for further replies.
Level 11
Joined
Dec 5, 2009
Messages
846
Hello there im doing a spell. Its like this : Raises two walls around the enemy (on the two side from the caster's viewpoint.) After 4/3/2 seconds the two walls starts to rush at each other, crushing EVERY units between them. Deals 2x damage if the unit is at the central line. Damage: 200/300/400.

I came this far:

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Crusher
  • Actions
    • Set BTS_Caster = (Casting unit)
    • Set BTS_Real[1] = (Facing of BTS_Caster)
    • Set BTS_Point[1] = (Target point of ability being cast)
    • Unit - Create 1 BTS Point Dummy for Neutral Passive at BTS_Point[1] facing BTS_Real[1] degrees
    • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
    • Unit - Create 1 Stone Dummy for Neutral Passive at ((Position of (Last created unit)) offset by 500.00 towards 500.00 degrees) facing ((Facing of (Last created unit)) - 40.00) degrees
The Stone Dummy is one of the walls.

The facing is good but not the position of the Stone Dummy and i've tried many things didn't work very well. So i need your help with this thing.

NOTE: When i wrote this one
  • Unit - Create 1 Stone Dummy for Neutral Passive at ((Position of (Last created unit)) offset by 500.00 towards 500.00 degrees) facing ((Facing of (Last created unit)) - 40.00) degrees
with the position of last created unit i just wrote that fast i know it leaks.

Thanks everyone for the help!

Regards Chewii
 
Use this:
  • Set Points[1] = (Position of (Target unit of ability being cast))
  • For each (Integer A) from 1 to 2, do (Actions)
    • Loop - Actions
      • Set Points[2] = (Points[1] offset by 256.00 towards ((Facing of (Triggering unit)) + (250.00/(Real(IntegerA))))
      • Unit - Create 1 Stone Wall at Points[2] for (Owner of (Triggering unit)) facing ((Facing of (Triggering unit)) - 40.00)
      • Custom script: call RemoveLocation (udg_Points[2])
  • Custom script: call RemoveLocation (udg_Points[1])
 
Level 11
Joined
Dec 5, 2009
Messages
846
It works ! thank you once again! But i want the walls to move. And i did it like this


  • For each (Integer A) from 1 to 2, do (Actions)
    • Loop - Actions
      • Set BTS_Point[2] = (BTS_Point[1] offset by 500.00 towards ((Facing of (Triggering unit)) + (250.00 / (Real((Integer A))))) degrees)
      • Unit - Create 1 Stone Dummy for Neutral Passive at BTS_Point[2] facing ((Facing of (Triggering unit)) - 40.00) degrees
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Unit Group - Add (Last created unit) to BTS_Group[1]
Move trigger:

  • Events
    • Time - Every 0.03 seconds of game time
  • Actions
    • Unit Group - Pick every unit in BTS_Group[1] and do (Actions)
      • Loop - Actions
        • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 18.00 towards (Facing ??????
For the first thing the units don't save in the unit group and the second how to make them move towards each other? :D Thanks very very very much again!

Regards Chewii
 
Change their facing in the trigger that creates them, so that you can easily track it and set the offset point.
If you do:
  • Unit - Create ... facing Points[1]
You can use
  • Set Points[3] = (Position of (Picked unit))
  • Set Points[4] = (Points[3] offset by 18.00 towards (Facing of (Picked unit)))
  • Unit - Move (Picked unit) instantly to (Points[4])
  • Custom script: call RemoveLocation (udg_Points[3])
  • Custom script: call RemoveLocation (udg_Points[4])
So, you will not use Unit - Create Unit facing angle action, you will use Unit - Create Unit facing point instead.

(You can of course use Unit - Create unit facing angle, but that would require them to face the Angle between Points[2] to Points[1], so it might be a bit more confusing to you. The sure thing is facing point though.)
 
Level 11
Joined
Dec 5, 2009
Messages
846
I did like this

  • For each (Integer A) from 1 to 2, do (Actions)
    • Loop - Actions
      • Set BTS_Point[2] = (BTS_Point[1] offset by 250.00 towards ((Facing of (Triggering unit)) + (250.00 / (Real((Integer A))))) degrees)
      • Unit - Create 1 Stone Dummy for Neutral Passive at BTS_Point[2] facing BTS_Point[1]
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Unit Group - Add (Last created unit) to BTS_Group[2]
Its like this. The dummy units has another model and that's a wall. If i change that the wall should face the right direction it will not be straight. I want it like this: C= caster |= the walls | |
..................................................................... ...C
And how can i track it down with just create it with a facing point? isn't it the same as before?
 
Level 11
Joined
Dec 5, 2009
Messages
846
Thank you very very much again!! But now i have another prob.. I want all units in the wall range to go with the wall when its moving. You can pick all nearby units the wall unit. But if i pick like 300 it will be in a circle.. So i tested to make a dummy unit that should go with the wall but that din't work either. So i need some help with this one thanks everyone again i reallt appreciate it!!

Regards Chewii
 
It should be something like this:
Let's say Picked unit is the wall.
  • Set Points[0] = ((Load (Key(x)) of (Key(Picked unit)) from Hashtable), (Load (Key(y)) of (Key(Picked unit)) from Hashtable)
  • Set Points[1] = (Position of (Picked unit))
  • Set Points[4] = (Points[1] offset by 15.00 towards (Angle from Points[1] to Points[4])
  • Unit - Move (Picked unit) to Points[4]
  • If (All conditions are true) then do (Actions) else do (Actions)
    • If - Conditions
      • (Distance between Points[0] and Points[1]) Less than or Equal to 15.00
    • Then - Actions
      • Unit Group - Remove (Picked unit) from Unit Group
      • Unit - Kill (Picked unit)
      • Hashtable - Clear all child hashtables of (Key(Picked unit)) from Hashtable
    • Else - Actions
      • Set Temp_Group = (Units within 100.00 of (Points[1]) matching ((((Matching unit) is alive) Equal to True) and ((Matching unit) belongs to an enemy of (Owner of (Picked unit)) Equal to True) and ((Matching unit) is a structure) Equal to False)
      • Unit Group - Pick every unit in (Temp_Group) and do (Actions)
        • Loop - Actions
          • Set Points[2] = (Position of (Picked unit))
          • If (All conditions are true) then do (Actions) else do (Actions)
            • If - Conditions
              • (Cos(Angle from Points[1] to Points[2])) Less than or Equal to (Cos(180.00))
            • Then - Actions
              • Set Points[3] = (Points[2] offset by 15.00 towards (Angle from Points[2] to Points[0])
              • Custom script: call SetUnitX (GetEnumUnit(), GetLocationX (udg_Points[3])
              • Custom script: call SetUnitY (GetEnumUnit(), GetLocationY (udg_Points[3])
              • Custom script: call RemoveLocation (udg_Points[3])
          • Custom script: call RemoveLocation (udg_Points[2])
      • Custom script: call DestroyGroup (udg_Temp_Group)
  • Custom script: call RemoveLocation (udg_Points[1])
  • Custom script: call RemoveLocation (udg_Points[0])
  • Custom script: call RemoveLocation (udg_Points[4])
 
Level 11
Joined
Dec 5, 2009
Messages
846
I did it like this but it didn't work :p

  • Unit Group - Pick every unit in BTS_Groupm and do (Actions)
    • Loop - Actions
      • Set BTS_Point[3] = (Position of (Picked unit))
      • Set BTS_Point[4] = (Point((Load (Key x) of (Key (Picked unit)) from Hashtable), (Load (Key y) of (Key (Picked unit)) from Hashtable)))
      • Set BTS_Point[5] = (BTS_Point[3] offset by 15.00 towards (Angle from BTS_Point[3] to BTS_Point[4]) degrees)
      • Unit - Move (Picked unit) instantly to BTS_Point[5]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between BTS_Point[3] and BTS_Point[4]) Less than or equal to 15.00
        • Then - Actions
          • Unit Group - Remove (Picked unit) from BTS_Groupm
          • Sound - Play GateEpicDeath <gen> at 100.00% volume, attached to (Picked unit)
          • Sound - Stop (Load (Key sound) of (Key (Load (Key caster) of (Key (Picked unit)) in Hashtable)) in Hashtable) Immediately
          • Unit - Kill (Picked unit)
          • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
        • Else - Actions
          • Set BTS_Group[1] = (Units within 100.00 of BTS_Point[3] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A structure) Equal to False))))
          • Unit Group - Pick every unit in BTS_Group[1] and do (Actions)
            • Loop - Actions
              • Set BTS_Point[6] = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Cos((Angle from BTS_Point[3] to BTS_Point[2]))) Less than or equal to (Cos(180.00))
                • Then - Actions
                  • Set BTS_Point[7] = (BTS_Point[9] offset by 15.00 towards (Angle from BTS_Point[6] to BTS_Point[4]) degrees)
                  • Custom script: call SetUnitX (GetEnumUnit(), GetLocationX (udg_BTS_Point[7]))
                  • Custom script: call SetUnitY (GetEnumUnit(), GetLocationY (udg_BTS_Point[7]))
                  • Custom script: call RemoveLocation (udg_BTS_Point[7])
                • Else - Actions
              • Custom script: call RemoveLocation (udg_BTS_Point[6])
          • Custom script: call DestroyGroup (udg_BTS_Group[1])
      • Custom script: call RemoveLocation (udg_BTS_Point[3])
      • Custom script: call RemoveLocation (udg_BTS_Point[4])
      • Custom script: call RemoveLocation (udg_BTS_Point[5])
 
You made mistakes with your array numbers.
  • Set BTS_Point[6] = (Position of (Picked unit))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Cos((Angle from BTS_Point[3] to BTS_Point[2]))) Less than or equal to (Cos(180.00))
There is no BTS_Point[2], you just created a BTS_Point[6], so switch the If comparison to
(Cos((Angle from BTS_Point[3] to BTS_Point[6])


  • Set BTS_Point[7] = (BTS_Point[9] offset by 15.00 towards (Angle from BTS_Point[6] to BTS_Point[4]) degrees)
You haven't set Point[9], so, that should be,
Set BTS_Point[7] = (BTS_Point[6] offset ...)
 
Level 11
Joined
Dec 5, 2009
Messages
846
I did as you said but doesn't work either..
Like this
  • Unit Group - Pick every unit in BTS_Group[1] and do (Actions)
    • Loop - Actions
      • Set BTS_Point[6] = (Position of (Picked unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Cos((Angle from BTS_Point[3] to BTS_Point[6]))) Less than or equal to (Cos(180.00))
        • Then - Actions
          • Set BTS_Point[7] = (BTS_Point[6] offset by 15.00 towards (Angle from BTS_Point[6] to BTS_Point[4]) degrees)
          • Custom script: call SetUnitX (GetEnumUnit(), GetLocationX (udg_BTS_Point[7]))
          • Custom script: call SetUnitY (GetEnumUnit(), GetLocationY (udg_BTS_Point[7]))
          • Custom script: call RemoveLocation (udg_BTS_Point[7])
        • Else - Actions
      • Custom script: call RemoveLocation (udg_BTS_Point[6])
Ty again Regards chewii
 
Level 11
Joined
Dec 5, 2009
Messages
846
I changed that too but i didn't work either..


  • Else - Actions
    • Set BTS_Groups = (Units within 100.00 of BTS_Point[3] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A structure) Equal to False))))
    • Unit Group - Pick every unit in BTS_Groups and do (Actions)
      • Loop - Actions
        • Set BTS_Point[6] = (Position of (Picked unit))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Cos((Angle from BTS_Point[3] to BTS_Point[6]))) Less than or equal to (Cos(180.00))
          • Then - Actions
            • Set BTS_Point[7] = (BTS_Point[6] offset by 15.00 towards (Angle from BTS_Point[6] to BTS_Point[4]) degrees)
            • Custom script: call SetUnitX (GetEnumUnit(), GetLocationX (udg_BTS_Point[7]))
            • Custom script: call SetUnitY (GetEnumUnit(), GetLocationY (udg_BTS_Point[7]))
            • Custom script: call RemoveLocation (udg_BTS_Point[7])
          • Else - Actions
        • Custom script: call RemoveLocation (udg_BTS_Point[6])
    • Custom script: call DestroyGroup (udg_BTS_Groups)
 
Level 11
Joined
Dec 5, 2009
Messages
846
Here's the whole trigger. Ty for all help guys.

  • Spell Between Two Sides
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Between Two Sides
    • Actions
      • Set BTS_Caster = (Triggering unit)
      • Set BTS_Real[1] = (Facing of BTS_Caster)
      • Set BTS_Point[1] = (Target point of ability being cast)
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Sound - Play VolcanoLoop <gen> at 100.00% volume, attached to (Triggering unit)
      • Hashtable - Save Handle Of(Last played sound) as (Key sound) of (Key (Triggering unit)) in Hashtable
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Set BTS_Point[2] = (BTS_Point[1] offset by 500.00 towards ((Facing of (Triggering unit)) + (250.00 / (Real((Integer A))))) degrees)
          • Unit - Create 1 Stone Dummy for (Owner of (Triggering unit)) at BTS_Point[2] facing ((Facing of (Triggering unit)) + 90.00) degrees
          • Hashtable - Save (X of BTS_Point[1]) as (Key x) of (Key (Last created unit)) in Hashtable
          • Hashtable - Save (Y of BTS_Point[1]) as (Key y) of (Key (Last created unit)) in Hashtable
          • Hashtable - Save Handle Of(Triggering unit) as (Key caster) of (Key (Last created unit)) in Hashtable
          • Unit Group - Add (Last created unit) to BTS_Groupm
          • Custom script: call RemoveLocation (udg_BTS_Point[2])
      • Custom script: call RemoveLocation (udg_BTS_Point[1])
      • Trigger - Turn on Spell BTS Move <gen>
The move trigger

  • Spell BTS Move
    • 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
          • (BTS_Groupm is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in BTS_Groupm and do (Actions)
            • Loop - Actions
              • Set BTS_Point[3] = (Position of (Picked unit))
              • Set BTS_Point[4] = (Point((Load (Key x) of (Key (Picked unit)) from Hashtable), (Load (Key y) of (Key (Picked unit)) from Hashtable)))
              • Set BTS_Point[5] = (BTS_Point[3] offset by 15.00 towards (Angle from BTS_Point[3] to BTS_Point[4]) degrees)
              • Unit - Move (Picked unit) instantly to BTS_Point[5]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between BTS_Point[3] and BTS_Point[4]) Less than or equal to 15.00
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from BTS_Groupm
                  • Sound - Play GateEpicDeath <gen> at 100.00% volume, attached to (Picked unit)
                  • Sound - Stop (Load (Key sound) of (Key (Load (Key caster) of (Key (Picked unit)) in Hashtable)) in Hashtable) Immediately
                  • Unit - Kill (Picked unit)
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                • Else - Actions
                  • Set BTS_Groups = (Units within 100.00 of BTS_Point[3] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is A structure) Equal to False))))
                  • Unit Group - Pick every unit in BTS_Groups and do (Actions)
                    • Loop - Actions
                      • Set BTS_Point[6] = (Position of (Picked unit))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Cos((Angle from BTS_Point[3] to BTS_Point[6]))) Less than or equal to (Cos(180.00))
                        • Then - Actions
                          • Set BTS_Point[7] = (BTS_Point[6] offset by 15.00 towards (Angle from BTS_Point[6] to BTS_Point[4]) degrees)
                          • Custom script: call SetUnitX (GetEnumUnit(), GetLocationX (udg_BTS_Point[7]))
                          • Custom script: call SetUnitY (GetEnumUnit(), GetLocationY (udg_BTS_Point[7]))
                          • Custom script: call RemoveLocation (udg_BTS_Point[7])
                        • Else - Actions
                      • Custom script: call RemoveLocation (udg_BTS_Point[6])
                  • Custom script: call DestroyGroup (udg_BTS_Groups)
              • Custom script: call RemoveLocation (udg_BTS_Point[3])
              • Custom script: call RemoveLocation (udg_BTS_Point[4])
              • Custom script: call RemoveLocation (udg_BTS_Point[5])
there it is :p
 
Level 11
Joined
Dec 5, 2009
Messages
846
When i cast this spell two walls are going towards each other. And all units within the walls range should go with the wall i don't want the units to just go through the wall i want them to go with it. And the wall is a unit and the model of the wall is a wall xD

We say that this is the wall _____ I want the units to go with the wall even on the sides. That's what i want. Thanks very very much

Regards Chewii
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
I feel bad that nobody has helped you. To be honest I find it very difficult to troubleshoot GUI code since it is all based off of map-specific information. Typically I do not put a lot of work into the GUI help threads, but since absolutely no one has helped you I will on the condition that you post the map.
 
Level 11
Joined
Dec 5, 2009
Messages
846
Thanks man if you make this for me youre awesome!! :)
But you understand how i wanted it ? :D that's nice cuz it seems nobody understands me when im posting a description

This is how far i got..

PS: Its the BTS Spell not the other one :) Btw do you like the other spell i did ? :)
 

Attachments

  • Rock Wall BTS.w3x
    37.5 KB · Views: 45
Level 11
Joined
Dec 5, 2009
Messages
846
Pharaoh said that if i should put that line there the spell would work. And when i cast the spell as you see two walls are moving towards each other and then destroys when they comes near the other wall. But i want the units to go with the walls the walls just go through the units. And ofc i want to add some dmg in the end but that's easy the hard part is to make the units go with the walls.

And well do you think you can do that ? :D
 
Last edited:
Level 18
Joined
Jan 21, 2006
Messages
2,552
Did I not post a fixed test-map? I swear I did. It's on my desktop I'll post it up as soon as I get on it. I'm on a different computer at the moment.

Okay, I just read through the post in attempts to find my previous post (but apparently I didn't post anything). The condition that Cokemonkey11 mentioned before is the problem. If you remove the condition then the footmen that the spell affects are properly pushed into the middle. Your enumeration radius is small enough that only units that are immediately next to the wall are pulled, but if you want to make only units on one side of the wall get pushed inwards then you're going to have to correct your trigonometry.

I'll post a fix to the condition.

I really hate navigating through GUI problems, but one of the main problems you have here is comparing the angle to 180 degrees. The angle you are comparing it to should be based on the direction that the walls are moving in towards each other. It should be greater than that angle -90 or less than that angle +90.
 
Last edited:
Level 18
Joined
Jan 21, 2006
Messages
2,552
Seriously why is it that nobody else has solved this yet? I mean, I hate reviewing GUI code enough as it is but why is it that no other die-hard GUIers (I know they're out there) are giving this a look!
 
Status
Not open for further replies.
Top