IKilledKEnny's JASS Question Theard, I love to give +REP :)

Status
Not open for further replies.
I

IKilledKEnny

Guest
Current Questions

Code:
function CreateBarrelDGCon takes nothing returns boolean
return GetDestructableTypeId(GetEnumDestructable())=='LTex'))
endfunction

function CreateBarrelGDAct takes nothing returns nothing
local integer i=0
if (CreateBarrelDGCon()) then
set i=1
endif
if i==0 then
call CreateDestructable(LTex,GetRectCenterX(gg_rct_Barrle_Region),GetRectCenterX(gg_rct_Barrle_Region),0,1,1)
endif
endfunction

function CreateBarrelAct takes nothing returns nothing
call EnumDestructablesInRectAll(gg_rct_Barrle_Region,function CreateBarrelGDAct)
endfunction

//===========================================================================
function InitTrig_Create_Barrel takes nothing returns nothing
set gg_trg_Create_Barrel = CreateTrigger(  )
call TriggerRegisterTimerEventPeriodic( gg_trg_Create_Barrel, 5.00 )
call TriggerAddAction(gg_trg_Create_Barrel, function CreateBarrelAct)
endfunction

Yes another question, I don't understand why it crushes WE.
 

Corleone

New Member
Reaction score
44
1) You made a few typo's.
Code:
function Trig_Ground_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A001' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Ground_Actions takes nothing returns nothing
    local unit cast
    local unit cast2
    local location GP1
    local location GP2
    local group GUG
    local integer GI
    local unit dummy
    set cast = GetSpellAbilityUnit ()
    set GI = (GetUnitAbilityLevelSwapped('A001', cast))
    set GP1 = GetUnitLoc(cast)
    set GUG = GetUnitsInRangeOfLocAll(I2R(GI) * 300, GP1)
    loop
          set cast2 = FirstOfGroup(GUG)
          exitwhen ( cast2 == null)
          set GP2 = GetUnitLoc(cast2) 
          call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), GP2, bj_UNIT_FACING  )
          set dummy = GetLastCreatedUnit()
          call UnitAddAbilityBJ( 'A001', GetTriggerUnit() )
          if ( GetUnitTypeId(cast) == 'H000' ) then
             call SetUnitAbilityLevelSwapped( 'A001', dummy, GI )
          else
             call SetUnitAbilityLevelSwapped( 'A001', dummy, GI - 1 )
          endif
          if ( GetUnitAbilityLevelSwapped('A001', cast2) >= 1 ) then
          call IssueImmediateOrderBJ( cast2, "stomp" )
          call UnitApplyTimedLifeBJ( 1.00, 'BTLF', cast2)
          endif
    endloop
    set cast2 = null
    set cast = null
    set GP1 = null
    set GP2 = null
    set GUG = null
    set GI = 0
    set dummy = null                   
endfunction

//===========================================================================
function InitTrig_Ground takes nothing returns nothing
    set gg_trg_Ground = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ground, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Ground, Condition( function Trig_Ground_Conditions ) )
    call TriggerAddAction( gg_trg_Ground, function Trig_Ground_Actions )
endfunction
 
I

IKilledKEnny

Guest
Is there any chance you could bold changed lines? By the way I forgot to say what lines don't work and why in ground:

Code:
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), GP2), bj_UNIT_FACING  )

expected end of line...

Code:
setGI = 0

Expected end if...
 

Corleone

New Member
Reaction score
44
Is there any chance you could bold changed lines? By the way I forgot to say what lines don't work and why in ground:

Code:
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), GP2), bj_UNIT_FACING  )

expected end of line...

Code:
setGI = 0

Expected end if...

Those were the two I changed.

Code:
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), [B]GP2),[/B] bj_UNIT_FACING  )

You added a ) too much.

Code:
setGI = 0

You forgot a space

Code:
set GI = 0
 
I

IKilledKEnny

Guest
Thanks for GI thing :) Still same problem with the other line. :(
 

Corleone

New Member
Reaction score
44
Thanks for GI thing :) Still same problem with the other line. :(

Your version
Code:
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), [B]GP2), [/B]bj_UNIT_FACING  )

My version
Code:
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast),[B] GP2,[/B] bj_UNIT_FACING  )

Noticed the difference? I enabled the trigger and it didn't show up any errors.
 
I

IKilledKEnny

Guest
Hah! Thanks! Now let's see if it actaully works. :) Anyidea why does the Air Trigger doesn't work? I have worked on it for like 2-3 days on it (I think).
 
I

IKilledKEnny

Guest
Alright, about Ground Trigger, how do I make it that it doesn't count GS Dummys?

EDIT:
Ok it doesn't work, here is the Trigger:

Code:
function Trig_Ground_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A001' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Ground_Actions takes nothing returns nothing
    local unit cast
    local unit cast2
    local location GP1
    local location GP2
    local group GUG
    local integer GI
    local unit dummy
    set cast = GetSpellAbilityUnit ()
    set GI = (GetUnitAbilityLevelSwapped('A001', cast))
    set GP1 = GetUnitLoc(cast)
    set GUG = GetUnitsInRangeOfLocAll(I2R(GI) * 300, GP1)
    loop
          set cast2 = FirstOfGroup(GUG)
          exitwhen ( cast2 == null)
          if (GetUnitTypeId(cast2) != 'h001')then
             set GP2 = GetUnitLoc(cast2) 
             call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), GP2, bj_UNIT_FACING  )
             set dummy = GetLastCreatedUnit()
             call UnitAddAbilityBJ( 'A001', GetTriggerUnit() )
             if ( GetUnitTypeId(cast) == 'H000' ) then
                call SetUnitAbilityLevelSwapped( 'A001', dummy, GI )
             else
                call SetUnitAbilityLevelSwapped( 'A001', dummy, GI - 1 )
             endif
             if ( GetUnitAbilityLevelSwapped('A001', cast2) >= 1 ) then
                call IssueImmediateOrderBJ( dummy, "stomp" )
                call UnitApplyTimedLifeBJ( 1.00, 'BTLF', dummy)
             else
                call UnitApplyTimedLifeBJ( 1.00, 'BTLF', dummy)
             endif
          endif
    endloop
    set cast2 = null
    set cast = null
    set GP1 = null
    set GP2 = null
    set GUG = null
    set GI = 0
    set dummy = null                   
endfunction

//===========================================================================
function InitTrig_Ground takes nothing returns nothing
    set gg_trg_Ground = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ground, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Ground, Condition( function Trig_Ground_Conditions ) )
    call TriggerAddAction( gg_trg_Ground, function Trig_Ground_Actions )
endfunction
 

Corleone

New Member
Reaction score
44
Air trigger:
Code:
function Trig_Move_Copy_Actions takes nothing returns nothing
    local location AP1
    local location AP2
    local unit cast
    set cast = GetTriggerUnit()
    set AP1 = GetSpellTargetLoc()
    set AP2 = GetUnitLoc(cast)
    call SetUnitInvulnerable( cast, true )
    call SetUnitPathing( cast, false )
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), AP1, bj_UNIT_FACING )
    call SetUnitVertexColorBJ( cast, 75.00, 75.00, 75.00, 65.00 )
    call IssuePointOrderLocBJ( cast, "move", AP1 )
    call TriggerSleepAction( ( DistanceBetweenPoints(AP1, AP2) / GetUnitMoveSpeed(cast) ) )
    call SetUnitInvulnerable( cast, false )
    call SetUnitPathing( cast, true )
    call SetUnitVertexColorBJ( cast, 100.00, 100, 100, 0 )
    set AP1 = null
    set AP2 = null
    set cast = null
endfunction

It works fine for me ( tested it with an Archmage, casting Blizzard ). Maybe it's because you ordered the unit to move to AP1 twice?

EDIT: Mind telling me which part of the Ground trigger doesn't work?
 
I

IKilledKEnny

Guest
I copied & pasted your Trigger, my unit still won't move (my spell is based on channel)

(

Code:
function Trig_Air_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Air_Actions takes nothing returns nothing
    local location AP1
    local location AP2
    local unit cast
    set cast = GetTriggerUnit()
    set AP1 = GetSpellTargetLoc()
    set AP2 = GetUnitLoc(cast)
    call SetUnitInvulnerable( cast, true )
    call SetUnitPathing( cast, false )
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), AP1, bj_UNIT_FACING )
    call SetUnitVertexColorBJ( cast, 75.00, 75.00, 75.00, 65.00 )
    call IssuePointOrderLocBJ( cast, "move", AP1 )
    call TriggerSleepAction( ( DistanceBetweenPoints(AP1, AP2) / GetUnitMoveSpeed(cast) ) )
    call SetUnitInvulnerable( cast, false )
    call SetUnitPathing( cast, true )
    call SetUnitVertexColorBJ( cast, 100.00, 100, 100, 0 )
    set AP1 = null
    set AP2 = null
    set cast = null
endfunction

//===========================================================================
function InitTrig_Air takes nothing returns nothing
    set gg_trg_Air = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Air, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Air, Condition( function Trig_Air_Conditions ) )
    call TriggerAddAction( gg_trg_Air, function Trig_Air_Actions )
endfunction

)

It won't recast shock. what I mean it should cast shock and then all units that are affected by it should cast it but they don't! Hope you can understand my English. Thanks SO MUCH for your help.

Edit: It also lags badly, any chance to fix that?
 
I

IKilledKEnny

Guest
Yes, point target.

Edit:

Based it on another ability and it worked perfectly. Thanks so much, as soon as I can I'll give you +REP!!! Do you know why won't Ground Trigger work?
 
I

IKilledKEnny

Guest
What it supposes to do is once you have casted the spell make all units arond the cast cast again the spell, once they have cased the spell, the guys will cast it, but at 1 rank less and so on, until it reaches rank 0.
 

Corleone

New Member
Reaction score
44
What it supposes to do is once you have casted the spell make all units arond the cast cast again the spell, once they have cased the spell, the guys will cast it, but at 1 rank less and so on, until it reaches rank 0.

Woah, lol. Right, I'll look into it.
 

Master

Thou shall be helped by...The Black Adder!
Reaction score
72
What it supposes to do is once you have casted the spell make all units around the cast cast again the spell, once they have casted the spell, the guys will cast it, but at 1 rank less and so on, until it reaches rank 0.
grammar :)
Woah, lol. Right, I'll look into it.

Um, you don't know JASS?


IKilledKenny, do you happen to have JassCraft? what errors do you get if so?
 

Corleone

New Member
Reaction score
44
Um, you don't know JASS?

I only just started learning it, so no, I can't say I really know JASS.

Anyway, I tried to remake the trigger, and when I thought I had it, it turned out to have some really complicated endless loop, which made the map crash before I could save my progress.
 
I

IKilledKEnny

Guest
Sorry I wasn't by a computer, and now I'm by one that doesn't got WE not JASSCraft. Yes I know it, but didn't check I'll get back to my home only in like 16 hours. I don't think there is problem with the script, it simply doesn't do what I need it to do, like a GUI Trigger.

Thanks for any help!!
 

Sooda

Diversity enchants
Reaction score
318
>1. The following Trigger can't be enabled, why?
Try to give as exact error messages as you get or what dosn' t work. Type all (or some of what you can.) out of error list. World Editor syntax check can creat you 100 times more errors by just having somewhere one wrong letter typed.
>Will it work once I enabled it?
Everything what dosn' t give syntax check errors works (Still you need to check yourself that all variables and their values are set before use in a "call".)
Code:
function Trig_Ground_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A001' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Ground_Actions takes nothing returns nothing
    local unit cast
    local unit cast2
    local location GP1
    local location GP2
    local group GUG
    local integer GI
    local unit dummy
    set cast = GetSpellAbilityUnit ()
    set GI = (GetUnitAbilityLevelSwapped('A001', cast))
    set GP1 = GetUnitLoc(cast)
    set GUG = GetUnitsInRangeOfLocAll(I2R(GI) * 300, GP1)
    loop
          set cast2 = FirstOfGroup(GUG)
          exitwhen ( cast2 == null)
          set GP2 = GetUnitLoc(cast2) 
          call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), GP2), bj_UNIT_FACING  )
          set dummy = GetLastCreatedUnit()
          call UnitAddAbilityBJ( 'A001', GetTriggerUnit() )
          if ( GetUnitTypeId(cast) == 'H000' ) then
             call SetUnitAbilityLevelSwapped( 'A001', dummy, GI )
          else
             call SetUnitAbilityLevelSwapped( 'A001', dummy, GI - 1 )
          endif
          if ( GetUnitAbilityLevelSwapped('A001', cast2) >= 1 ) then
          call IssueImmediateOrderBJ( cast2, "stomp" )
          call UnitApplyTimedLifeBJ( 1.00, 'BTLF', cast2)
          endif
    endloop
    set cast2 = null
    set cast = null
    set GP1 = null
    set GP2 = null
    set GUG = null
    setGI = null
    set dummy = null                   
endfunction

//===========================================================================
function InitTrig_Ground takes nothing returns nothing
    set gg_trg_Ground = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ground, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Ground, Condition( function Trig_Ground_Conditions ) )
    call TriggerAddAction( gg_trg_Ground, function Trig_Ground_Actions )
endfunction


Code:
    local unit cast
Looks like a unit variable what asumes it can store units only.
Code:
    set cast = GetSpellAbilityUnit()
Hm... what action is that in GUI ? Unit who started the effect of ability or just a ability level action ? Try with "GetTriggerUnit()"
Dummy unit should get ability ?
Code:
          call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(cast), GP2), [B]0[/B]  )
          set dummy = GetLastCreatedUnit()
          call UnitAddAbilityBJ( 'A001', [B]dummy[/B] )
About If/ Then/ Else I don' t know haven' t learned to use it so far. I suggest to cut that part and only use issue ordr to see if it works like that then you know what creates problems.
 
I

IKilledKEnny

Guest
I added a questin (What is BJ?), Ground still doesn't work! Why?
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top