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: 185

Ghan

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

Attachments

  • Team TD.w3x
    37.2 KB · Views: 176

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: 204

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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top