• 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.

[Trigger] I r angreh!

Status
Not open for further replies.
Level 12
Joined
Jan 6, 2009
Messages
848
I'm getting really ANGREH! at this trigger, as everytime i try to test this spell trigger, it causes a fatal error, and closes wc3. Could someone experienced please tell me why this bugs?
  • Blink Burst
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink Burst
    • Actions
      • Custom script: local real udg_Distance2
      • Custom script: local real udg_Angle
      • Custom script: local integer udg_Distance
      • Custom script: local location udg_Point
      • Set Point = (Target point of ability being cast)
      • Set Angle = (Angle from (Position of (Triggering unit)) to Point)
      • Set Distance2 = (Distance between (Position of (Triggering unit)) and Point)
      • Set Distance = (Integer((Distance2 / 100.00)))
      • For each (Integer A) from 1 to Distance, do (Actions)
        • Loop - Actions
          • Set Distance2 = (Distance2 + 100.00)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at ((Position of (Triggering unit)) offset by Distance2 towards Angle degrees) facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Flame Strike (Neutral Hostile) to (Last created unit)
          • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike (Position of (Last created unit))
      • Custom script: set udg_Point = null
WELL!?
 
Level 9
Joined
Feb 14, 2009
Messages
316
Have you tried writing it totally in JASS? Declaring udg_ prefixed variables may not be a good idea, especially (as I suspect) if you pre-define already declared ones as 'local', this is a very probable reason for the error (trying to reach a NULL pointer or a conflict between memory fields).
 
Level 7
Joined
Oct 14, 2008
Messages
340
Well that's kind of a HUUGE question.

If you'd rather not do some learning...
Just convert your trigger to custom text and paste this:
JASS:
function AbilCode takes nothing returns integer
    //Change "abcd" to your ability's rawcode.
    return 'abcd'
endfunction

function DummyId takes nothing returns integer
    //Change "efgh" to your dummy unit's rawcode.
    return 'efgh'
endfunction

function DumAbil takes nothing returns integer
    //Change "ijkl" to the rawcode for the flamestrike ability your dummy uses.
    return 'ijkl'
endfunction

function BlinkBurstConditions takes nothing returns boolean
    return GetSpellAbilityId() == AbilCode()
endfunction

function BlinkBurstActions takes nothing returns nothing
    local location target = GetSpellTargetLoc()
    local unit caster = GetTriggerUnit()
    local unit dummy
    local real casterX = GetUnitX(caster)
    local real casterY = GetUnitY(caster)
    local real targX = GetLocationX(target)
    local real targY = GetLocationY(target)
    local real angle = bj_RADTODEG*Atan2(targY-casterY, targX-casterX)
    local real dx = targX-casterX
    local real dy = targY-casterY
    local real d2 = SquareRoot(dx * dx + dy * dy)
    local integer d = R2I(d2/100.)
    local integer i = 0
    loop
        exitwhen i == d
        set d2 = d2+100
        set dx = casterX+ d2*Cos(angle*bj_DEGTORAD)
        set dy = casterY+ d2*Sin(angle*bj_DEGTORAD)
        set dummy = CreateUnit(GetOwningPlayer(caster), DummyId(), dx, dy, 270.)
        call UnitApplyTimedLife(dummy, 'B01T', 2.)
        call UnitAddAbility(dummy, DumAbil())
        call IssuePointOrder(dummy, "flamestrike", dx, dy)
        set i = i+1
    endloop
    call RemoveLocation(target)
    set target = null
    set caster = null
    set dummy = null
endfunction

//===========================================================================
function InitTrig_Blink_Burst takes nothing returns nothing
    set gg_trg_Blink_Burst = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Blink_Burst, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Blink_Burst, Condition(function BlinkBurstConditions))
    call TriggerAddAction(gg_trg_Blink_Burst, function BlinkBurstActions)
endfunction

This does exactly what your trigger would do if it worked properly.. Remember to follow the instructions toward the top of the code, in comments(green text)
 
Last edited:
Level 7
Joined
Oct 14, 2008
Messages
340
well his loop was based on an integer that divided up the distance between the caster and target point:

  • For each (Integer A) from 1 to Distance, do (Actions)
    • Loop - Actions
      • Set Distance2 = (Distance2 + 100.00)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at ((Position of (Triggering unit)) offset by Distance2 towards Angle degrees) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Flame Strike (Neutral Hostile) to (Last created unit)
      • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike (Position of (Last created unit))
and that's basically what that is.
OH pfft... fixing that, shoulda initially been set to 0, I've been up all night, thanks for noticing that lol.
 
Status
Not open for further replies.
Top