• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Group code

Status
Not open for further replies.
Level 7
Joined
Dec 20, 2007
Messages
151
Well i have made a spell but on group thing

i can't make it work the
JASS:
IsUnitAliveBJ(wichUnit) = true

i tried almost everything i knew like :
JASS:
GetUnitState(wich unit , Unit_State_Life) <0 ==true
still don't work 2day found another :
JASS:
GetWidgetLife(wichunit) < 0.403 == true
but still don't work and the spell is a knockback group from arround the caster

so i'm asking you the pro of the warcraft 3 edits and trigger makers wich code will work for sure please help me

~~SOLVED~~
 
Last edited:
Level 7
Joined
Dec 20, 2007
Messages
151
i've tryed and still knockback the skeletons from the ground and i don't want that because starts to lag .. here is the group function:
JASS:
function AKgl takes nothing returns nothing
local hashtable table = udg_table
local integer h = udg_i
local unit q = LoadUnitHandle(table,h,1)
local unit q2 = GetEnumUnit ()
local real w11 = LoadReal(table,h,2)
local real w12 = LoadReal(table,h,3)
local real w21 = GetUnitX(q2)
local real w22 = GetUnitY(q2)
local group t2 = LoadGroupHandle(table,h,6)
local real w = bj_RADTODEG * Atan2(w22 - w12, w21 - w11)
local real w31
local real w32


if IsUnitEnemy(q2,GetOwningPlayer(q)) == true then
set w31 = w21 + 35 * Cos(w * bj_DEGTORAD)
set w32 = w22 + 35 * Sin(w * bj_DEGTORAD)

call SetUnitPosition(q2,w31,w32)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",w21,w22))


endif

if GetWidgetLife(q2) < 0.405 == true and IsUnitType(q2, UNIT_TYPE_MAGIC_IMMUNE) == false and  IsUnitEnemy(q2, GetOwningPlayer(q)) == true and IsUnitInGroup(q2, t2) == false then
call UnitDamageTarget(q,q2,75,true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,null)
call GroupAddUnit(t2,q2)

endif

set table = null
set q = null
set q2 = null
set t2 = null




endfunction
 
To check if a unit is alive, the only fool-proof way to
do it without the UnitAlive native is:

JASS:
return not IsUnitType(u, UNIT_TYPE_DEAD) and GetUnitTypeId(u) != 0

This makes up for Blizzard's failure in providing us
with a UNIT_TYPE_ALIVE, because UNIT_TYPE_DEAD
will return false for removed units because removed
units do not have a type.
 
Status
Not open for further replies.
Top