• 🏆 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!

JASS to GUI

Status
Not open for further replies.
Level 3
Joined
Nov 12, 2019
Messages
11
I'm just wondering that how exactly JASS code can be converted to GUI triggers is there such a possibility or does it have to be done manually?)

When I wanted to copy the required JASS code and insert it into the desired card, I wanted to check it, but it crashes and even most likely a fatal error comes out.
In general, help and write me in detail on the item, thanks in advance )
 
Level 3
Joined
Nov 12, 2019
Messages
11
As far as I know you can only convert GUI to Jass, not the other way around. If you post the code and tell us what the error is we can probably help you fix it.
JASS:
function Trig_Firebolt_Split_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction
function Fire takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit c=GetAttachedUnit(t,"c")
local unit b=GetAttachedUnit(t,"b")
local real a=AngleBetweenPoints(GetUnitLoc(c),GetUnitLoc(b))

    call SetUnitPositionLocFacingBJ(c,PolarProjectionBJ(GetUnitLoc(c),8,a),a)
    set b=null
    set c=null
endfunction
function killC takes nothing returns nothing
local timer k=GetExpiredTimer()
local unit c=GetAttachedUnit(k,"c")
    call KillUnit(c)
    set c=null
    call CleanAttachedVars(k)
    call DestroyTimer(k)
endfunction
function Trig_Firebolt_Split_Actions takes nothing returns nothing
local unit u=GetSpellAbilityUnit()
local unit b=GetSpellTargetUnit()
local unit c=CreateUnitAtLoc(GetOwningPlayer(u),'h002',PolarProjectionBJ(GetUnitLoc(u),40,GetUnitFacing(u)),GetUnitFacing(u))
local real d=70+(GetUnitAbilityLevelSwapped('A000',u)*50)
local real sd=40+(GetUnitAbilityLevelSwapped('A000',u)*50)
local timer t=CreateTimer()
local group g=CreateGroup()
local unit n
local unit re
local timer k=CreateTimer()

    call AttachObject(t,"c",c)
    call AttachObject(t,"b",b)
    call TimerStart(t,0.02,true,function Fire)
   
    loop
        exitwhen IsUnitInRange(c,b,20)
        call TriggerSleepAction(0)
    endloop
    call AttachObject(k,"c",c)
    call TimerStart(k,0.4,false,function killC)
    call DestroyTimer(t)
    call CleanAttachedVars(t)
    call UnitDamageTargetBJ(u,b,d,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_FIRE)
    set g=GetUnitsInRangeOfLocAll(700,GetUnitLoc(b))
    loop
        set n=FirstOfGroup(g)
        exitwhen n==null
        if IsUnitAliveBJ(n) and IsUnitEnemy(n,GetOwningPlayer(u)) and n!=b then
            set re=CreateUnitAtLoc(GetOwningPlayer(u),'h001',GetUnitLoc(b),bj_UNIT_FACING)
            call SetUnitAbilityLevelSwapped('A001',re,GetUnitAbilityLevelSwapped('A000',u))
            call IssueTargetOrderBJ(re,"firebolt",n)
            call UnitApplyTimedLifeBJ(0.5,'BTLF',re)
        endif
        call GroupRemoveUnit(g,n)
    endloop
    call DestroyGroup(g)
    set n=null
    set u=null
    set c=null
    set g=null
    set re=null
    set t=null

endfunction

//===========================================================================
function InitTrig_Firebolt_Split takes nothing returns nothing
    set gg_trg_Firebolt_Split = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Firebolt_Split, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Firebolt_Split, Condition( function Trig_Firebolt_Split_Conditions ) )
    call TriggerAddAction( gg_trg_Firebolt_Split, function Trig_Firebolt_Split_Actions )
endfunction


Here is a sample)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
And what is the error that you're getting?

This looks like it uses some kind of Timer library so you're probably missing that.

Also, you want to edit this text:
vJASS:
return GetSpellAbilityId() == 'A000'
'A000' should be the rawcode of your desired ability. You can get this information in the Object Editor by pressing Control + D.
 
Last edited:
Status
Not open for further replies.
Top