| 05-15-2006, 11:39 PM | #1 |
I have been able to get the ability to work normally, except it wont deal damage. Here is what I have defined for the damage fields. JASS:constant function RagingCharge_Damage takes real level returns real local real ReturnCount if (level==1) then set ReturnCount = 75.0 endif if (level==2) then set ReturnCount = 130.0 endif if (level==3) then set ReturnCount = 200.0 endif if (level==4) then set ReturnCount = 270.0 endif if (level==5) then set ReturnCount = 340.0 endif if (level==6) then set ReturnCount = 600.0 endif return ReturnCount endfunction constant function RagingCharge_DamagePerSecond takes real level returns real return 0. endfunction constant function RagingCharge_ImpactRange takes integer level returns integer return 115+10*level endfunction constant function RagingCharge_FrontAngle takes real level returns real return 179.0 endfunction |
| 05-16-2006, 02:18 AM | #2 |
why you didn't make it a formula? It could be that it does not do damage on impact anymore, or it could be something with damage options, Please post the Damage Options as well |
| 05-21-2006, 06:11 PM | #3 |
Sorry for the long wait, I was out of town. Anyhow, here is the whole trigger. JASS:// RagingCharge Spell Configuration: // // //// // SpellId // ¯¯¯¯¯¯¯ // Make sure to replace A05R with the correct Rawcode in your map. // constant function RagingCharge_SpellId takes nothing returns integer return 'A05R' endfunction //// // Animation Stuff: // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // _AnimationIndex : The sequence index of the animation you want to be played during the charge, // (Depends on the model used, see next trigger for more info) // _AnimationDuration: Duration of the animation (Period of time before playing it again) // _AnimationSpeed : Speed factor for the animation // constant function RagingCharge_AnimationIndex takes integer level returns integer return 3 endfunction constant function RagingCharge_AnimationDuration takes integer level returns real return 0.466 endfunction constant function RagingCharge_AnimationSpeed takes real level returns real return 1.+level*0 endfunction constant function RagingCharge_Speed takes real level returns real return 800.0+level*0 endfunction //// // Balance Stuff: // ¯¯¯¯¯¯¯¯¯¯¯¯¯ // _Damage : Damage done to units that are hit by RagingCharge // _DamagePerSecond : Damage per second units get during knockback // _ImpactRange : How close must a unit be to be hit by RagingCharge? // _FrontAngle : Angle in Deg, less than 180.0 that determines the front of the hero // constant function RagingCharge_Damage takes real level returns real local real ReturnCount if (level==1) then set ReturnCount = 75.0 endif if (level==2) then set ReturnCount = 130.0 endif if (level==3) then set ReturnCount = 200.0 endif if (level==4) then set ReturnCount = 270.0 endif if (level==5) then set ReturnCount = 340.0 endif if (level==6) then set ReturnCount = 600.0 endif return ReturnCount endfunction constant function RagingCharge_DamagePerSecond takes real level returns real return 0. endfunction constant function RagingCharge_ImpactRange takes integer level returns integer return 115+10*level endfunction constant function RagingCharge_FrontAngle takes real level returns real return 179.0 endfunction //// // Targetting options: // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ function RagingCharge_DamageOptions takes integer level returns integer //** Damage options for impact damage: return DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE) + DamageOnlyEnemies() + DamageException(UNIT_TYPE_FLYING,0) // // Will do fire spell damage, won't damage allies, and will only affect ground units. // other damage options can be used, check caster system readme for more information. // // (This is for the Impact damage) // endfunction function RagingCharge_KnockbackOptions takes integer level returns integer //** Damage options for knockback: return DamageOnlyEnemies() + DamageException(UNIT_TYPE_FLYING,0) // // Will knockback enemy ground units // other damage options can be used, check caster system readme for more information. // // (This is for the Knockback, meaning that only in case these damage options determine an unit is // immune, it won't be affected by the knockback, this has nothing to do with damage // endfunction function RagingCharge_KillTrees takes integer level returns boolean //** true == kill trees ; false == don't kill trees return true endfunction //// // Other: // ¯¯¯¯¯ constant function RagingCharge_Timer takes nothing returns real //** Timer Period: return 0.04 // // This is the timer period, a low value (0.01) will look better but will be worse lag-wise, a high // value (1.0) would be faster lag-wise but will surelly look bad. I think 0.04 is the perfect value. endfunction //======================================================================================================== // RagingCharge code: // // Why RagingCharge_ItemCheck instead of IsTerrainPathable? // IsTerrainPathable doesn't consider pathing blockers, destructables nor buildings // function RagingCharge_GetI takes nothing returns nothing set bj_rescueChangeColorUnit = bj_rescueChangeColorUnit or (GetEnumItem()!=bj_itemRandomCurrentPick) endfunction function RagingCharge_ItemCheck takes item p, real x, real y returns boolean local integer i=30 local rect r call SetItemPosition(p,x,y) if ((Pow(GetItemX(p)-x,2)+Pow(GetItemY(p)-y,2))<=100) then return true endif set r=Rect(x-i,y-i,x+i,y+i) set bj_itemRandomCurrentPick=p set bj_rescueChangeColorUnit=false call EnumItemsInRect(r,null,function RagingCharge_GetI) call RemoveRect(r) set r=null return bj_rescueChangeColorUnit endfunction function RagingCharge_CheckPathability takes real x, real y returns boolean local item it=CreateItem('ciri',x,y) local boolean b =RagingCharge_ItemCheck(it,x,y) call SetItemVisible(it,false) call RemoveItem(it) set it=null return b endfunction function RagingCharge_OrbMov takes unit m,integer l, timer t,group g,string k returns boolean local real x=GetUnitX(m) local real y=GetUnitY(m) local real f=GetTableReal(k,"f") local real d=RagingCharge_Speed(l)*RagingCharge_Timer() local real nx=x+d*CosBJ(f) local real ny=y+d*SinBJ(f) local boolean b local integer error local integer n =GetAttachedInt(m,"times")+1 local real nex call AttachInt(m,"times",n) call SetUnitFacing(m,f) set nex=GetTableReal(k,"next") if (n * RagingCharge_Timer() >= nex) then call SetTableReal(k,"next",nex+RagingCharge_AnimationDuration(l)) call SetUnitAnimationByIndex(m,RagingCharge_AnimationIndex(l)) endif if ((RagingCharge_CheckPathability(nx,ny)) and (CS_MoveUnit(m,nx,ny))) then return true endif call SetUnitPosition(m,x,y) call TriggerEvaluate(GetTableTrigger(k,"endT")) return false endfunction function RagingCharge_Mov takes nothing returns nothing local timer t=GetExpiredTimer() local string k=I2S(GetTableInt("[RagingCharge]",GetAttachmentTable(t))) local group g=GetTableGroup(k,"g") local group a local unit m local unit o local unit u local real f local real h local real dir local real inc local real x local real y local real nx local real ny local real px local real py local real mina local real maxa local integer tms local integer l=GetTableInt(k,"l") local integer num=GetTableInt(k,"num")+1 local trigger tg=GetTableTrigger(k,"endT") if (GetTriggerEvalCount(tg)>0) then loop set m=FirstOfGroup(g) exitwhen m==null call GroupRemoveUnit(g,m) call DestroyEffect( GetTableEffect(k,GetAttachmentTable(m))) endloop call DestroyGroup(g) set tg=GetTableTrigger(k,"ran") call TriggerRemoveAction(tg,GetTableTriggerAction(k,"ac")) call DestroyTrigger(tg) call DestroyTimer(t) set m=GetTableUnit(k,"u") call DestroyEffect(GetTableEffect(k,"fx")) call QueueUnitAnimation(m,GetAbilityEffectById(RagingCharge_SpellId(),EFFECT_TYPE_CASTER,0)) call SetUnitTimeScale(m,1) call DestroyTable(k) set num=GetTableInt("[RagingCharge]","N") if (num<=1) then call ClearTable("[RagingCharge]") else call SetTableInt("[RagingCharge]","N",num-1) endif set t=null set g=null set a=null set m=null return endif set tg=null call SetTableInt(k,"num",num) set o=GetTableUnit(k,"u") set u=GetTableUnit(k,"o") set x=GetUnitX(o) set y=GetUnitY(o) set a=CreateGroup() set inc=RagingCharge_Speed(l)*RagingCharge_Timer() if (RagingCharge_KillTrees(l)) then call DamageTreesInCircle(x,y,RagingCharge_ImpactRange(l)) endif set h=RagingCharge_DamagePerSecond(l)*RagingCharge_Timer() loop set m=FirstOfGroup(g) exitwhen (m==null) set nx=GetUnitX(m) set ny=GetUnitY(m) if (IsUnitInRange(m,o,RagingCharge_ImpactRange(l))) and (GetWidgetLife(m)>0) then call DamageUnitByOptions(u,m,h,RagingCharge_DamageOptions(l)) set f=Atan2(ny-y,nx-x) set px=nx+inc*Cos(f) set py=ny+inc*Sin(f) call SetUnitPosition(m,px,py) call SetUnitFacing(m,GetRandomReal(0,360)) if (Pow(GetUnitX(m)-px,2)+Pow(GetUnitY(m)-py,2))>400 then call SetUnitPosition(m,nx,ny) endif call GroupAddUnit(a,m) else call DestroyEffect( GetTableEffect(k, GetAttachmentTable(m) )) endif call GroupRemoveUnit(g,m) endloop loop set m=FirstOfGroup(a) exitwhen m==null call GroupAddUnit(g,m) call GroupRemoveUnit(a,m) endloop call RagingCharge_OrbMov(o,l,t,g,k) call DestroyGroup(a) set t=null set g=null set a=null set m=null endfunction function RagingCharge_OrbImpact takes nothing returns nothing local string k=I2S(GetTableInt("[RagingCharge]",GetAttachmentTable(GetTriggeringTrigger()))) local unit u=GetTriggerUnit() local unit m=GetTableUnit(k,"u") local group g=GetTableGroup(k,"g") local integer l=GetTableInt(k,"l") local real f local real dt local integer s=RagingCharge_SpellId() local integer i=0 if not(IsUnitInGroup(u,g)) and (GetWidgetLife(u)>0) and not(IsUnitType(u,UNIT_TYPE_DEAD)) and not(IsUnitType(u,UNIT_TYPE_STRUCTURE)) then set f=GetTableReal(k,"f") set dt=RagingCharge_FrontAngle(l)/2 if (Angles_IsAngleBetweenAngles( Atan2BJ(GetUnitY(u)-GetUnitY(m),GetUnitX(u)-GetUnitX(m)),f-dt,f+dt)) then if (GetDamageFactorByOptions(m,u,RagingCharge_KnockbackOptions(l))!=0) then call DestroyEffect( AddSpellEffectTargetById(s,EFFECT_TYPE_TARGET,u,GetAbilityEffectById(s,EFFECT_TYPE_TARGET,1)) ) call SetTableObject(k,GetAttachmentTable(u),AddSpellEffectTargetById(s,EFFECT_TYPE_AREA_EFFECT,u,GetAbilityEffectById(s,EFFECT_TYPE_AREA_EFFECT,1))) call GroupAddUnit(g,u) endif endif call DamageUnitByOptions(m,u,RagingCharge_Damage(l),RagingCharge_DamageOptions(l)) endif set u=null set m=null set g=null endfunction function RagingCharge_Actions takes nothing returns nothing local unit u=GetTriggerUnit() local integer s=GetSpellAbilityId() local integer l=GetUnitAbilityLevel(u,s) local location loc local real x=GetUnitX(u) local real y=GetUnitY(u) local real f local timer t=CreateTimer() local group g=CreateGroup() local trigger tg=CreateTrigger() local integer ki=NewTableIndex() local string data=I2S(ki) call SetTableObject(data,"ac",TriggerAddAction(tg,function RagingCharge_OrbImpact)) call SetTableInt("[RagingCharge]",GetAttachmentTable(t),ki) call SetTableInt("[RagingCharge]",GetAttachmentTable(tg),ki) call SetTableInt("[RagingCharge]","N",GetTableInt("[RagingCharge]","N")+1) if (GetSpellTargetUnit()!=null) then set loc=GetUnitLoc(GetSpellTargetUnit()) else set loc=GetSpellTargetLoc() endif set f=Atan2BJ(GetLocationY(loc)-y,GetLocationX(loc)-x) call RemoveLocation(loc) call SetTableInt(data,"l",l) call SetTableReal(data,"dir",ModuloReal(-f,360)) call SetTableReal(data,"f",f) call SetTableObject(data,"u",u) call SetTableObject(data,"g",g) call SetTableObject(data,"ran",tg) call TriggerRegisterUnitInRange(tg,u,RagingCharge_ImpactRange(l),null) call SetTableObject(data,"fx",AddSpellEffectTargetById(s,EFFECT_TYPE_SPECIAL,u,GetAbilityEffectById(s,EFFECT_TYPE_SPECIAL,1))) set tg=CreateTrigger() call TriggerRegisterUnitEvent(tg,u,EVENT_UNIT_SPELL_ENDCAST) call SetTableObject(data,"endT",tg) call TimerStart(t,RagingCharge_Timer(),true,function RagingCharge_Mov) call SetUnitTimeScale(u,RagingCharge_AnimationSpeed(l)) call SetUnitAnimationByIndex(u,RagingCharge_AnimationIndex(l)) set tg=null set u=null set loc=null set t=null set g=null endfunction function InitTrig_RagingCharge takes nothing returns nothing local integer s=RagingCharge_SpellId() call OnAbilityEffect(s,"RagingCharge_Actions" ) call Preload(GetAbilityEffectById(s,EFFECT_TYPE_SPECIAL,0)) call Preload(GetAbilityEffectById(s,EFFECT_TYPE_TARGET,0)) call Preload(GetAbilityEffectById(s,EFFECT_TYPE_AREA_EFFECT,0)) endfunction Btw, I didn't use a formula because my increments are not in a pattern. |
| 05-21-2006, 06:31 PM | #4 |
this is weird, tried setting local real ReturnCount=45.0 so it has a default? it could be a problem in the comparissions I am gonna test things myself anyways |
| 05-22-2006, 01:23 AM | #5 |
Thanks. :-) Oh, another problem, I use WE Unlimited. This causes the load time to be gigantic, I wish to remove code not used in the pre-load code. When I removed unused code, I found many errors :-(. Not sure how to do this... maybe, at a later point you could also help me with that. |
| 05-25-2006, 05:16 PM | #6 |
I tried in my map and it was doing good damage, are you sure the units you are hitting aren't immune to magic? |
| 05-25-2006, 05:50 PM | #7 |
Positive |
| 05-25-2006, 10:00 PM | #8 |
does changing that line to local real ReturnCount = 10000.0 kill all units hit? if not then I guess I am gonna need your map |
