• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Convert to JASS

Status
Not open for further replies.
Level 4
Joined
Jul 16, 2009
Messages
42
can someone help me check for leak int his script and convert it to JASS. +rep and credit in my map :)

hardtrig.jpg

JASS:
function Trig_abilityFreezingField_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00A' ) ) then
        return false
    endif
    return true
endfunction

function Trig_abilityFreezingField_Actions takes nothing returns nothing
    set udg_casterFreezingFeild = GetSpellAbilityUnit()
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 2
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(udg_casterFreezingFeild), PolarProjectionBJ(GetUnitLoc(udg_casterFreezingFeild), 300.00, ( 0.00 + ( 180.00 * I2R(GetForLoopIndexA()) ) )), bj_UNIT_FACING )
        call SetUnitUserData( GetLastCreatedUnit(), R2I(AngleBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit()))) )
        call SetUnitLifeBJ( GetLastCreatedUnit(), DistanceBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit())) )
        call UnitAddAbilityBJ( udg_abilityFreezingFeildLvl[GetUnitAbilityLevelSwapped('A00A', udg_casterFreezingFeild)], GetLastCreatedUnit() )
        call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 10.00, 1000000000.00 )
        call UnitApplyTimedLifeBJ( 30.00, 'BTLF', GetLastCreatedUnit() )
        call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(udg_casterFreezingFeild), PolarProjectionBJ(GetUnitLoc(udg_casterFreezingFeild), 290.00, ( 60.00 + ( 180.00 * I2R(GetForLoopIndexA()) ) )), bj_UNIT_FACING )
        call SetUnitUserData( GetLastCreatedUnit(), R2I(AngleBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit()))) )
        call SetUnitLifeBJ( GetLastCreatedUnit(), DistanceBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit())) )
        call UnitAddAbilityBJ( udg_abilityFreezingFeildLvl[GetUnitAbilityLevelSwapped('A00A', udg_casterFreezingFeild)], GetLastCreatedUnit() )
        call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 88.00, 1000000000.00 )
        call UnitApplyTimedLifeBJ( 30.00, 'BTLF', GetLastCreatedUnit() )
        call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(udg_casterFreezingFeild), PolarProjectionBJ(GetUnitLoc(udg_casterFreezingFeild), 260.00, ( 120.00 + ( 180.00 * I2R(GetForLoopIndexA()) ) )), bj_UNIT_FACING )
        call SetUnitUserData( GetLastCreatedUnit(), R2I(AngleBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit()))) )
        call SetUnitLifeBJ( GetLastCreatedUnit(), DistanceBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit())) )
        call UnitAddAbilityBJ( udg_abilityFreezingFeildLvl[GetUnitAbilityLevelSwapped('A00A', udg_casterFreezingFeild)], GetLastCreatedUnit() )
        call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 160.00, 1000000000.00 )
        call UnitApplyTimedLifeBJ( 30.00, 'BTLF', GetLastCreatedUnit() )
        call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(udg_casterFreezingFeild), PolarProjectionBJ(GetUnitLoc(udg_casterFreezingFeild), 212.00, ( 180.00 + ( 180.00 * I2R(GetForLoopIndexA()) ) )), bj_UNIT_FACING )
        call SetUnitUserData( GetLastCreatedUnit(), R2I(AngleBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit()))) )
        call SetUnitLifeBJ( GetLastCreatedUnit(), DistanceBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit())) )
        call UnitAddAbilityBJ( udg_abilityFreezingFeildLvl[GetUnitAbilityLevelSwapped('A00A', udg_casterFreezingFeild)], GetLastCreatedUnit() )
        call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 222.00, 1000000000.00 )
        call UnitApplyTimedLifeBJ( 30.00, 'BTLF', GetLastCreatedUnit() )
        call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(udg_casterFreezingFeild), PolarProjectionBJ(GetUnitLoc(udg_casterFreezingFeild), 150.00, ( 240.00 + ( 180.00 * I2R(GetForLoopIndexA()) ) )), bj_UNIT_FACING )
        call SetUnitUserData( GetLastCreatedUnit(), R2I(AngleBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit()))) )
        call UnitAddAbilityBJ( udg_abilityFreezingFeildLvl[GetUnitAbilityLevelSwapped('A00A', udg_casterFreezingFeild)], GetLastCreatedUnit() )
        call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 270.00, 1000000000.00 )
        call SetUnitLifeBJ( GetLastCreatedUnit(), DistanceBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit())) )
        call UnitApplyTimedLifeBJ( 30.00, 'BTLF', GetLastCreatedUnit() )
        call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(udg_casterFreezingFeild), PolarProjectionBJ(GetUnitLoc(udg_casterFreezingFeild), 77.00, ( 300.00 + ( 180.00 * I2R(GetForLoopIndexA()) ) )), bj_UNIT_FACING )
        call SetUnitUserData( GetLastCreatedUnit(), R2I(AngleBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit()))) )
        call SetUnitLifeBJ( GetLastCreatedUnit(), DistanceBetweenPoints(GetUnitLoc(udg_casterFreezingFeild), GetUnitLoc(GetLastCreatedUnit())) )
        call UnitAddAbilityBJ( udg_abilityFreezingFeildLvl[GetUnitAbilityLevelSwapped('A00A', udg_casterFreezingFeild)], GetLastCreatedUnit() )
        call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 300.00, 1000000000.00 )
        call UnitApplyTimedLifeBJ( 30.00, 'BTLF', GetLastCreatedUnit() )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_abilityFreezingField takes nothing returns nothing
    set gg_trg_abilityFreezingField = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_abilityFreezingField, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_abilityFreezingField, Condition( function Trig_abilityFreezingField_Conditions ) )
    call TriggerAddAction( gg_trg_abilityFreezingField, function Trig_abilityFreezingField_Actions )
endfunction
 
Last edited:
Level 3
Joined
May 18, 2008
Messages
28
CreateNUnitsAtLoc
UnitApplyTimedLifeBJ
UnitAddAbilityBJ
SetUnitLifeBJ
SetUnitFlyHeightBJ

you got alot of BJ's to fix i suggest downloding a jass text editor or newgen wichs will help you for that matter, also there are location leaks and you could use locals for it,

local location temp = Location((locX),(locY))

local's has to be declared at the top of the function they are used in.. sorry i don't got time for a better description and i think you should learn how to do it urself or atleast try ;)
 
Status
Not open for further replies.
Top