Need JASS help

Dryvnt

New Member
Reaction score
10
i suck JASS but i want to make this Kamikazee trigger in JASS so it can get massed... it cant normal becuz im using unit variable and then as you know it will overwrite, but not with locals... but somehow it doesent work...
made trigger in GUI then copied and made to text... and changed name and "set *variable* = *value*" to "local unit *variablename*=*value*"
help = +rep

JASS:
function Trig_Kamikazee_JASS_Func001C takes nothing returns boolean
    if ( ( GetUnitTypeId(GetAttacker()) == 'h00H' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'h00G' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'h00C' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'h007' ) ) then
        return true
    endif
    return false
endfunction

function Trig_Kamikazee_JASS_Conditions takes nothing returns boolean
    if ( not Trig_Kamikazee_JASS_Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_Kamikazee_JASS_Actions takes nothing returns nothing
    call RemoveUnit( GetAttacker() )
    call CreateNUnitsAtLoc( 1, 'h008', GetOwningPlayer(GetAttacker()), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
    local unit HangarUnit = GetLastCreatedUnit()
    call CreateNUnitsAtLoc( 1, 'h009', GetOwningPlayer(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
    call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", GetUnitLoc(GetAttackedUnitBJ()) )
    call SetUnitFlyHeightBJ( GetLastCreatedUnit(), 0.00, ( ( ( DistanceBetweenPoints(GetUnitLoc(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker())) / GetUnitMoveSpeed(GetLastCreatedUnit()) ) / GetUnitFlyHeight(GetLastCreatedUnit()) ) + 0.00 ) )
    call TriggerSleepAction( ( ( DistanceBetweenPoints(GetUnitLoc(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker())) / GetUnitMoveSpeed(GetLastCreatedUnit()) ) + 0.00 ) )
    call UnitDamageTargetBJ( GetLastCreatedUnit(), GetAttackedUnitBJ(), 60.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
    call ExplodeUnitBJ( GetLastCreatedUnit() )
    call RemoveUnit( HangarUnit )
    call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetAttacker()), GetTriggerPlayer(), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
endfunction

//===========================================================================
function InitTrig_Kamikazee_JASS takes nothing returns nothing
    set gg_trg_Kamikazee_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Kamikazee_JASS, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Kamikazee_JASS, Condition( function Trig_Kamikazee_JASS_Conditions ) )
    call TriggerAddAction( gg_trg_Kamikazee_JASS, function Trig_Kamikazee_JASS_Actions )
endfunction


Edit : Thx for move. forgot about JASS help section
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
1. Locals must be declared as the first action in a function. You can set them then, or you can wait and set them later, but you must use the "local unit XX" line at the top of the function.

2. After setting the variable, make sure you use that variable name where you need it. I see that you did not replace the GetLastCreated... with the name of the variable later on.
 

Dryvnt

New Member
Reaction score
10
1. Locals must be declared as the first action in a function. You can set them then, or you can wait and set them later, but you must use the "local unit XX" line at the top of the function.

what do you mean ? (try to do what you mean and show that, im very bad at JASS :()

2. After setting the variable, make sure you use that variable name where you need it. I see that you did not replace the GetLastCreated... with the name of the variable later on.

only need variable for removing unit :p im making dummy unit and using MUI for it rest of way :D only need the unit so i can destroy that...
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Ok, here's how it should probably look: (freehand rearranging :p )



Though, I just realized that, since you don't use the BJ function, I don't think there will be a GetLastCreatedUnit.... Hold on....

Here. Try this:

JASS:
function Trig_Kamikazee_JASS_Actions takes nothing returns nothing
    local unit HangarUnit
    local unit OtherUnit
    call RemoveUnit( GetAttacker() )
    set HangarUnit = CreateNUnitsAtLoc( 1, 'h008', GetOwningPlayer(GetAttacker()), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
    set OtherUnit = CreateNUnitsAtLoc( 1, 'h009', GetOwningPlayer(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
    call IssuePointOrderLocBJ( OtherUnit, "move", GetUnitLoc(GetAttackedUnitBJ()) )
    call SetUnitFlyHeightBJ( OtherUnit, 0.00, ( ( ( DistanceBetweenPoints(GetUnitLoc(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker())) / GetUnitMoveSpeed(OtherUnit) ) / GetUnitFlyHeight(OtherUnit) ) + 0.00 ) )
    call TriggerSleepAction( ( ( DistanceBetweenPoints(GetUnitLoc(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker())) / GetUnitMoveSpeed(OtherUnit) ) + 0.00 ) )
    call UnitDamageTargetBJ( OtherUnit, GetAttackedUnitBJ(), 60.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
    call ExplodeUnitBJ( OtherUnit )
    call RemoveUnit( HangarUnit )
    call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetAttacker()), GetTriggerPlayer(), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
endfunction


I'm not sure, though. The first one might work, too. :p
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
I can type faster than I can think. :p

Try the first trigger.
 

0zaru

Learning vJASS ;)
Reaction score
60
That triggers leaks at least 4 locations :p

Also you can do this:
JASS:
    local unit HangarUnit=call CreateNUnitsAtLoc( 1, 'h008', GetOwningPlayer(GetAttacker()), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )
local unit OtherUnit=CreateNUnitsAtLoc( 1, 'h009', GetOwningPlayer(GetAttackedUnitBJ()), GetUnitLoc(GetAttacker()), bj_UNIT_FACING )

Also GetAttackedUnitBJ() returns GetTriggerUnit()
Most leaks are locations i think easy to do... Maybe you need to remove bjs for better "performance" But well it must work at least
 

Dryvnt

New Member
Reaction score
10
wow...
"Type mismatch in assignment"
"Expected a name"
"Expected '"
"Expected '"
"Expected '"
"Expected '"
"Expected '"

would it help if i post "Base" GUI ver ? might make more understandable what the trigger should do :D

Code:
Kamikazee
    Events
        Unit - A unit Is attacked
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 1
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 2
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 3
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 4
    Actions
        Unit - Remove (Attacking unit) from the game
        Unit - Create 1 Empty Hangar level 1 for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing Default building facing degrees
        Set HangarUnit = (Last created unit)
        Unit - Create 1 Kamikazee Copter for [Color=Blue](Owner of (Attacking unit))[/Color] at (Position of (Attacking unit)) facing Default building facing degrees
        Unit - Order (Last created unit) to Move To [Color=Blue](Position of (Attacking unit))[/Color]
        Animation - Change (Last created unit) flying height to 0.00 at ((((Distance between (Position of (Attacked unit)) and (Position of (Attacking unit))) / (Current movement speed of (Last created unit))) / (Current flying height of (Last created unit))) + 0.00)
        Wait (((Distance between (Position of (Attacked unit)) and (Position of (Attacking unit))) / (Current movement speed of (Last created unit))) + 0.00) seconds
        Unit - Cause (Last created unit) to damage (Attacked unit), dealing 60.00 damage of attack type Spells and damage type Normal
        Unit - Explode (Last created unit)
        [Color=Blue]Unit - Remove (HangarUnit)[/Color]
        Unit - Create 1 (Unit-type of (Attacking unit)) for (Triggering player) at (Position of (Attacking unit)) facing Default building facing degrees

Edited : Things in blue
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Why don't you post the map? :p
 

Dryvnt

New Member
Reaction score
10
:p

Edit : BIG DOH IN GUI VER

Unit - Create 1 Kamikazee Copter for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing Default building facing degrees
 

Attachments

  • Team TD.w3x
    37.3 KB · Views: 186

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
See if this works for you:
 

Attachments

  • Team TD.w3x
    37.2 KB · Views: 177

Dryvnt

New Member
Reaction score
10
serius unfun :( copters dont go down and dmg and dissaper...
but Hangars does... then all towers gone with no dmg done :(
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Did the GUI version work before you modified it with the custom script?
 

Dryvnt

New Member
Reaction score
10
couldnt fix prop with GUI ver... but think i found way with no need off JASS... just... cant make Tower reapper, and cant make "Fired" unit go down :(
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Well, give this modified GUI version a run:
 

Attachments

  • Team TD.w3x
    37.1 KB · Views: 205

Dryvnt

New Member
Reaction score
10
hmmm found out way to mix GUI and JASS... theres just some errors i dont kno what means... if you wanna help then know this... the triggers i replaced with JASS is in the trigger "Trigger Holder" - trigger :p so you know how it should be :)

Edit - Removed map cuz of later post
 

Dryvnt

New Member
Reaction score
10
bump

bump

Edit - Updated GUI ver... but something is wrong with it too...

Edit 2 - Updated the Updated GUI ver... now works... but not spammable... thats why i need JASS... and might need some "Call Removething"

Edit 3 - Made JASS ver the best i could... but with many errors

Code:
First-Made Kamikazee
    Events
        Unit - A unit Is attacked
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 1
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 2
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 3
                (Unit-type of (Attacking unit)) Equal to Kamikazee Tower level 4
    Actions
        Set Kami_DamageDone = (Damage taken)
        Set Kami_Attacked = (Attacked unit)
        Set Kami_AttackingUnit_Unit = (Attacking unit)
        Set Kami_AttackingUnit_UnitType = (Unit-type of Kami_AttackingUnit_Unit)
        Set Kami_Player = (Owner of Kami_AttackingUnit_Unit)
        Unit - Set life of Kami_Attacked to ((Life of Kami_Attacked) + Kami_DamageDone)
        Wait 0.10 seconds
        Set KamiStartPoint = (Position of Kami_AttackingUnit_Unit)
        Set KamiEndPoint = (Position of Kami_Attacked)
        Unit - Remove Kami_AttackingUnit_Unit from the game
        Unit - Create 1 Empty Hangar level 1 for Kami_Player at KamiStartPoint facing Default building facing degrees
        Set Kami_HangarUnit = (Last created unit)
        Unit - Create 1 Kamikazee Copter for Kami_Player at KamiStartPoint facing Default building facing degrees
        Set Kami_Dummy_Unit = (Last created unit)
        Set Kami_Distance = (Distance between KamiEndPoint and KamiStartPoint)
        Set Kami_MovementSpeed = (Current movement speed of Kami_Dummy_Unit)
        Set Kami_TimeTaken = (Kami_Distance / Kami_MovementSpeed)
        Set Kami_FlyingHeight = (Current flying height of Kami_Dummy_Unit)
        Set Kami_DescentSpeed = (Kami_FlyingHeight / Kami_TimeTaken)
        Unit - Order Kami_Dummy_Unit to Move To KamiEndPoint
        Animation - Change Kami_Dummy_Unit flying height to 0.00 at Kami_DescentSpeed
        Wait Kami_TimeTaken seconds
        Unit - Cause Kami_Dummy_Unit to damage Kami_Attacked, dealing Kami_DamageDone damage of attack type Spells and damage type Normal
        Unit - Explode Kami_Dummy_Unit
        Unit - Replace Kami_HangarUnit with a Kami_AttackingUnit_UnitType using The new unit's default life and mana

JASS:
function Trig_First_Kamikazee_JASS_Func026C takes nothing returns boolean
    if ( ( GetUnitTypeId(GetAttacker()) == 'h00H' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'h00G' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'h00C' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'h007' ) ) then
        return true
    endif
    return false
endfunction

function Trig_First_Kamikazee_JASS_Conditions takes nothing returns boolean
    if ( not Trig_First_Kamikazee_JASS_Func026C() ) then
        return false
    endif
    return true
endfunction

function Trig_First_Kamikazee_JASS_Actions takes nothing returns nothing
    local real Kami_DamageDone
    local unit Kami_Attacked
    local unit Kami_AttackingUnit_Unit
    local unittype Kami_AttackingUnit_UnitType
    local player Kami_Player
    local location Kami_StartPoint
    local location Kami_Endpoint
    local unit HangarUnit
    local unit Kami_Dummy_Unit
    local real Kami_Distance
    local real Kami_MovementSpeed
    local real Kami_FlyingHeight
    local real Kami_DescentSpeed
    set Kami_DamageDone = GetEventDamage()
    set Kami_Attacked = GetAttackedUnitBJ()
    set Kami_AttackingUnit_Unit = GetAttacker()
    set Kami_AttackingUnit_UnitType = GetUnitTypeId(Kami_AttackingUnit_Unit)
    set Kami_Player = GetOwningPlayer(Kami_AttackingUnit_Unit)
    call SetUnitLifeBJ( GetAttackedUnitBJ(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetAttackedUnitBJ()) Kami_DamageDone ) )
    call TriggerSleepAction( 0.10 )
    set Kami_StartPoint = GetUnitLoc(Kami_AttackingUnit_Unit)
    set Kami_EndPoint = GetUnitLoc(Kami_Attacked)
    call RemoveUnit( Kami_AttackingUnit_Unit )
    call CreateNUnitsAtLoc( 1, 'h008', Kami_Player, Kami_StartPoint, bj_UNIT_FACING )
    set Kami_HangarUnit = GetLastCreatedUnit()
    call CreateNUnitsAtLoc( 1, 'h009', Kami_Player, Kami_StartPoint, bj_UNIT_FACING )
    set Kami_Dummy_Unit = GetLastCreatedUnit()
    set Kami_Distance = DistanceBetweenPoints(Kami_EndPoint, Kami_StartPoint)
    set Kami_MovementSpeed = GetUnitMoveSpeed(Kami_Dummy_Unit)
    set Kami_TimeTaken = ( Kami_Distance / Kami_MovementSpeed )
    set Kami_FlyingHeight = GetUnitFlyHeight(Kami_Dummy_Unit)
    set Kami_DescentSpeed = ( Kami_FlyingHeight / Kami_TimeTaken )
    call IssuePointOrderLocBJ( Kami_Dummy_Unit, "move", Kami_EndPoint )
    call SetUnitFlyHeightBJ( Kami_Dummy_Unit, 0.00, Kami_DescentSpeed )
    call TriggerSleepAction( Kami_TimeTaken )
    call UnitDamageTargetBJ( Kami_Dummy_Unit, Kami_Attacked, Kami_DamageDone, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
    call ExplodeUnitBJ( Kami_Dummy_Unit )
    call ReplaceUnitBJ( udg_Kami_HangarUnit, udg_Kami_AttackingUnit_UnitType, bj_UNIT_STATE_METHOD_DEFAULTS )
endfunction

//===========================================================================
function InitTrig_First_Kamikazee_JASS takes nothing returns nothing
    set gg_trg_First_Kamikazee_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_First_Kamikazee_JASS, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_First_Kamikazee_JASS, Condition( function Trig_First_Kamikazee_JASS_Conditions ) )
    call TriggerAddAction( gg_trg_First_Kamikazee_JASS, function Trig_First_Kamikazee_JASS_Actions )
endfunction
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
fixed it but not spammable
You still have a few globals inside your code.

try making a trigger with the JASS ver... and enable it...
Isn't it common sense that it's you, who have a problem with your script, that should tell me what the exact problem is? You want help, I'm here to help. But I'm not here to find out what you need help with. If you can't explain your exact problem then I better waste my time helping someone that can.
Besides, the world editor is terrible crippled on my computer so I auto skip every question that requires me to open it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top