Any nice way to clean this up?

G

Goodspeed

Guest
:confused: Okay, so what this does you'll see here, is it slowly pushes units away from the target region of this Hero's Slam. I'm retarded and don't know how to loop properly, and also I'd like to add a duration-standstill for the Casting Hero so that he can't walk around and push others away that aren't supposed to be affected. You'll see my insane-stupid issue in my trigger right here:::

Code:
Call of Earth
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Call of Earth 
    Actions
        Environment - Create a 3.00 second Normal ripple deformation at (Position of (Triggering unit)) with starting radius 150.00, ending radius 450.00, and depth 100.00, using 1.00 second ripples spaced 30.00 apart
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
        Wait 0.01 seconds
        Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))

See what I mean? It works, it's just stupid[!]. Is there a good duration loop I'm missing? Just like the topic describes, any way to clean this up and create the same exact gradually-pushing affect? Let me know, thanks a lot anyone who can help or tries,

`Goodspeed,
 
Response to "Code-Tags"

Code tags on? I'm unfamiliar, I only just discovered that quoting around my trigger made it blue like everyone elses. I can see this Code Tag option now, by the number sign, but..., what should I use it on//for? You can tell I'm a noob.
 
code tags are like this

[code ] (take out spaces)
(put your code here)
[/code ] to end your code...(again taking out spaces)

and it'll look like this

Code:
 
Instead of using QUOTE tags, use CODE tags, as they indent your code, and make it not take up the whole screen.

For your problem, I would suggest doing something in JASS, wich is the language Warcraft III uses. The GUI triggers just make JASS code, but with JASS you can customise the code.
 
OK, here is the code for "Call Of Earth":

Code:
function AllyFilter takes nothing returns boolean
 return GetPlayerAlliance(GetTriggerPlayer(), GetOwningPlayer(GetFilterUnit()), ALLIANCE_PASSIVE) == true
endfunction

function CallOfEarthConds takes nothing returns boolean
 return GetSpellAbilityId() == '0000' // Put your spell ID here
endfunction

function PushUnit takes nothing returns nothing
 local integer i = 0
 local unit u = GetEnumUnit()
 local location l = GetUnitLoc(GetEnumUnit())
 local real a = AngleBetweenPoints(GetUnitLoc(GetTriggerUnit()), l)
 loop
  exitwhen i >= 12
  set l = PolarProjectionBJ(l, 30, a)
  call SetUnitPositionLoc(u, l)
  call TriggerSleepAction(0.01)
 endloop
 set l = null
 set u = null
endfunction

function DoCallOfEarth takes nothing returns nothing
 local unit u = GetSpellAbilityUnit()
 local location l = GetUnitLoc(u)
 call TerrainDeformationRippleBJ(3.00, false, l, 150.00, 450.00, 100.00, 1, 30.00)
 call ForGroupBJ(GetUnitsInRangeOfLocMatching(300.00, l, Condition(function AllyFilter)), function PushUnit)
endfunction

function InitTrig_Call_Of_Earth takes nothing returns nothing
    set gg_trg_Call_Of_Earth = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Call_Of_Earth, EVENT_PLAYER_UNIT_SPELL_FINISH)
    call TriggerAddCondition(gg_trg_Call_Of_Earth, Condition(function CallOfEarthConds))
    call TriggerAddAction(gg_trg_Call_Of_Earth, function DoCallOfEarth)
endfunction

PS: See that little scale in the top-right of my post? Thats the "Add Reputation" button :p
 
You do release not everyone on this forum knows jass, or even knows what jass is?

So I suggest you don't use that since you probally will have no clue how to change it or customize it.

PS: See that little scale in the top-right of my post? Thats the "Add Reputation" button
Good way not to get reputation.
 
Actually, that's the Give Reputation button.

Reputation can be good and bad.

Like what I'm giving you if you pull that comment out again will be bad :)

See? Examples, 56k ;) That's how ya teach em!
 
In case you don't know, here is how to put that code into your map:

Create a new trigger, and name it "Call Of Earth". While that trigger is selected, click "Edit > Convert to Custom Text". In the large text box labeld "Trigger Functions:" to the right, copy-paste the code in.
You will also have to replace "'0000'" with your ability ID. To find your ID, go to the Object Editor, and select your ability. Then hit "Ctrl + D", and the Ability ID should show. Put that ID into the trigger, and you should be all set.
 
Hey, I was just joki'n with the Reputation Button :(
 
Just as a note: Waits (TriggerSleepAction) doesnt work in ForGroup calls. And you realy must think about leaks when going jass. Leaks are mostly not accepted at all in jass spells. Since there is easy ways to avoid them.
Dont se this as an offence please, I am calling it feadback.

The simple working gui version, (AceHart was the first to say this but here is the code)


Code:
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Animate Dead
    Actions
        Environment - Create a 3.00 second Normal ripple deformation at (Position of (Triggering unit)) with starting radius 150.00, ending radius 450.00, and depth 100.00, using 1.00 second ripples spaced 30.00 apart
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in (Units within 300.00 of (Position of (Triggering unit))) and do (If ((Owner of (Picked unit)) Not equal to (Owner of (Triggering unit))) then do (Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 30.00 towards (Angle from (Position of (Triggering unit)) to (Position of (Picked unit))) degrees))
                Wait 0.01 seconds


>duration-standstill
what is that? A channeled ability maybe? Or pause the unit?
 
That GUI version WILL work, however it is Innoficiant, as it looks for units 12 times, genorates angles for each irration even though they are the same, ect.

This is a fully Commented version, with a Bug fix (Before it would only work on allys)

Code:
function AllyFilter takes nothing returns boolean
 return GetPlayerAlliance(GetTriggerPlayer(), GetOwningPlayer(GetFilterUnit()), ALLIANCE_PASSIVE) == false // Returns false if the "Picked" unit is an ally of the casting unit.
endfunction

function CallOfEarthConds takes nothing returns boolean
 return GetSpellAbilityId() == '0000' // Put your spell ID here. This function is called when a spell is cast, and will return true if the spell that is cast is equal to your custom spell.
endfunction

function PushUnit takes nothing returns nothing
 local integer i = 0 //Create a local variable "i" wich will be used for looping.
 local unit u = GetEnumUnit() //Local variable "u", and set it to be the GUI equivalant of "Picked Unit", wich is the unit that is picked in the "ForGroupBJ" line.
 local location l = GetUnitLoc(u) //Create and set local variable "l" to be the location of "u", or the Picked Unit.
 local real a = AngleBetweenPoints(GetUnitLoc(GetTriggerUnit()), l) //This creates and sets "a" to be the angle of movement, so we don't have to genorate it a bunch of times.
 loop //Start the loop. It will keep doing whatever is in the loop untill the "exitwhen" is true.
  exitwhen i >= 12 //The loop will end when the variable "i" is more or equal to 12.
  set l = PolarProjectionBJ(l, 30, a) //Set the variable "l" to be l with a polar offset of 30 tword "a", wich is the angle we genorated.
  call SetUnitPositionLoc(u, l) //Set the position of "u" to be "l"
  call TriggerSleepAction(0.01) //And wait 0.01 seconds, athough phyrex1an says this won't work, i dunno.
 endloop
 set l = null //We set "l" to be null (Or nothing), so that we don't have Memory Leaks.
 set u = null //Same with the variable "u". The other variables will clear themselvs automaticly.
endfunction

function DoCallOfEarth takes nothing returns nothing
 //This is the function that is called if a unit casts an ability, and CallOfEarthConds prove true.
 local unit u = GetSpellAbilityUnit() //Here we create a local unit variable named "u", and set it to be the casting unit.
 local location l = GetUnitLoc(u) //This creats a local location variable named "l", and sets it to be the location of "u"
 call TerrainDeformationRippleBJ(3.00, false, l, 150.00, 450.00, 100.00, 1, 30.00) //Call the Blizzard function that creates the Ripple Deformation
 call ForGroupBJ(GetUnitsInRangeOfLocMatching(300.00, l, Condition(function AllyFilter)), function PushUnit) //This will call the function PushUnit, for every unit within 300 of "l", that match the condition "AllyFilter".
endfunction

function InitTrig_Call_Of_Earth takes nothing returns nothing
 //This function is automaticly called by Warcraft, to initialise the function.
 set gg_trg_Call_Of_Earth = CreateTrigger() //This will set the variable "gg_trg_Call_Of_Earth" to be a new Trigger.
 call TriggerRegisterAnyUnitEventBJ(gg_trg_Call_Of_Earth, EVENT_PLAYER_UNIT_SPELL_FINISH) //This line adds the event of a unit casting a spell.
 call TriggerAddCondition(gg_trg_Call_Of_Earth, Condition(function CallOfEarthConds)) //This adds the condition "CallOfEarthConds", wich you can see above.
 call TriggerAddAction(gg_trg_Call_Of_Earth, function DoCallOfEarth) //This line adds the action, wich means that if the event goes off, and the conditions prove true, then it calls the function, "DoCallOfEarth".
endfunction

And just for Yukks, here is the (innoficiant) output of the GUI trigger:
Code:
function Trig_Call_Of_Earth_GUI_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'YourCodeHere' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Call_Of_Earth_GUI_Func002Func001002001 takes nothing returns boolean
    return ( GetOwningPlayer(GetEnumUnit()) == GetOwningPlayer(GetTriggerUnit()) )
endfunction

function Trig_Call_Of_Earth_GUI_Func002Func001002 takes nothing returns nothing
    if ( Trig_Call_Of_Earth_GUI_Func002Func001002001() ) then
        call SetUnitPositionLoc( GetEnumUnit(), PolarProjectionBJ(GetUnitLoc(GetEnumUnit()), 30.00, AngleBetweenPoints(GetUnitLoc(GetEnumUnit()), GetUnitLoc(GetTriggerUnit()))) )
    else
        call DoNothing(  )
    endif
endfunction

function Trig_Call_Of_Earth_GUI_Actions takes nothing returns nothing
    call TerrainDeformationRippleBJ( 3.00, false, GetUnitLoc(GetTriggerUnit()), 150.00, 450.00, 100.00, 1, 30.00 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 12
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call ForGroupBJ( GetUnitsInRangeOfLocAll(300.00, GetUnitLoc(GetTriggerUnit())), function Trig_Call_Of_Earth_GUI_Func002Func001002 )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Call_Of_Earth_GUI takes nothing returns nothing
    set gg_trg_Call_Of_Earth_GUI = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Call_Of_Earth_GUI, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( gg_trg_Call_Of_Earth_GUI, Condition( function Trig_Call_Of_Earth_GUI_Conditions ) )
    call TriggerAddAction( gg_trg_Call_Of_Earth_GUI, function Trig_Call_Of_Earth_GUI_Actions )
endfunction

If you compare it to the un-commented version, then you will see it is the same length, but MUCH less efficiant.

As for Double-Posting, they were two totally different subjects, but yes, i should of done "Edit"
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I think on the new one they did change it, but idk. I don't really care whatever the government is doing right now because it's consistently absurd. Like what is RFK doing in charge of health anything? I love the bear story because WTF was that, but also, pretty much every time he talks it's WTF. Like even his voice sounds microwaved
    +1
  • Varine Varine:
    The pyramid is fucking dumb as shit, no matter how you arrange it.
  • Varine Varine:
    It's actually remarkably easy to make mayonnaise though. Fun fact, it USED to kind of be a French mother sauce. I believe that Careme considered it one, it may have been aioli but that has also built a different meaning than it used to. An aioli is just mayonnaise I mixed with other shit typically, I didn't start it don't come at me
  • Varine Varine:
    It's very hard to do it on a large scale though
  • Varine Varine:
    Depending on how you pour the oil the consistency can vary wildly, but that's true for most emulsions. I can only make about two quarts at a time with my robo coup, and if I have to make several in series because I forgot to order it becomes really obvious even when I do it. We have to wait and mix them all together to make sure we have the same thing.
  • Varine Varine:
    Hollandaise is also kind of like that, emulsions require a very steady hand to do exactly the same every time.
  • Varine Varine:
    Luckily I live in an age with electricity so it's way fucking faster, but when I was just a boy trying to find my place I had some hardcore chefs that made use do things like that by hand. It is WAY easier to get right by hand because you control it and can feel it, but it takes soooooo much longer. And on the scale a modern kitchen requires... I serve 400-500 guests on average per day right now, if I had 100 then we could do things way better
  • Varine Varine:
    But we can't do that. In the winter yeah, but I HAVE to get people through here right now so I can afford the staff that we CAN do that. We have about 100 days of summer, and if that summer doesn't make us what it will, then I can't operate the other most of the year with my staff. The owner is talking about closing two days a week to cut down on labor, I told him he should cut down on vacations and it did not go great. I do think I won though, I have to keep my fucking core staff and they have to be gainfully employed
  • Varine Varine:
    Sure some of them might take a second job, but I can't just cut my entire staff to unlivable hours, nor can I can cut them off all winter if I want them to come back.
  • Varine Varine:
    And also, there is no fucking way I'm pulling these hours come september. I only do this right now because I have to, the second I don't have to be the one doing it I won't be
  • Varine Varine:
    I have a 5 person core staff in the kitchen, not including me or Chef Ben
  • Varine Varine:
    Though two of those people are likely not making it this year. One of them has been replaced, the other I am kind of trying to. He's being a giant bitch, today I had to get onto him because in the three hours before I left he had taken like thirty minutes for cigarette breaks
  • Varine Varine:
    And he was also complaining to me the other day that he was out of weed so couldn't smoke any before work that day, and was confused about why I was annoyed he was telling me, his boss, that he is smoking weed everyday before work.
    +1
  • Varine Varine:
    Like yeah I can tell. I don't need to fucking know.
  • Varine Varine:
    So now he's getting scrutinized and will not be top of the list. I know I don't have the smartest people but I do expect them to have some common fucking sense
  • Varine Varine:
    I did do a rare thing for me and hire a girl last month without warning. Everyone was made at me because I started her at like 21, but she worked with me before and I was like don't care. She made 19 at her old job and I wanted her to come work with me, she is the best
    +1
  • Varine Varine:
    I'm going to get her a raise at the end of the summer. She wants to go to school again, but I want her to still work with me so.... she kind of can just tell me what the price is. I can go to 25 if she keeps up. I need to get her onto line more, that's what she wants, but I need her where she is and it's not fair that she doesn't get the little bit of raise that comes with it. She can do it no problem, I've worked with her there.
  • Varine Varine:
    It's just hard to move and train people unnecessarily right now. And also the line fucking sucks, it's not any more fun. This is turn and burn so I have the bankroll, and everyone suffers for it
  • Varine Varine:
    Eventually we'll get it balanced, we'
  • Varine Varine:
    we're starting online orders and stuff, but I also turn that off all the time because I barely keep up trying to be the best at Sysco shit
  • Varine Varine:
    I think it's gonna be a good fall and winter though. We're going to have a good staff, they will get along, they will be able to manage the workload and the complications, they know how to really cook this year, like every person on line knows their steak temps. Some of them use thermometers a lot and they don't always use them right, but they do know how to do it. Failure, especially in this field, is the only way to get better. They'll get it
  • Varine Varine:
    They won't get feel down while they do the thermometer, but we didn't have an instant read probe when I was learning. Like they did but god knows how off it is, you HAD to do it by feel. Even if the chef was fine with me bringing my own, it takes too long. Poke and know
  • The Helper The Helper:
    420 threads in the Artificial Intelligence forum :)
  • The Helper The Helper:
    Happy Monday!
    +1
  • The Helper The Helper:
    and then it was Tuesday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top