Help with first real vjass attempt

Kenny

Back for now.
Reaction score
202
You should look into changing all those BJ's into their natives also.
I could probably help you with some of that, if you want.

Holy crap!! They are all BJ's... i didnt even notice. You should certaintly fix that.
 
Reaction score
341
Yes.

Hold control and move your mouse over the BJ, click it.

It will have the equivalent functions made up to make the BJ.
 

BRUTAL

I'm working
Reaction score
118
Yes.

Hold control and move your mouse over the BJ, click it.

It will have the equivalent functions made up to make the BJ.

alright, i dont understand what i see though, example:
JASS:
call UnitAddAbilityBJ( 'A002', GetLastCreatedUnit() )


JASS:
function UnitAddAbilityBJ takes integer abilityId, unit whichUnit returns boolean
    return UnitAddAbility(whichUnit, abilityId)
endfunction


would the 3 lined function be native :p

and heres my code so far
JASS:
scope IceTrap initializer Init

//   ________________________________________
// ||                                        ||
// || Modify below                           ||
// ||________________________________________||

globals
    private constant integer Spellid = 'A001'      // Raw code of Ice Trap ability
    private constant integer Dummyid = 'h007'     // Raw code of Ice Trap ability
    private constant real MaxUnits   = 360       // Number of units made to complete the circle, 1 unit = 10
    private constant real AOE        = 290      //Base AOE of spell, each level AOE gets bigger
endglobals
  
//   ________________________________________
// ||                                        ||
// || Do not modify                          ||
// ||________________________________________||

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Spellid
endfunction

function Actions takes nothing returns nothing
    local unit ITCaster = GetSpellAbilityUnit()
    local real ITDuration = (6 + (3 * I2R(GetUnitAbilityLevelSwapped('A001', ITCaster))))
    local location ITTargetPoint = GetSpellTargetLoc()
    local real ITTimer = 0
    local real ITAngle = ( GetUnitFacing(ITCaster) + 140.00 )    
    local location ITTargetPos = PolarProjectionBJ(ITTargetPoint, ( AOE + ( I2R(GetUnitAbilityLevelSwapped('A001', ITCaster)) * 20.00 ) ), ITAngle)
    local rect ITCreateRect = RectFromCenterSizeBJ(ITTargetPoint, 100.00, 100.00)
    call SetUnitFacingToFaceLocTimed( ITCaster, ITTargetPoint, 0 )
    call AddWeatherEffectSaveLast( ITCreateRect, 'SNls' )
    call EnableWeatherEffect( GetLastCreatedWeatherEffect(), true )
    call RemoveRect ( ITCreateRect )
    loop
        exitwhen ITTimer == MaxUnits
            set ITTimer = (ITTimer + 10)
            set ITTargetPos = PolarProjectionBJ(ITTargetPoint, ( AOE + ( I2R(GetUnitAbilityLevelSwapped('A001', ITCaster)) * 20.00 ) ), (ITAngle + ITTimer ))
            call CreateNUnitsAtLocFacingLocBJ( 1, Dummyid, GetOwningPlayer(ITCaster), ITTargetPos, ITTargetPoint )
            call UnitAddAbilityBJ( 'A002', GetLastCreatedUnit() )
            call SetUnitAbilityLevelSwapped( 'A002', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A001', ITCaster) )
            call IssueImmediateOrderBJ( GetLastCreatedUnit(), "immolation" )
            call UnitApplyTimedLifeBJ( ( ITDuration), 'BTLF', GetLastCreatedUnit() )
            call SetTerrainPathableBJ( ITTargetPos, PATHING_TYPE_WALKABILITY, false )
            call RemoveLocation (ITTargetPos) 
            call TriggerSleepAction(0.01)
        endloop
    call RemoveLocation (ITTargetPoint)   
    set ITCaster = null
endfunction


//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction

endscope
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Here you go:
JASS:
scope IceTrap initializer Init

//   ________________________________________
// ||                                        ||
// || Modify below                           ||
// ||________________________________________||

globals
    private constant integer Spellid = 'A001'      // Raw code of Ice Trap ability
    private constant integer Dummyid = 'h007'     // Raw code of Ice Trap ability
    private constant real MaxUnits   = 360       // Number of units made to complete the circle, 1 unit = 10
    private constant real AOE        = 290      //Base AOE of spell, each level AOE gets bigger
endglobals
  
//   ________________________________________
// ||                                        ||
// || Do not modify                          ||
// ||________________________________________||

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Spellid
endfunction

function Actions takes nothing returns nothing
    local unit ITCaster = GetSpellAbilityUnit()
    //local real ITDuration = (6 + (3 * I2R(GetUnitAbilityLevelSwapped('A001', ITCaster))))
    local real ITDuration = (6 + (3 * I2R(GetUnitAbilityLevel(ITCaster, Spellid))))
    local location ITTargetPoint = GetSpellTargetLoc()
    local real ITTimer = 0
    local real ITAngle = ( GetUnitFacing(ITCaster) + 140.00 )    
    //local location ITTargetPos = PolarProjectionBJ(ITTargetPoint, ( AOE + ( I2R(GetUnitAbilityLevelSwapped('A001', ITCaster)) * 20.00 ) ), ITAngle)
    local location ITTargetPos = PolarProjectionBJ(ITTargetPoint, (AOE + (I2R(GetUnitAbilityLevel(ITCaster, Spellid)) * 20.00)), ITAngle)
    local rect ITCreateRect = RectFromCenterSizeBJ(ITTargetPoint, 100.00, 100.00)
    // I don't know how to fix Rect BJ's, sorry.
    call SetUnitFacingToFaceLocTimed( ITCaster, ITTargetPoint, 0 )
    // Don't know how to fix above one either, sorry :| .
    call AddWeatherEffectSaveLast( ITCreateRect, 'SNls' )
    // This one either, god I suck...
    //call EnableWeatherEffect( GetLastCreatedWeatherEffect(), true )
    call EnableWeatherEffect(bj_lastCreatedWeatherEffect, true)
    call RemoveRect ( ITCreateRect )
    loop
        exitwhen ITTimer == MaxUnits
            set ITTimer = (ITTimer + 10)
            //set ITTargetPos = PolarProjectionBJ(ITTargetPoint, ( AOE + ( I2R(GetUnitAbilityLevelSwapped('A001', ITCaster)) * 20.00 ) ), (ITAngle + ITTimer ))
            set ITTargetPos = PolarProjectionBJ(ITTargetPoint, (AOE + (I2R(GetUnitAbilityLevel(ITCaster, Spellid)) * 20.00)), (ITAngle + ITTimer))
            call CreateNUnitsAtLocFacingLocBJ( 1, Dummyid, GetOwningPlayer(ITCaster), ITTargetPos, ITTargetPoint )
            // Can't remember how to fix Create units...
            //call UnitAddAbilityBJ( 'A002', GetLastCreatedUnit() )
            call UnitAddAbility(bj_lastCreatedUnit, 'A002')
            //call SetUnitAbilityLevelSwapped( 'A002', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A001', ITCaster) )
            call SetUnitAbilityLevel(bj_lastCreatedUnit, 'A002', GetUnitAbilityLevel(ITCaster, Spellid))
            //call IssueImmediateOrderBJ( GetLastCreatedUnit(), "immolation" )
            call IssueImmediateOrder(bj_lastCreatedUnit, "immolation")
            //call UnitApplyTimedLifeBJ( ( ITDuration), 'BTLF', GetLastCreatedUnit() )
            call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', ITDuration)
            call SetTerrainPathableBJ( ITTargetPos, PATHING_TYPE_WALKABILITY, false )
            // Can't fix terrain pathable either, sorry.
            call RemoveLocation (ITTargetPos) 
            call TriggerSleepAction(0.01)
        endloop
    call RemoveLocation (ITTargetPoint)   
    set ITCaster = null
endfunction


//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction

endscope

When you declare 'A001' as a global, use it :p !
There was a bunch of things I couldn't fix, sorry.
 

BRUTAL

I'm working
Reaction score
118
ops XD
thanks anyways ;o
but i noticed now everything has like bj_ as a prefix, like when your referencing lastcrated unit, or weathereffect, is that how its supposed to be? i thought bjs were bad :p
 
Reaction score
341
The ones that look like...

bj_someWierdName

are pre-defined constants, in more simple terms..

they are pre-defined variables.

BJ Functions are generally bad, not constants.
 

BRUTAL

I'm working
Reaction score
118
The ones that look like...

bj_someWierdName

are pre-defined constants, in more simple terms..

they are pre-defined variables.

BJ Functions are generally bad, not constants.

so predefined constants are good? XD
and
oh yea like x/y points are better then locations right
 
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