New to JASS and need help

IAmSoDoomed

New Member
Reaction score
0
Hi, I'm new to JASS and, I tried to script something and everything works, besides one thing and I'm not sure which one it is.

I guess it's
either a problem with the Unit Group
or a problem with adding the abillity

Code:
function Trig_Fire_Burst_Conditions takes nothing returns boolean
    if (not( GetSpellAbilityId() == 'A000' ))  then
        return false
    endif
    return true
endfunction

//========================================================================================================================================================================================================================================================

function Trig_Fire_Burst_FuncCon takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

//========================================================================================================================================================================================================================================================

function Trig_Fire_Burst_FuncAct takes nothing returns nothing
    call UnitAddAbilityBJ( 'A001', GetEnumUnit() )
endfunction

//========================================================================================================================================================================================================================================================

function Trig_Fire_Burst_Actions takes nothing returns nothing
    local unit Triggering_Unit = GetTriggerUnit()
    local location Caster_Location = GetUnitLoc( Triggering_Unit )
    local integer Index = 1
    local integer IndexEnd = 10
    call TriggerSleepAction( 0.18 )
    loop
        exitwhen Index > IndexEnd
        call AddSpecialEffectLocBJ(PolarProjectionBJ(Caster_Location,(50.00 * Index),GetUnitFacing(Triggering_Unit)), "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl")
        call TriggerSleepAction( 0.01 )
        call UnitDamagePointLoc(Triggering_Unit,0,40,PolarProjectionBJ(Caster_Location,(50 * Index),GetUnitFacing(Triggering_Unit)),100,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC)
        call ForGroupBJ( GetUnitsInRangeOfLocMatching(30.00, PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), ( 50.00 * 10.00 ), GetUnitFacing(GetTriggerUnit())), Condition(function Trig_Fire_Burst_FuncCon)), function Trig_Fire_Burst_FuncAct )
        set Index = Index + 1
     endloop
    call RemoveLocation(Caster_Location)
endfunction

//========================================================================================================================================================================================================================================================
function InitTrig_Fire_Burst takes nothing returns nothing
    set gg_trg_Fire_Burst = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Fire_Burst, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition( gg_trg_Fire_Burst, Condition( function Trig_Fire_Burst_Conditions ) )
    call TriggerAddAction( gg_trg_Fire_Burst, function Trig_Fire_Burst_Actions )
endfunction

The skill itself, shoots out a wave of fire to the front and is supposed to add an ability to the units, inside of the AoE. Just that it doesn't add the Ability to the target unit.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
30.00 is small value. Basically you will pick a unit only under 30 Area.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
I've helped him via MSN.

Here's my version if anyone wants to see...
JASS:
scope FireBurst initializer Init
//Almost everything goes in a scope
//Except systems, which you'll get into later on

	//We talked about globals
	globals
		private constant integer SPELLID = 'A000'
		//Rawcode of the 'Fire Burst' ability
		
		private constant integer AURAID = 'A001'
		//Rawcode of the aura ability
		
		private constant real DISTANCE = 50.
		//The distance in PolarProjection
		
		private constant string SFX = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl"
		//The path of the SFX you want
		
		private constant integer LOOPEND = 9
		//How many loops until the loop ends?
	endglobals
	
	private function DAMAGE takes integer level returns real
		return 100.
		//The damage Fire Burst deals
	endfunction
	
	private function AOERANGE takes integer level returns real
		return 30.
		//The range units are picked in
	endfunction
	
//==============================================================
//===============     DO NOT TOUCH PAST HERE     ===============
//===============     DO NOT TOUCH PAST HERE     ===============
//===============     DO NOT TOUCH PAST HERE     ===============
//==============================================================

	globals
		private group G = CreateGroup()
		//Declare this below the "DO NOT TOUCH" line so that people don't touch this
		//You can have as many global blocks as you want
		//We use a global group since it's filled and emptied right away for this spell
		//Remember though, do NOT do "call DestroyGroup(G)" for global groups
	endglobals
	
	//Add a 'private' prefix
	//private function Trig_Fire_Burst_Conditions takes nothing returns boolean
	//The function gets renamed because we named it differently in the initializer at the bottom
	private function Conditions takes nothing returns boolean
		//if (not( GetSpellAbilityId() == 'A000' ))  then
			//return false
		//endif
		//return true
		
		//Just return if it's the right spell directly
		return GetSpellAbilityId() == SPELLID
		//SPELLID is a global
	endfunction

	//private function Trig_Fire_Burst_FuncCon takes nothing returns boolean
	private function GroupConditions takes nothing returns boolean
	//Changed name in the Grouping function so you have to change it here
	
		//return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true )
		//You don't need the "== true"
		//If there's no "== XXX" at the end it assumes you want "== true"
		return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405
		//Added in to check if the unit is alive also
	endfunction

	//private function Trig_Fire_Burst_FuncAct takes nothing returns nothing
	private function GroupActions takes nothing returns nothing
	//Changed the name in the ForGroup() function so it's changed here also
	
		//call UnitAddAbilityBJ( 'A001', GetEnumUnit() )
		//Try to start using Natives instead of BJ's
		//BJ's call upon Natives so just using the native directly is better
		call UnitAddAbility(GetEnumUnit(), AURAID)
		//AURAID is a global
		
		//Don't forget, we have to damage the units in here now
		call UnitDamageTarget(GetTriggerUnit(), GetFilterUnit(), DAMAGE, true, true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
		//DAMAGE is a function global
	endfunction

//========================================================================================================================================================================================================================================================

	//private function Trig_Fire_Burst_Actions takes nothing returns nothing
	private function Actions takes nothing returns nothing
	//Renamed to "Actions"
	
		local unit tu = GetTriggerUnit()
		//local location Caster_Location = GetUnitLoc( tu )
		//Locations are so GUI, they can also leak
		//JASS = X/Y coordinates, X/Y are reals, which do not leak
		local real tx = GetUnitX(tu)
		local real ty = GetUnitY(tu)
		
		//local integer Index = 1
		local integer index = 0
		//Changed to 0
		//Also, all locals should have no capitals in them
		
		//local integer IndexEnd = 10
		//Not needed
		
		//call TriggerSleepAction( 0.18 )
		//Why the random wait?
		
		loop
		//exitwhen Index > IndexEnd
		exitwhen index == LOOPEND
		//Now you only need one variable
		//LOOPEND is a global
		
			set tx = GetUnitX(tu) + (DISTANCE * index) * Cos(GetUnitFacing(tu) * bj_DEGTORAD)
			set ty = GetUnitY(tu) + (DISTANCE * index) * Sin(GetUnitFacing(tu) * bj_DEGTORAD)
			//Uses X/Y instead of locations
			//call AddSpecialEffectLocBJ(PolarProjectionBJ(Caster_Location,(50.00 * Index),GetUnitFacing(tu)), "Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl")
			call DestroyEffect(AddSpecialEffect(SFX, tx, ty))
			//The native for SFX
			//You need DestroyEffect() to prevent an SFX leak
			//AddSpecialEffect() uses X/Y instead of locations
			
			call TriggerSleepAction( 0.01 )
			//TriggerSleepAction()'s are inaccurate.
			
			//call UnitDamagePointLoc(tu,0,40,PolarProjectionBJ(Caster_Location,(50 * Index),GetUnitFacing(tu)),100,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC)
			//This can cause Mac users to disconnect
			//Damage all the units in the ForGroup() function
			
			//call ForGroupBJ( GetUnitsInRangeOfLocMatching(30.00, PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), ( 50.00 * 10.00 ), GetUnitFacing(GetTriggerUnit())), Condition(function Trig_Fire_Burst_FuncCon)), function Trig_Fire_Burst_FuncAct )
			call GroupEnumUnitsInRange(G, tx, ty, AOERANGE, Condition(function GroupConditions))
			//AOERANGE is a global, look at the top of this trigger
			//Group the units beforehand to look neater
			call ForGroup(G, function GroupActions)
			//Again, avoiding a BJ
			
			//set Index = Index + 1
			set index = index + 1
			//"Index" was renamed to "index"
		endloop
		//call RemoveLocation(Caster_Location)
		//Don't need this anymore
		//We need to null the unit and group variable though
		set tu = null
	endfunction

//========================================================================================================================================================================================================================================================
	//private function InitTrig_Fire_Burst takes nothing returns nothing
	//"scope...initializer Init"
	//The initializer is "Init", so we name this function that
	private function Init takes nothing returns nothing
		//set gg_trg_Fire_Burst = CreateTrigger(  )
		//We make a local trigger named "t" so it's easier to use
		//"t" is easier then typing "gg_trg_Fire_Burst"
		local trigger t = CreateTrigger()
		
		//call TriggerRegisterAnyUnitEventBJ(gg_trg_Fire_Burst, EVENT_PLAYER_UNIT_SPELL_CAST)
		call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
		//Notice how it changed from "gg_trg_Fire_Burst" to "t"
		//This BJ is one of the few good ones to use... ^-- Notice how I changed it to "..._EFFECT"
		//"..._EFFECT" means "Starts the effect of an ability"
		//Always use this instead of "..._CAST"
		
		//call TriggerAddCondition( gg_trg_Fire_Burst, Condition( function Trig_Fire_Burst_Conditions ) )
		call TriggerAddCondition(t, Condition(function Conditions))
		//Not much to say here
		
		//call TriggerAddAction( gg_trg_Fire_Burst, function Trig_Fire_Burst_Actions )
		call TriggerAddAction(t, function Actions)		
	endfunction
	
endscope
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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