• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] Check this over please.

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I need little help with this. Check it out and see what I did wrong please.
JASS:
function Trig_Pacifier_Copy_Actions takes nothing returns nothing
    local unit cast = GetTriggerUnit()
    local real x = 0
    local real y = 0
    local location p
    local unit dumb
    local integer i = 1
    local integer o = 8
    loop
      exitwhen i>o
      set i = i + 1
      set x = GetUnitX(cast) + 500 * Cos(x + 45.*bj_DEGTORAD)
      set y = GetUnitY(cast) + 500 * Sin(y + 45.*bj_DEGTORAD)
      set p = Location(x,y)
      set dumb = CreateUnit(GetOwningPlayer(cast), 'h008', p, 0.00)
      // ^^^^I get a syntax
      call UnitAddAbility(dumb, 'A01H')
      call IssueTargetOrder(dumb, "chainlightning", cast)
      call UnitApplyTimedLife(dumb, 'BTLF', 10)
      call RemoveLocation(p)
      call TriggerSleepAction(.5)
    endloop
endfunction

Any help is appreciated +rep
 
set dumb = CreateUnit(GetOwningPlayer(cast), 'h008', p, 0.00)


native CreateUnit takes player id, integer unitid, real x, real y, real face returns unit


Meaning it should be like this: set dumb = CreateUnit(GetOwningPlayer(cast), 'h008', x, y, 0.00)

Which means you don't need that location.
 
Here it is almost completely fixed:
JASS:
function Trig_Pacifier_Copy_Actions takes nothing returns nothing
    local unit cast = GetTriggerUnit()
    local real x = 0
    local real y = 0
    local unit dumb
    local integer i = 1
    local integer o = 8
    loop
      exitwhen i>o
      set i = i + 1
      set x = GetUnitX(cast) + 500 * Cos(x + 45.*bj_DEGTORAD)
      set y = GetUnitY(cast) + 500 * Sin(y + 45.*bj_DEGTORAD)
      set dumb = CreateUnit(GetOwningPlayer(cast), 'h008', x, y, 0.)
      call UnitAddAbility(dumb, 'A01H')
      call IssueTargetOrder(dumb, "chainlightning", cast)
      call UnitApplyTimedLife(dumb, 'BTLF', 10)
      call TriggerSleepAction(.5) //Please use something else than TSA.
    endloop
    set dumb = null
    set cast = null
endfunction
Just one question: Why this: "Cos(x + 45.*bj_DEGTORAD)"?
I don't think it will look so good. You're supposed to give it an angle (in radians).
 
To further elaborate, use GetUnitFacing if you want them to go 500 units in front of themselves.

Unless you intended for them to go in a random direction.

Also, dont use * bj_DEGTORAD. Ever. Unless you use GetUnitFacing. It's inefficient and stupid when you can use pi/2, 2pi and such without bothering to times something. You are using 45 degrees here it looks like, so that is actually, in radians, pi/4. Somewhere around .7~.8. Use a calculator.
 
Also, dont use * bj_DEGTORAD. Ever. Unless you use GetUnitFacing. It's inefficient and stupid when you can use pi/2, 2pi and such without bothering to times something.
Actually, it's not that inefficient. Of course, it's better not to use it, but it's still not that bad.

You are using 45 degrees here it looks like, so that is actually, in radians, pi/4. Somewhere around .7~.8. Use a calculator.
It's 0.78539816339744830961566084569875... :D
 
Also, dont use * bj_DEGTORAD. Ever. Unless you use GetUnitFacing. It's inefficient and stupid when you can use pi/2, 2pi and such without bothering to times something. You are using 45 degrees here it looks like, so that is actually, in radians, pi/4. Somewhere around .7~.8. Use a calculator.
Uh, 45*bj_DEGTORAD is not really any different than bj_PI/4 (although the latter looks prettier), and writing .78540 or something is just ugly and unreadable.
 
Here it is almost completely fixed:
JASS:
function Trig_Pacifier_Copy_Actions takes nothing returns nothing
    local unit cast = GetTriggerUnit()
    local real x = 0
    local real y = 0
    local unit dumb
    local integer i = 0
    local integer o = 8
    loop
      exitwhen i>o
      set i = i + 1
      set x = GetUnitX(cast) + 500 * Cos(x + 45.*bj_DEGTORAD)
      set y = GetUnitY(cast) + 500 * Sin(y + 45.*bj_DEGTORAD)
      set dumb = CreateUnit(GetOwningPlayer(cast), 'h008', x, y, 0.)
      call UnitAddAbility(dumb, 'A01H')
      call IssueTargetOrder(dumb, "chainlightning", cast)
      call UnitApplyTimedLife(dumb, 'BTLF', 10)
      call TriggerSleepAction(.5) //Please use something else than TSA.
    endloop
    set dumb = null
    set cast = null
endfunction
Just one question: Why this: "Cos(x + 45.*bj_DEGTORAD)"?
I don't think it will look so good. You're supposed to give it an angle (in radians).

I did this because I wanted the dummy to spawn 45 degrees farther around the caster (like a circle) (45 * 8 = 360) I had asked for help on this earlier, and the person that responded told me it was most efficient to do it this way :xxd: As for the TSA, I needed it to be a half a second behind to look like a wave effect. This is the only way I know how to do this.
 
Okay, why don't you explain to me in detail what you want this code to do, and I'll help you out. You never actually stated what was supposed to happen, you just stated there was a syntax error. The syntax error has been fixed, so what else do you need help with?
 
I did this because I wanted the dummy to spawn 45 degrees farther around the caster (like a circle) (45 * 8 = 360) I had asked for help on this earlier, and the person that responded told me it was most efficient to do it this way :xxd: As for the TSA, I needed it to be a half a second behind to look like a wave effect. This is the only way I know how to do this.

Then why are you using x + 45 and y + 45. Should be i * 45 if that is what you want to accomplish.
 
Status
Not open for further replies.
Back
Top