• 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] Help with one problem in a trigger

Status
Not open for further replies.
Level 9
Joined
Jun 25, 2009
Messages
427
Hey guys, so i have this trigger that i don't understand, but i use (it's vjass or jass) so the problem: It's a spell, similar to Sandking's Burrowstrike in DotA (yeah, sorry ;()

The unit tunnels through the ground, impaling the units above and dealing damage.

The problem: the units get damaged while they are still in the air (flying height) and i want them to be damaged when they get down, because when a unit dies in the air, it respawns that way too and is like walking/flying :D

The trigger:

JASS:
scope A initializer A
function Ag takes nothing returns nothing
local trigger t=GetTriggeringTrigger()
local unit u=GetUnit(t,"Target")
local unit s=GetUnit(t,"Source")
local integer r=GetInt(t,"Damage")
local integer i=GetTriggerEvalCount(t)
local real a=350-((i-13)*(i-13))
local unit d
if i<26 then
call SetUnitFlyHeight(u,a,9999)
else
call SetUnitFlyHeight(u,GetUnitDefaultFlyHeight(u),9999)
call PauseUnit(u,false)
set d=CreateUnit(GetOwningPlayer(s),'h00Y',GetUnitX(u),GetUnitY(u),0)
call UnitAddAbility(d,'A0dr')
call IssueTargetOrder(d,"thunderbolt",u)
call Dmg(s,u,r)
call TL(d,1)
call FlushHandle(t)
call DestroyTrigger(t)
endif
set t=null
set u=null
set s=null
set d=null
endfunction
function Af takes unit u returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterTimerEvent(t,0.02,true)
call TriggerAddAction(t,function Ag)
call SetUnit(t,"Target",u)
call SetUnit(t,"Source",Unit)
call SetInt(t,"Damage",Int)
set t=null
endfunction
function Ae takes nothing returns boolean
local unit u=GetFilterUnit()
if IsUnitEnemy(u,GetOwningPlayer(Unit))==true and Alive(u)==true and IsUnitInGroup(u,Grp)==false and IsUnitType(u,UNIT_TYPE_STRUCTURE)==false and IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false then
call GroupAddUnit(Grp,u)
call PauseUnit(u,true)
call UnitAddAbility(u,'Amrf')
call UnitRemoveAbility(u,'Amrf')
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",u,"origin"))
call Af(u)
endif
return false
endfunction
function Ad takes nothing returns nothing
local trigger t=GetTriggeringTrigger()
local unit u=GetUnit(t,"Hero")
local real x=GetReal(t,"X")
local real y=GetReal(t,"Y")
local real a=GetReal(t,"Angle")
local integer max=GetInt(t,"Count")
local integer lvl=GetInt(t,"Level")
local group g=GetGroup(t,"Group")
local group f=CreateGroup()
local integer i=GetTriggerEvalCount(t)
if i>max then
call FlushHandle(t)
call DestroyTrigger(t)
else
set x=x+100*Cos(a*bj_DEGTORAD)
set y=y+100*Sin(a*bj_DEGTORAD)
call SetReal(t,"X",x)
call SetReal(t,"Y",y)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x,y))
call TerrainDeformCrater(x,y,150,-50,160,false)
set Grp=g
set Unit=u
set Int=lvl*60+40
call GroupEnumUnitsInRange(f,x,y,200,Condition(function Ae))
call DestroyGroup(f)
set g=Grp
call SetGroup(t,"Group",g)
endif
set u=null
set t=null
endfunction
function Ac takes nothing returns nothing
local trigger t=GetTriggeringTrigger()
local unit u=GetUnit(t,"Hero")
local real x=GetReal(t,"X")
local real y=GetReal(t,"Y")
call SetUnitPosition(u,x,y)
call SetUnitAnimation(u,"morph ALTERNATE")
call FlushHandle(t)
call DestroyTrigger(t)
set u=null
set t=null
endfunction
function Ab takes nothing returns nothing
local unit u=GetTriggerUnit()
local unit v=GetSpellTargetUnit()
local location l=GetUnitLoc(v)
local trigger t=CreateTrigger()
local real x
local real y
local real d
local real a
local integer i
if v==null then
set l=GetSpellTargetLoc()
endif
set x=GetLocationX(l)
set y=GetLocationY(l)
call RemoveLocation(l)
set a=axy(GetUnitX(u),GetUnitY(u),x,y)
if dxy(GetUnitX(u),GetUnitY(u),x,y)<150 then
set x=x+150*Cos(a*bj_DEGTORAD)
set y=y+150*Sin(a*bj_DEGTORAD)
endif
set d=RMaxBJ(dxy(GetUnitX(u),GetUnitY(u),x,y),150)
call TriggerRegisterTimerEvent(t,d/2000,false)
call TriggerAddAction(t,function Ac)
call SetUnit(t,"Hero",u)
call SetReal(t,"X",x)
call SetReal(t,"Y",y)
set t=CreateTrigger()
call TriggerRegisterTimerEvent(t,0.0625,true)
call TriggerAddAction(t,function Ad)
set i=R2I(d/100)
call SetUnit(t,"Hero",u)
call SetReal(t,"Angle",a)
call SetInt(t,"Count",i)
call SetInt(t,"Level",GetUnitAbilityLevel(u,'A0AT'))
call SetReal(t,"X",GetUnitX(u))
call SetReal(t,"Y",GetUnitY(u))
call SetGroup(t,"Group",CreateGroup())
endfunction
function Aa takes nothing returns boolean
if GetSpellAbilityId() == 'A0AT' then
call Ab()
endif
return false
endfunction
function A takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function Aa))
endfunction
endscope

Would be VERY glad (;

Tiche3
 
Level 9
Joined
Jun 25, 2009
Messages
427
Added the map. Actually, setting flying heights to 0 would be a great idea, will test that one tho :p

Axy and the other one is some functions written in the map script, the part above all trigger folders.

EDIT: Yeah, the Maker's solution works :) thanks. Must spread some around ;(
 

Attachments

  • sandking.w3x
    52.9 KB · Views: 40
Level 2
Joined
Dec 28, 2010
Messages
21
The problem: the units get damaged while they are still in the air (flying height) and i want them to be damaged when they get down
haha,i found the code..
JASS:
function Ag takes nothing returns nothing
local trigger t=GetTriggeringTrigger()
local unit u=GetUnit(t,"Target")
local unit s=GetUnit(t,"Source")
local integer r=GetInt(t,"Damage")
local integer i=GetTriggerEvalCount(t)
local real a=350-((i-13)*(i-13))
local unit d
if i<26 then
[COLOR="Red"]call SetUnitFlyHeight(u,a,9999)[/COLOR]else
[COLOR="Red"]call SetUnitFlyHeight(u,GetUnitDefaultFlyHeight(u),9999)[/COLOR]
call PauseUnit(u,false)
set d=CreateUnit(GetOwningPlayer(s),'h001',GetUnitX(u),GetUnitY(u),0)
call UnitAddAbility(d,'A0A0')
call IssueTargetOrder(d,"thunderbolt",u)
[COLOR="red"]call Dmg(s,u,r)[/COLOR]
call TL(d,1)
call FlushHandle(t)
call DestroyTrigger(t)
endif
set t=null
set u=null
set s=null
set d=null
endfunction
there he sets the flying height
JASS:
function Dmg takes unit u,unit a,real r returns boolean
return UnitDamageTarget(u,a,r,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction
there he sets the damage,so i propose that you can call Dmg(s,u,r) after the target object lands down on the ground
 
Status
Not open for further replies.
Top