uhm I don't think you could use the aquisation range, because it's only the range within the tower notices the units.. so the AR could be 800 and the tower notices units within the range of 800 but if he has an attackrange of 600 he can't attack but he would lock some units, maybe some with low HP or something else.. so it would create a bigger circle than the tower has for its attack (maybe, normally it's set higher than attackrange) so how about using a variable "TowerRange" and make it an array.. then just add it to some tower types, like Canon Tower, or Ice Tower whatever you're using.. and set the range for it.. e.g. CanonTower will be "TowerRange[1]" = 700, and then use a trigger that creates a unit, maybe some shiny thingy around the tower with the range of "TowerRange[1]" you need so do some maths for the degree numbers.. but that's it
normally it is, and i said normally, sure you can set it to the same range as the attackrange, but mostly it has more range, so that the tower can attack the best unit..
however there are some ways to do it =)
so if you use aquisation range set it to attackrange (but I don't suggest it)
//This will create an effect circle around your towers who's radius is equal to their acquisition range.
//which you should set equal to their attack range (in the object editor)
function EffectString takes nothing returns string
return "Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl"
//Replace Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl with the path of your desired effect.
//you MUST use two forward slashes instead of one or it will not work.
endfunction
function Delay takes nothing returns real
return 1.0
//Replace 1.0 with your desired delay for the effect to disapear after a player deselects the unit..
//Don't go too low with this. 0.1 at the lowest.
endfunction
function Towers takes unit u returns boolean
//Copy and paste this if statement and change the rawcode for every tower you want this to work for.
if GetUnitTypeId(u) == 'n000' then
return true
endif
return false
endfunction
//===========================================================================
function SelectTowerConditions takes nothing returns boolean
return Towers(GetTriggerUnit())
endfunction
function AddSpecialEffectPlayer takes player p, string modelName, real x, real y returns effect
if GetLocalPlayer() == p then
return AddSpecialEffect(modelName, x, y)
endif
return null
endfunction
function SelectTowerActions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit tower = GetTriggerUnit()
local real range = GetUnitDefaultAcquireRange(GetTriggerUnit())
local integer amount = R2I(range/1.5)
local real angle = 0.0
local real increment = 360.0/25
local real x = GetUnitX(tower)
local real y = GetUnitY(tower)
local real x2
local real y2
local effect array e
local integer i = 0
local integer i2 = 0
loop
set x2 = x+range*Cos(angle*bj_DEGTORAD)
set y2 = y+range*Sin(angle*bj_DEGTORAD)
set e[i] = AddSpecialEffectPlayer(p, EffectString(), x2, y2)
set angle = angle + increment
set i = i+1
exitwhen i == amount
endloop
loop
exitwhen GetWidgetLife(tower) < 0.2 or IsUnitSelected(tower, p) == false
call TriggerSleepAction(Delay())
endloop
loop
call DestroyEffect(e[i2])
set e[i2] = null
set i2 = i2+1
exitwhen i2 == i+1
endloop
endfunction
//===========================================================================
function InitTrig_SelectTower takes nothing returns nothing
set gg_trg_SelectTower = CreateTrigger()
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(0), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(1), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(2), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(3), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(4), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(5), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(6), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(7), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(8), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(9), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(10), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(11), true)
call TriggerAddCondition(gg_trg_SelectTower, Condition(function SelectTowerConditions))
call TriggerAddAction(gg_trg_SelectTower, function SelectTowerActions)
endfunction
//This will create an effect circle around your towers who's radius is equal to their acquisition range.
//which you should set equal to their attack range (in the object editor)
function EffectString takes nothing returns string
return "Doodads\\Cityscape\\Props\\MagicRunes\\MagicRunes"
//Replace Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl with the path of your desired effect.
//you MUST use two forward slashes instead of one or it will not work.
endfunction
function Delay takes nothing returns real
return 0.2
//Replace 1.0 with your desired delay for the effect to disapear after a player deselects the unit..
//Don't go too low with this. 0.1 at the lowest.
endfunction
function Towers takes unit u returns boolean
//Copy and paste this if statement and change the rawcode for every tower you want this to work for.
if GetUnitTypeId(u) == 'h009' then
return true
endif
return false
endfunction
//===========================================================================
function SelectTowerConditions takes nothing returns boolean
return Towers(GetTriggerUnit())
endfunction
function AddSpecialEffectPlayer takes player p, string modelName, real x, real y returns effect
if GetLocalPlayer() == p then
return AddSpecialEffect(modelName, x, y)
endif
return null
endfunction
function SelectTowerActions takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit tower = GetTriggerUnit()
local real range = GetUnitDefaultAcquireRange(GetTriggerUnit())
local integer amount = R2I(range/1.5)
local real angle = 0.0
local real increment = 360.0/25
local real x = GetUnitX(tower)
local real y = GetUnitY(tower)
local real x2
local real y2
local effect array e
local integer i = 0
local integer i2 = 0
loop
set x2 = x+range*Cos(angle*bj_DEGTORAD)
set y2 = y+range*Sin(angle*bj_DEGTORAD)
set e[i] = AddSpecialEffectPlayer(p, EffectString(), x2, y2)
set angle = angle + increment
set i = i+1
exitwhen i == amount
endloop
loop
exitwhen GetWidgetLife(tower) < 0.2 or IsUnitSelected(tower, p) == false
call TriggerSleepAction(Delay())
endloop
loop
call DestroyEffect(e[i2])
set e[i2] = null
set i2 = i2+1
exitwhen i2 == i+1
endloop
endfunction
//===========================================================================
function InitTrig_SelectTower takes nothing returns nothing
set gg_trg_SelectTower = CreateTrigger()
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(0), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(1), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(2), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(3), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(4), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(5), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(6), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(7), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(8), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(9), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(10), true)
call TriggerRegisterPlayerSelectionEventBJ(gg_trg_SelectTower, Player(11), true)
call TriggerAddCondition(gg_trg_SelectTower, Condition(function SelectTowerConditions))
call TriggerAddAction(gg_trg_SelectTower, function SelectTowerActions)
endfunction
return "Doodads\\Cityscape\\Props\\MagicRunes\\MagicRunes"
return "Doodads\\Cityscape\\Props\\MagicRunes\\MagicRunes.mdl"
local integer amount = R2I(range/1.5)
local real angle = 0.0
local real increment = 360.0/25
local integer amount = R2I(range/10)
local real angle = 0.0
local real increment = 360.0/(R2I(range/12))
//Lvl 1 Archer Tower
if GetUnitTypeId(u) == 'h00I' then
return true
endif
return false
//Lvl 2 Archer Tower
if GetUnitTypeId(u) == 'h00A' then
return true
endif
return false
//Lvl 3 Archer Tower
if GetUnitTypeId(u) == 'h00B' then
return true
endif
return false
//Lvl 4 Archer Tower
if GetUnitTypeId(u) == 'h00C' then
return true
endif
return false
GetWidgetLife(tower) < 0.2
- that's an interesting number. Haven't seen it used before for such a purpose.JASS:function AddSpecialEffectPlayer takes player p, string modelName, real x, real y returns effect if GetLocalPlayer() == p then return AddSpecialEffect(modelName, x, y) endif return null endfunction
I'd be interested in knowing why you say this as well.JASS://Don't go too low with this. 0.1 is the lowest.
I was referring to Maxamilianx's code.PurplePoot, I don't see what your post means..
EDIT: Thanks toofless +rep
Waits are actually pretty slow, so no. It can't even happen fast enough for you to notice a speed drop. In fact, even a timer running at maximum speed is pretty unnoticeable by itself.0.1 because it's used as a sleep action in a loop, and you wouldn't want the check to be happening a gazillion times in any given fraction of a second..
.405, but you shouldn't care. Units that are dead have 0 life unless you are silly enough to change it.used 0.2 hp because i heard somewhere that a unit is dead when it's hitpoints reach somewhere around 0.2, don't remember the exact number, but this is what I use instead of isunitalive.. and it works just fine.
Yes, as they offset the heap for certain players only.and are you sure localized effects cause desyncs?
With reason.And they say there are no benefits of GUI over JASS...
Depends on the handle. Some (like texttags) are pseudohandles. Others, you can't - keep in mind there is a difference between creating a handle and displaying it.and why would local effects cause desyncs when you can add things like weather, texttags, change multiboard items etc. without a desync?
Is it stupid when that line kicks every other player in your game because it's badly thought out?lol you guys are arguing over the stupidest things..
I think it's supposed to be funny. At least, that's what they say.Offtopic: Why are all the icons all messed up? it shows like a hammer for all the icons on the forums..