The Particle System?

Reaction score
456
That tutorial is quite confusing, and I'm not very sure if the granade even works..

Vector System -tutorial would be cool :p
 

Chocobo

White-Flower
Reaction score
409
That tutorial is quite confusing, and I'm not very sure if the granade even works..

Vector System -tutorial would be cool :p

Why not testing?

If it doesn't work, this has 100% chance to work :

Code:
function MakeUnitFlyable takes unit u returns nothing
call UnitAddAbility(u,'Amrf')
call UnitRemoveAbility(u,'Amrf')
endfunction

function DestroyEffectTimed takes effect eff,real duration returns nothing
call PolledWait(duration)
call DestroyEffect(eff)
endfunction

function DamageArea takes unit source,real maxdmg,integer damageV,real radius returns nothing
local integer i=0
local integer originV
local real array r
local group g=CreateGroup()
local unit c
call GroupEnumUnitsInRange(g,udg_vectorX[damageV],udg_vectorY[damageV],radius,null)
loop
set c=FirstOfGroup(g)
exitwhen c==null
if GetUnitState(c,UNIT_STATE_LIFE)>0 then
set r[0]=GetUnitX(c)
set r[1]=GetUnitY(c)
set r[2]=GetZ(r[0],r[1])
set originV=VectorCreate(r[0],r[1],r[2])
if IsPointInSphere(originV,damageV,radius) then
call VectorSubtract(originV,damageV)
set r[5]=(radius-VectorGetLength(originV))/radius*maxdmg
call UnitDamageTarget(source,c,r[5],true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
call VectorDestroy(originV)
endif
call GroupRemoveUnit(g,c)
endloop
call DestroyGroup(g)
set g=null
set c=null
endfunction

function CreateExplosion takes player p,string path,real x,real y,real z,real facing,real size,real time returns nothing
local unit u=CreateUnit(p,'e001',x,y,facing)
local effect e
call SetUnitX(u,x)
call SetUnitY(u,y)
call MakeUnitFlyable(u)
call SetUnitAnimationByIndex(u,90)
call SetUnitScale(u,size,size,size)
call SetUnitFlyHeight(u,z-GetZ(x,y),0)
if time==0 then
call DestroyEffect(AddSpecialEffectTarget(path,u,"origin"))
else
set e=AddSpecialEffectTarget(path,u,"origin")
endif
call KillUnit(u)
set u=null
if time>0 then
call DestroyEffectTimed(e,time)
endif
set e=null
endfunction

function Death_ExplodeNade takes nothing returns nothing
local unit u=GetEnumUnit()
local integer p=udg_clsParticlePlace[GetUnitUserData(u)]
call CreateExplosion(GetOwningPlayer(u),"Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",udg_vectorX[p],udg_vectorY[p],udg_vectorZ[p],GetRandomReal(0,360),1.,5.)
call CreateExplosion(GetOwningPlayer(u),"Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl",udg_vectorX[p],udg_vectorY[p],udg_vectorZ[p],GetRandomReal(0,360),3.,0)
call DamageArea(u,275,p,256.)
call RemoveParticle(u,true)
set u=null
endfunction

function Trig_Grenade_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A001'
endfunction
function Trig_Grenade_Actions takes nothing returns nothing
local unit h=GetSpellAbilityUnit()
local location l=GetSpellTargetLoc()
local real x=GetLocationX(l)-GetUnitX(h)
local real y=GetLocationY(l)-GetUnitY(h)
local real a=Atan2BJ(y,x)
local real aoa
local unit u=CreateParticle(GetOwningPlayer(h),'e000',GetUnitX(h),GetUnitY(h),a)
local real array r
local integer i=udg_clsParticlePlace[GetUnitUserData(u)]
set udg_vectorX[i]=udg_vectorX[i]-udg_vectorX[SpawnPlaceOffset()]*CosBJ(a)
set udg_vectorY[i]=udg_vectorY[i]-udg_vectorY[SpawnPlaceOffset()]*SinBJ(a)
set udg_vectorZ[i]=udg_vectorZ[i]-udg_vectorZ[SpawnPlaceOffset()]+1
set r[2]=750
set r[0]=RMinBJ(r[2],SquareRoot(x*x+y*y))
set r[1]=SquareRoot(r[2]*VectorGetLength(G()))
set aoa=(bj_PI/2)-(Asin((r[0]*VectorGetLength(G()))/(r[1]*r[1]))/2)
call SetUnitTimeScalePercent(u,10.00)
call ParticleSetSpeed(u,Cos(aoa)*CosBJ(a)*r[1],Cos(aoa)*SinBJ(a)*r[1],r[1]*Sin(aoa))
call ParticleAddForce(u,G())
call ParticleLinkConditionTrigger2Func(u,ParticleGroundHit(),"GroundHit_Bounce")
call ParticleLinkConditionTrigger2Func(u,ParticleDeath(),"Death_ExplodeNade")
call UnitApplyTimedLife(u,'BTLF',2.)
set l=null
set h=null
set u=null
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top