• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Why Won't This Work?

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
JASS:
//below function optimized.
function Trig_Locust_Heal_Conditions takes nothing returns boolean
	return GetSpellAbilityId()=='A001'
endfunction
//optimized function below.
function Healers_Filter takes nothing returns boolean
	return IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false and GetUnitLifePercent(GetFilterUnit())<100 and IsUnitAliveBJ(GetFilterUnit()) and GetUnitAbilityLevelSwapped('A002',GetFilterUnit())==0 and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction

function Trig_Locust_Heal_Actions takes nothing returns nothing
	local location L
	local group G
	local integer IA=1
	local integer IB=10
	local integer IC
	local integer ID=1+2*GetUnitAbilityLevel(GetTriggerUnit(),'A001')
	local unit U
	loop
		exitwhen IA>IB
		set L=GetUnitLoc(GetTriggerUnit())
		set G=GetUnitsInRangeOfLocMatching(350.,L,Condition(function Healers_Filter))
		set IC=1
		loop
			exitwhen IC>ID
			set U=GroupPickRandomUnit(G)
			if(U!=null)then
				call SetWidgetLife(U,GetUnitState(U,UNIT_STATE_LIFE)+10)
			endif
			set IC=IC+1
		endloop
		call PolledWait(1.)
		call DestroyGroup(G)
		call RemoveLocation(L)
		set IA=IA+1
	endloop
endfunction

//Make sure below function is called by some other trigger as currently the spell will not work as there is nothing to create the trigger so that it may be triggered.
function StartTrigger_Locust_Heal takes nothing returns nothing
	set gg_trg_Locust_Heal=CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(gg_trg_Locust_Heal,EVENT_PLAYER_UNIT_SPELL_EFFECT)
	call TriggerAddCondition(gg_trg_Locust_Heal,Condition(function Trig_Locust_Heal_Conditions))
	call TriggerAddAction(gg_trg_Locust_Heal,function Trig_Locust_Heal_Actions)
endfunction

function InitTrig_Locust_Heal takes nothing returns nothing
endfunction

This might not fix it, but it should make it more efficent.
 
Level 11
Joined
Aug 25, 2006
Messages
971
Things can't deal negative damage. I've tried, it just doesn't work. Wc3 automatically compensates and sets their damage to 0.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
not even shift thing ?

well if we can make critical strike text dissappear
may be we can make them do negative critical damage

COOL

Critical damage can do bonus damage (not multiple)
we can make it negative

+rep to myself

(bash would work but it would stun us. may be we can find another ability if we cant make critical text dissapear)
 
Status
Not open for further replies.
Top