• 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.

[IssuePointOrderById] - Frozen orders?

Status
Not open for further replies.
Level 4
Joined
Dec 23, 2005
Messages
41
Hi,

I am ordering a unit to cast a spell by using IssuePointOrderById or IssueTargetOrderById and sometimes, not all the time, the spell isn't cast and the unit is "frozen", the spell is green-white contoured but isn't cast... Using IssuePointOrderById returns true; the unit is really ordered but is not doing it... Here is a screenshot

unitestupide.jpg


I've tried puting the Animation Backswing and the other one to 0; it's not that... It's really random. Do anyone has ever seen that?

Thanks!
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
If it isn't a triggering problem then why did you post it in the Triggers & Scripts section.

watterly said:
No? That only means that it is not related to the range.

Or other trigger problems that you may have encountered. This was the point. Post the test-map or the script, not just a picture of the problem. Nobody can solve a problem based on a picture. I could post several screen-shots that look like they have the problem you do using many different methods, so please if you want help don't expect us to have magical fairy powers that allow us to read your script from a fucking picture.
 
Level 4
Joined
Dec 23, 2005
Messages
41
This skill uses the IssuePointOrderById function...

JASS:
scope PutridExplosion

globals
 public constant integer spellid1 = 'A02E' 
 public constant integer manacost1 = 80
 public constant integer manacostperlvl1 = 0
 public constant integer chance1 = 100
 unit array PutridExplosionUnit
 constant integer PESTILENCECLOUD = 'uplg'
endglobals

public function Conditions1 takes nothing returns boolean
 return GetSpellAbilityId()==spellid1
endfunction

public function GetNearestCorpse takes unit U, player J returns unit
 local location position = GetUnitLoc(U)
 local group groupe = GetUnitsInRangeOfLocMatching(900,position,null)
 local unit un = null
 local real dist = 1000
 set PutridExplosionUnit[GetPlayerId(J)]=null
 loop
     set un = GroupPickRandomUnit(groupe)
     exitwhen un == null
     if(IsUnitEnemy(un,J) and IsDead(un) and DistUnits(U,un)<dist and not IsMech(un) and IsUnitVisible(un,GetOwningPlayer(U)) and not IsHero(un) and not IsEffect(un)) then
         set dist = DistUnits(U,un)
         set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(U))]=un
     endif
     call GroupRemoveUnit(groupe,un)
 endloop
 call DestroyGroup(groupe)
 call RemoveLocation(position) 
 set position = null
 set groupe = null
 set un = null
 return PutridExplosionUnit[GetPlayerId(J)]
endfunction

public function GetNearestCorpseAoE takes unit U, player J, location P returns unit
 local group groupe = GetUnitsInRangeOfLocMatching(350,P,null)
 local unit un = null
 local real dist = 450
 set PutridExplosionUnit[GetPlayerId(J)]=null
 loop
     set un = GroupPickRandomUnit(groupe)
     exitwhen un == null
     if(IsUnitEnemy(un,J) and IsDead(un) and DistCoord(GetUnitX(un),GetUnitY(un),GetLocationX(P),GetLocationY(P))<dist and not IsMech(un) and IsUnitVisible(un,GetOwningPlayer(U)) and not IsHero(un) and not IsEffect(un)) then
         set dist = DistCoord(GetUnitX(un),GetUnitY(un),GetLocationX(P),GetLocationY(P))
         set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(U))]=un
     endif
     call GroupRemoveUnit(groupe,un)
 endloop
 call DestroyGroup(groupe)
 set groupe = null
 set un = null
 return PutridExplosionUnit[GetPlayerId(J)]
endfunction

public function Conditions2 takes nothing returns boolean
 return GetUnitAbilityLevel(GetAttacker(),'A018')>0 and GetUnitAbilityLevel(GetAttacker(),spellid1)>0 and IsUnitEnemy(GetAttacker(),GetOwningPlayer(GetTriggerUnit())) and IsDead(GetTriggerUnit())==false and IsIllusion(GetAttacker())==false and EnableAI[GetPlayerId(GetOwningPlayer(GetAttacker()))]==true
endfunction

public function SpellEffect1 takes nothing returns nothing
 local unit lanceur = GetSpellAbilityUnit()
 local integer lvl = GetUnitAbilityLevel(lanceur,spellid1)  
 local location position = GetSpellTargetLoc()
 local unit cible = GetNearestCorpseAoE(lanceur, GetOwningPlayer(lanceur),position)
 local group groupe = GetUnitsInRangeOfLocAll(250,position)  
 local real dmg = GetUnitState(cible,UNIT_STATE_MAX_LIFE)*GetRandomReal(0.30,0.70)
 local unit un = null
 local unit cloud = null
 if cible==null then
    call UnitResetAbility(lanceur,spellid1,lvl)
    call Error(GetOwningPlayer(lanceur),"There are no usable corpses nearby.")
    call RegenManaStat(lanceur,manacost1+manacostperlvl1*lvl)
 else
    call RemoveLocation(position)
    set position = GetUnitLoc(cible)
    call DestroyEffect(AddSpecialEffectLoc("PutridExplosion.mdx",position))
    call DestroyEffect(AddSpecialEffectLoc("Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl",position))
    call RemoveUnit(cible)
    set cloud = CreateUnitAtLoc(GetOwningPlayer(lanceur),PESTILENCECLOUD,position,0)
    call UnitApplyTimedLife(cloud, 'BTLF',15)
    loop
        set un = FirstOfGroup(groupe)
        exitwhen un == null
        if (IsUnitEnemy(un,GetOwningPlayer(lanceur)) and not IsInvulnerable(un) and not IsEffect(un) and not IsDead(un)) then
            call UnitDamageTarget(lanceur, un,dmg/2, false,true, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS) 
            if not IsMagicImmune(un) then
                call UnitDamageTarget(lanceur, un,dmg/2, false,true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) 
            endif
        endif
        call GroupRemoveUnit(groupe,un)
    endloop
 endif
 if position!=null then
    call RemoveLocation(position)
 endif
 call DestroyGroup(groupe)
 set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(lanceur))]=null
 set lanceur = null
 set position = null
 set groupe = null
 set un = null
 set cible = null
 set cloud = null
endfunction

public function Attack takes nothing returns nothing
 local unit lanceur = GetAttacker()
 local unit cible = GetTriggerUnit()
 local integer lvl = GetUnitAbilityLevel(lanceur,spellid1) 
 local unit corpse = GetNearestCorpse(lanceur,GetOwningPlayer(lanceur))
 if Chance(chance1,1) and corpse!=null and GetUnitState(lanceur,UNIT_STATE_MANA)>=manacost1+manacostperlvl1*lvl then
    if IssuePointOrderById(lanceur,OrderId("blizzard"),GetUnitX(corpse),GetUnitY(corpse))==true then
        call ReOrderDelayed(lanceur,0)
    endif
 endif
 set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(lanceur))]=null 
 set corpse = null
 set lanceur = null
 set cible = null
endfunction

public function Init takes nothing returns nothing
 local trigger declo = CreateTrigger()
 call TriggerAddCondition(declo,Condition(function Conditions2)) 
 call TriggerRegisterAnyUnitEventBJ(declo, EVENT_PLAYER_UNIT_ATTACKED)
 call TriggerAddAction(declo, function Attack) 
 set declo = CreateTrigger()
 call TriggerAddCondition(declo,Condition(function Conditions1))
 call TriggerRegisterAnyUnitEventBJ(declo,EVENT_PLAYER_UNIT_SPELL_EFFECT)
 call TriggerAddAction(declo,function SpellEffect1)  
 set declo = null
 call LoadSkill(spellid1)     
endfunction

endscope

As seen in the picture, this is Breath of Frost's code; it uses the IssueTargetOrderById function.

JASS:
scope BreathofFrost

globals
 public constant integer spellid1 = 'A03F' 
 public constant integer buffid1 = 'BCbf'
 public constant integer manacost1 = 90
 public constant integer manacostperlvl1 = 10 
 public constant integer chance1 = 100
endglobals

public function Conditions1 takes nothing returns boolean
 return GetUnitAbilityLevel(GetAttacker(),'A018')>0 and GetUnitAbilityLevel(GetTriggerUnit(),buffid1)==0 and GetUnitAbilityLevel(GetAttacker(),spellid1)>0 and IsUnitEnemy(GetAttacker(),GetOwningPlayer(GetTriggerUnit())) and not IsMagicImmune(GetTriggerUnit()) and IsIllusion(GetAttacker())==false and EnableAI[GetPlayerId(GetOwningPlayer(GetAttacker()))]==true
endfunction

public function Attack takes nothing returns nothing
 local unit lanceur = GetAttacker()
 local unit cible = GetTriggerUnit()
 local integer lvl = GetUnitAbilityLevel(lanceur,spellid1) 
 if Chance(chance1,1) and GetUnitState(lanceur,UNIT_STATE_MANA)>=manacost1+manacostperlvl1*lvl then
    if IssueTargetOrderById(lanceur,OrderId("breathoffrost"),cible)==true then
        call ReOrderDelayed(lanceur,0)
    endif
 endif
 set cible = null
 set lanceur = null
endfunction

public function Init takes nothing returns nothing
 local trigger declo = CreateTrigger()
 call TriggerAddCondition(declo,Condition(function Conditions1)) 
 call TriggerRegisterAnyUnitEventBJ(declo, EVENT_PLAYER_UNIT_ATTACKED)
 call TriggerAddAction(declo, function Attack)
 set declo = null
endfunction

endscope

This one too; skill is based on Crushing Wave (Carrion Swarm)... Strangly the real Carrion Swarm (casted by another unit) doesn't freeze the unit. That's why I though it was unit-related... The triggers are the same :

JASS:
scope CrushingWave

globals
 public constant integer spellid1 = 'A06P' 
 public constant integer manacost1 = 150
 public constant integer manacostperlvl1 = 25
 public constant integer chance1 = 100
endglobals

public function Conditions1 takes nothing returns boolean
 return GetUnitAbilityLevel(GetAttacker(),'A018')>0 and IsMagicImmune(GetTriggerUnit())==false and GetUnitAbilityLevel(GetAttacker(),spellid1)>0 and IsUnitEnemy(GetAttacker(),GetOwningPlayer(GetTriggerUnit())) and IsDead(GetTriggerUnit())==false and IsIllusion(GetAttacker())==false and EnableAI[GetPlayerId(GetOwningPlayer(GetAttacker()))]==true
endfunction

public function Attack takes nothing returns nothing
 local unit lanceur = GetAttacker()
 local unit cible = GetTriggerUnit()
 local integer lvl = GetUnitAbilityLevel(lanceur,spellid1) 
 if Chance(chance1,1) and GetUnitState(lanceur,UNIT_STATE_MANA)>=manacost1+manacostperlvl1*lvl then
    if IssueTargetOrderById(lanceur,OrderId("carrionswarm"),cible)==true then
        call ReOrderDelayed(lanceur,1)
    endif    
 endif
 set lanceur = null
 set cible = null
endfunction

public function Init takes nothing returns nothing
 local trigger declo = CreateTrigger()
 call TriggerAddCondition(declo,Condition(function Conditions1)) 
 call TriggerRegisterAnyUnitEventBJ(declo, EVENT_PLAYER_UNIT_ATTACKED)
 call TriggerAddAction(declo, function Attack) 
 set declo = null  
endfunction

endscope

JASS:
scope CarrionSwarm

globals
 public constant integer spellid1 = 'AUcs' 
 public constant integer manacost1 = 85
 public constant integer manacostperlvl1 = 25
 public constant integer chance1 = 100
endglobals

public function Conditions1 takes nothing returns boolean
 return GetUnitAbilityLevel(GetAttacker(),'A018')>0 and IsMagicImmune(GetTriggerUnit())==false and GetUnitAbilityLevel(GetAttacker(),spellid1)>0 and IsUnitEnemy(GetAttacker(),GetOwningPlayer(GetTriggerUnit())) and IsDead(GetTriggerUnit())==false and IsIllusion(GetAttacker())==false and EnableAI[GetPlayerId(GetOwningPlayer(GetAttacker()))]==true
endfunction

public function Attack takes nothing returns nothing
 local unit lanceur = GetAttacker()
 local unit cible = GetTriggerUnit()
 local integer lvl = GetUnitAbilityLevel(lanceur,spellid1) 
 if Chance(chance1,1) and GetUnitState(lanceur,UNIT_STATE_MANA)>=manacost1+manacostperlvl1*lvl then
    if IssueTargetOrderById(lanceur,OrderId("carrionswarm"),cible)==true then
        call ReOrderDelayed(lanceur,0)
    endif    
 endif
 set lanceur = null
 set cible = null
endfunction

public function Init takes nothing returns nothing
 local trigger declo = CreateTrigger()
 call TriggerAddCondition(declo,Condition(function Conditions1)) 
 call TriggerRegisterAnyUnitEventBJ(declo, EVENT_PLAYER_UNIT_ATTACKED)
 call TriggerAddAction(declo, function Attack) 
 set declo = null  
endfunction

endscope

I don't encounter this problem with IssueImmediateOrderById functions.

Thanks.

PS : ReOrderDelayed uses the call IssueImmediateOrderById(U,OrderId("stop")) function after a 0 timer expires... I used that thing to ReOrder units that are frozen with skills like Breath of Frost or Putrid Explosion...
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Thanks for using
JASS:
 tags.

[code=jass]scope PutridExplosion

	globals
		public constant integer spellid1 = 'A02E'
		public constant integer manacost1 = 80
		public constant integer manacostperlvl1 = 0
		public constant integer chance1 = 100
		unit array PutridExplosionUnit
		constant integer PESTILENCECLOUD = 'uplg'
	endglobals

	public function Conditions1 takes nothing returns boolean
		return GetSpellAbilityId()==spellid1
	endfunction

	public function GetNearestCorpse takes unit U, player J returns unit
		local location position = GetUnitLoc(U)
		local group groupe = GetUnitsInRangeOfLocMatching(900,position,null)
		local unit un = null
		local real dist = 1000
		set PutridExplosionUnit[GetPlayerId(J)]=null
		loop
			set un = GroupPickRandomUnit(groupe)
			exitwhen un == null
			if(IsUnitEnemy(un,J) and IsDead(un) and DistUnits(U,un)<dist and not IsMech(un) and IsUnitVisible(un,GetOwningPlayer(U)) and not IsHero(un) and not IsEffect(un)) then
				set dist = DistUnits(U,un)
				set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(U))]=un
			endif
			call GroupRemoveUnit(groupe,un)
		endloop
		call DestroyGroup(groupe)
		call RemoveLocation(position)
		set position = null
		set groupe = null
		set un = null
		return PutridExplosionUnit[GetPlayerId(J)]
	endfunction

	public function GetNearestCorpseAoE takes unit U, player J, location P returns unit
		local group groupe = GetUnitsInRangeOfLocMatching(350,P,null)
		local unit un = null
		local real dist = 450
		set PutridExplosionUnit[GetPlayerId(J)]=null
		loop
			set un = GroupPickRandomUnit(groupe)
			exitwhen un == null
			if(IsUnitEnemy(un,J) and IsDead(un) and DistCoord(GetUnitX(un),GetUnitY(un),GetLocationX(P),GetLocationY(P))<dist and not IsMech(un) and IsUnitVisible(un,GetOwningPlayer(U)) and not IsHero(un) and not IsEffect(un)) then
				set dist = DistCoord(GetUnitX(un),GetUnitY(un),GetLocationX(P),GetLocationY(P))
				set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(U))]=un
			endif
			call GroupRemoveUnit(groupe,un)
		endloop
		call DestroyGroup(groupe)
		set groupe = null
		set un = null
		return PutridExplosionUnit[GetPlayerId(J)]
	endfunction

	public function Conditions2 takes nothing returns boolean
		return GetUnitAbilityLevel(GetAttacker(),'A018')>0 and GetUnitAbilityLevel(GetAttacker(),spellid1)>0 and IsUnitEnemy(GetAttacker(),GetOwningPlayer(GetTriggerUnit())) and IsDead(GetTriggerUnit())==false and IsIllusion(GetAttacker())==false and EnableAI[GetPlayerId(GetOwningPlayer(GetAttacker()))]==true
	endfunction

	public function SpellEffect1 takes nothing returns nothing
		local unit lanceur = GetSpellAbilityUnit()
		local integer lvl = GetUnitAbilityLevel(lanceur,spellid1)
		local location position = GetSpellTargetLoc()
		local unit cible = GetNearestCorpseAoE(lanceur, GetOwningPlayer(lanceur),position)
		local group groupe = GetUnitsInRangeOfLocAll(250,position)
		local real dmg = GetUnitState(cible,UNIT_STATE_MAX_LIFE)*GetRandomReal(0.30,0.70)
		local unit un = null
		local unit cloud = null
		if cible==null then
			call UnitResetAbility(lanceur,spellid1,lvl)
			call Error(GetOwningPlayer(lanceur),"There are no usable corpses nearby.")
			call RegenManaStat(lanceur,manacost1+manacostperlvl1*lvl)
		else
			call RemoveLocation(position)
			set position = GetUnitLoc(cible)
			call DestroyEffect(AddSpecialEffectLoc("PutridExplosion.mdx",position))
			call DestroyEffect(AddSpecialEffectLoc("Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDe athExplode.mdl",position))
			call RemoveUnit(cible)
			set cloud = CreateUnitAtLoc(GetOwningPlayer(lanceur),PESTILENCECLOUD,position,0)
			call UnitApplyTimedLife(cloud, 'BTLF',15)
			loop
				set un = FirstOfGroup(groupe)
				exitwhen un == null
				if (IsUnitEnemy(un,GetOwningPlayer(lanceur)) and not IsInvulnerable(un) and not IsEffect(un) and not IsDead(un)) then
					call UnitDamageTarget(lanceur, un,dmg/2, false,true, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
					if not IsMagicImmune(un) then
						call UnitDamageTarget(lanceur, un,dmg/2, false,true, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
					endif
				endif
				call GroupRemoveUnit(groupe,un)
			endloop
		endif
		if position!=null then
			call RemoveLocation(position)
		endif
		call DestroyGroup(groupe)
		set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(lanceur))]=null
		set lanceur = null
		set position = null
		set groupe = null
		set un = null
		set cible = null
		set cloud = null
	endfunction

	public function Attack takes nothing returns nothing
		local unit lanceur = GetAttacker()
		local unit cible = GetTriggerUnit()
		local integer lvl = GetUnitAbilityLevel(lanceur,spellid1)
		local unit corpse = GetNearestCorpse(lanceur,GetOwningPlayer(lanceur))
		if Chance(chance1,1) and corpse!=null and GetUnitState(lanceur,UNIT_STATE_MANA)>=manacost1+manacostperlvl1*lvl then
			if IssuePointOrderById(lanceur,OrderId("blizzard"),GetUnitX(corpse),GetUnitY(corpse))==true then
				call ReOrderDelayed(lanceur,0)
			endif
		endif
		set PutridExplosionUnit[GetPlayerId(GetOwningPlayer(lanceur))]=null
		set corpse = null
		set lanceur = null
		set cible = null
	endfunction

	public function Init takes nothing returns nothing
		local trigger declo = CreateTrigger()
		call TriggerAddCondition(declo,Condition(function Conditions2))
		call TriggerRegisterAnyUnitEventBJ(declo, EVENT_PLAYER_UNIT_ATTACKED)
		call TriggerAddAction(declo, function Attack)
		set declo = CreateTrigger()
		call TriggerAddCondition(declo,Condition(function Conditions1))
		call TriggerRegisterAnyUnitEventBJ(declo,EVENT_PLAYER_UNIT_SPELL_EFFECT)
		call TriggerAddAction(declo,function SpellEffect1)
		set declo = null
		call LoadSkill(spellid1)
	endfunction

endscope
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Okay, so it seems that this is where you order your unit to use the spell:

JASS:
            if IssuePointOrderById(lanceur,OrderId("blizzard"),GetUnitX(corpse),GetUnitY(corpse))==true then
                call ReOrderDelayed(lanceur,0)
            endif

So, my question now is, what is function ReOrderDelayed?

By the way, the ==true comparison is redundant. If the boolean evaluates to true (so the order was properly issued) then it does not need to be compared to "true". In other words, (true==true) is the same as (true).

I'm thinking there may be a problem with that function, but I'm not entirely sure. Try testing the same code out but use the order string instead. The native for this is:

JASS:
if IssuePointOrder(lanceur, "blizzard", GetUnitX(corpse), GetUnitY(corpse)) then

I seem to recall somebody having problems with the "by ID" version of target and point, though I remember that the immediate orders worked alright. I'm still looking around for the documentation of this.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
If it's ordering the casting unit to stop after 0 seconds then the caster probably won't be casting the spell unless it has a 0.00 cast back-swing. You should probably post the code for your 0-second timer because you can encounter a lot of problems if you don't do it right. By the way, there is no such thing as a 0-second timer, in reality it is 0.00001 or something small and insignificant. Either way though, it affects the order of the code that is to be executed.
 
Level 4
Joined
Dec 23, 2005
Messages
41
TimerStart using 0 seconds does not expires after 0 seconds; it is not instant. It's probly 0.24 seconds or something like that.

And no, it is not the cause of the problem. In fact, that thing is solving the problem partially; each time the unit has been ordered, it has the time enough to cast the spell (if its a channeling spell i uses ReOrderDelayed(U, Timeofchanneling) and that's it. In fact, when the unit freezes, it is reordered; it tries a second time, and sometimes it success, sometimes it takes 4-5 instances before working.

Other skills using the same functions uses ReOrderDelayed and are not freezing anyone trust me.

EDIT : If I remove that line (ReOrderDelayed), the unit freeze, and stay frozen. It doesn't attack anymore, and the skill is green-white contoured as in the screenshot... If i uses ReOrderDelayed, the unit tries like I said, another time to cast it, and another time, and another time until it succeed.

JASS:
function ReOrder takes unit U returns nothing
 local location position = null
 if GetOwningPlayer(U)==Player(11) then
    if IsUnitInGroup(U,OrangeRun2) then
        set position = GetRectCenter(gg_rct_EndRuns)
    elseif IsUnitInGroup(U,OrangeRun1) then
        set position = GetRectCenter(gg_rct_OrangeRun2)        
    elseif IsUnitInGroup(U,OrangeSpawn1) or IsUnitInGroup(U,OrangeSpawn2) then
        set position = GetRectCenter(gg_rct_OrangeRun1)
    elseif IsUnitInGroup(U,PurpleRun5) or IsUnitInGroup(U,YellowRun5) then
        set position = GetRectCenter(gg_rct_OrangeRun2)        
    elseif IsUnitInGroup(U,PurpleRun4) then
        set position = GetRectCenter(gg_rct_PurpleRun5)
    elseif IsUnitInGroup(U,PurpleRun3) then
        set position = GetRectCenter(gg_rct_PurpleRun4)
    elseif IsUnitInGroup(U,PurpleRun2) then
        set position = GetRectCenter(gg_rct_PurpleRun3) 
    elseif IsUnitInGroup(U,PurpleRun1) then
        set position = GetRectCenter(gg_rct_PurpleRun2)        
    elseif IsUnitInGroup(U,PurpleSpawn1) or IsUnitInGroup(U,PurpleSpawn2) then
        set position = GetRectCenter(gg_rct_PurpleRun1)
    elseif IsUnitInGroup(U,YellowRun4) then
        set position = GetRectCenter(gg_rct_YellowRun5)
    elseif IsUnitInGroup(U,YellowRun3) then
        set position = GetRectCenter(gg_rct_YellowRun4)
    elseif IsUnitInGroup(U,YellowRun2) then
        set position = GetRectCenter(gg_rct_YellowRun3) 
    elseif IsUnitInGroup(U,YellowRun1) then
        set position = GetRectCenter(gg_rct_YellowRun2)        
    elseif IsUnitInGroup(U,YellowSpawn1) or IsUnitInGroup(U,YellowSpawn2) then
        set position = GetRectCenter(gg_rct_YellowRun1)
    elseif IsUnitInGroup(U,BlueRun1) then
        set position = GetRectCenter(gg_rct_OrangeRun1)         
    elseif IsUnitInGroup(U,BlueSpawn1) or IsUnitInGroup(U,BlueSpawn2) then
        set position = GetRectCenter(gg_rct_BlueRun1)                   
    elseif IsUnitInGroup(U,RedRun1) then
        set position = GetRectCenter(gg_rct_PurpleRun1)         
    elseif IsUnitInGroup(U,RedSpawn1) or IsUnitInGroup(U,RedSpawn2) then
        set position = GetRectCenter(gg_rct_RedRun1)                  
    elseif IsUnitInGroup(U,TealRun1) then
        set position = GetRectCenter(gg_rct_YellowRun1)         
    elseif IsUnitInGroup(U,TealSpawn1) or IsUnitInGroup(U,TealSpawn2) then
        set position = GetRectCenter(gg_rct_TealRun1)           
    else
        set position = GetRectCenter(gg_rct_EndRuns)
    endif
    if IsCreepAgressive(U) then
        call IssuePointOrderLoc(U,"attack",position)
    else
        call IssuePointOrderLoc(U,"move",position)
    endif 
    call RemoveLocation(position)
 else
    if GetUnitAbilityLevel(U,CHANNELING_SPELLID)==0 then
        //call Stop(u)
        call IssueImmediateOrderById(U,OrderId("stop"))
    endif
 endif
 set position = null
endfunction

struct ReOrderStruct extends General

real timemax = 0
real timedone = 0
unit lanceur = null

method Cycle takes nothing returns boolean
 if this.timedone==this.timemax then
    call ReOrder(this.lanceur)
    call ReOrderStruct.destroy(this)
    return false
 endif
 set this.timedone=this.timedone+1
 return true
endmethod

method onDestroy takes nothing returns nothing
 set this.lanceur = null
endmethod

endstruct

function ReOrderDelayed takes unit Lanceur, real TimeOut returns nothing
 local unit lanceur = Lanceur
 local ReOrderStruct dat = ReOrderStruct.create()
 set dat.lanceur = lanceur
 set dat.timemax = TimeOut
 if TimeOut==0 then
    call STAT_Add(dat)
 else
    call BSG_Add(dat)
 endif
 set lanceur = null
endfunction

STAT_Add ads the struct to a 0 Timer and BSG_Add to a 1 second timer. Even without that function; the unit freeze. That function isn't responsible of my freeze problem.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
watterly, try what I said before. Use the function IssuePointOrder with a string ID rather than IssuePointOrderById with an integer ID. It may be the function that has problems, it wouldn't be the first time.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Pharoah_ said:
It's carrionswarm.

The S2I function looks for a number. I think that if there is no number in the first character then it will always return 0, but it may detect numbers after that though in a string of characters it's always going to return 0. Characters referring to non-numeric values.

watterly, I didn't experience any problems in your test map. The water elements always casted the spell as they were supposed to (when it was cooled down and they were attacking).

Oh, okay, I see. It tends to only happen when the unit auto-attacks.

Okay, fixed the problem. By the way, when you use IssueTargetOrder or IssueTargetOrderById you do not need to check if there is enough mana available since the function will return false if there isn't.

JASS:
public function Attack takes nothing returns nothing
 local unit lanceur = GetAttacker()
 local unit cible = GetTriggerUnit()
 local integer lvl = GetUnitAbilityLevel(lanceur,spellid1) 
    if IssueTargetOrder(lanceur,"carrionswarm",cible) then
        //call ReOrderDelayed(lanceur,1)
    endif   
    call IssueTargetOrder(lanceur,"attack", cible)
 set lanceur = null
 set cible = null
endfunction

When you issue your "carrionswarm" order it automatically orders the unit to stop once it is finished casting but we do not want this. Since the attacker was attacking the target, we want to re-issue the attack order after the unit has casted the appropriate spell. It also doesn't matter whether or not you use IssueTargetOrderById or just IssueTargetOrder in this case.
 
Last edited:
Status
Not open for further replies.
Top