| 10-17-2006, 07:48 PM | #1 |
Ok this spell does damage dependant on the level and moves the unit back for a certain length dependant on the level also. I used Blade.Dk s tutorial to help me with this trigger. I'm discovering a few difficulties: JASS:function InitTrig_InitCache takes nothing returns nothing call FlushGameCache(InitGameCache("abilitycache.w3v")) set udg_AbilityCache = InitGameCache("abilitycache.w3v") endfunction Main Trigger: JASS:function Shock_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'ANab' endfunction function Shock_Move takes nothing returns nothing local string s = I2S(H2I(GetExpiredTimer()) local gamecacher gc = udg_AbilityCache local real x = GetStoredReal(gc,s,"x") local real y = GetStoredReal(gc,s,"y") local integer i = GetStoredInteger(gc,s,"level") local unit t = GetStoredUnit(gc,s,"target") local real p = GetStoredReal(gc,s,"speed")-0.5/(1+0.5*i) local real a local real ux local real uy local real dur = GetStoredReal(gc,s,"dur")+0.05 local real fx = GetStoredReal(gc,s,"fx")+0.05 if dur<0.75*i then set ux= GetUnitX(t) set uy = GetUnitY(t) set a = Atan2(uy-y,ux-x) call SetUnitPosition(f,ux+p*Cos(a),uy+p*Sin(a) if fx>=1 then call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",t,"origins")) endif call StoreReal(gc,s,"dur",dur) call StoreReal(gc,s,"speed",p) call StoreReal(gc,s,"fx",fx) if fx>=1 then call StoreReal(gc,s,"fx",0) endif endif endfunction function Shock_Actions takes nothing returns nothing local unit c = GetTriggerUnit() local unit t = GetSpellTargetUnit() local real x = GetUnitX(c) local real y = GetUnitY(c) local integer i = GetUnitAbilityLevel(c, 'ANab') local gamecache gc = udg_AbilityCache local timer t = CreateTimer() local string s = I2S(H2I(t)) call UnitDamageTarget(c,f,100*i,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null) call StoreInteger(gc,s,"level",i) call StoreInteger(gc,s,"group",H2I(g)) call StoreReal(gc,s,"x",GetUnitX(GetSpellTargetUnit())) call StoreReal(gc,s,"y",GetUnitY(GetSpellTargetUnit())) call StoreReal(gc,s,"speed",50) call StoreUnit(gc,s,"target",GetSpellTargetUnit()) call TimerStart(t,0.05,true,function Stomp_Move) set c = null set t = null set g = null set gc=null endfunction function InitTrig_Shock takes nothing returns nothing set gg_trg_Shock = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Shock, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Shock, Condition( function Shock_Conditions ) ) call TriggerAddAction( gg_trg_Shock, function Shock_Actions ) call Preload("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl") endfunction Are there any memory leaks etc. or any reasons it shouldn't work and how would a JESP spell differ from how that is written, I've read all the stuff about it and I can't work out what I need to do to make it JESP. |
| 10-17-2006, 07:51 PM | #2 | |
Quote:
Your line has a problem: call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",t,"origins")) Change "origins" to "origin". Im to tired to look for anything else, maybe tomorrow for me.. |
| 10-17-2006, 08:14 PM | #3 |
I THINK, not sure, but isn't it spelled "gamecache", not "gamecacher"? EDIT: I think that because of the way I think it's spelled, and because it's not in "blue" (unlike all the other variables). |
| 10-17-2006, 09:20 PM | #4 | |
Quote:
Yea, Anopob is right, its not turned blue and boldish by Wc3c's colour syntax, so its not right, as a variable type. As he said, its "gamecache" and not "gamecacher". |
| 10-18-2006, 01:28 PM | #5 |
Changed the Cache Trigger to: JASS:function InitTrig_InitCache takes nothing returns nothing call InitGameCacheBJ( "AbilityCache.w3v" ) set udg_Ability_Cache = InitGameCacheBJ("AbilityCache.w3v") endfunction Now the trigger is accepted but i need to test it. Edit: Ok..it hates me This is the trigger: JASS:function Shock_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' endfunction function H2I takes handle h returns integer return h return 0 endfunction function G2I takes group g returns integer return g return 0 endfunction function I2G takes integer i returns group return i return null endfunction function Shock_Move takes nothing returns nothing local string s = I2S(H2I(GetExpiredTimer())) local gamecache gc = udg_Ability_Cache local real x = GetStoredReal(gc,s,"x") local real y = GetStoredReal(gc,s,"y") local integer i = GetStoredInteger(gc,s,"level") local unit t = GetSpellTargetUnit() local real p = GetStoredReal(gc,s,"speed")-0.5/(1+0.5*i) local real a local real ux local real uy local real dur = GetStoredReal(gc,s,"dur")+0.05 local real fx = GetStoredReal(gc,s,"fx")+0.05 if dur<0.75*i then set ux= GetUnitX(t) set uy = GetUnitY(t) set a = Atan2(uy-y,ux-x) call SetUnitPosition(t,ux+p*Cos(a),uy+p*Sin(a)) if fx>=1 then call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",t,"origin")) endif call StoreReal(gc,s,"dur",dur) call StoreReal(gc,s,"speed",p) call StoreReal(gc,s,"fx",fx) if fx>=1 then call StoreReal(gc,s,"fx",0) endif endif if not(t==null) then call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_021" ) endif endfunction function Shock_Actions takes nothing returns nothing local unit c = GetTriggerUnit() local unit t = GetSpellTargetUnit() local real x = GetUnitX(c) local real y = GetUnitY(c) local integer i = GetUnitAbilityLevel(c, 'A000') local gamecache gc = udg_Ability_Cache local timer time = CreateTimer() local string s = I2S(H2I(t)) local group g call UnitDamageTarget(c,t,100*i,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null) call GroupAddUnit(g,t) call StoreInteger(gc,s,"level",i) call StoreReal(gc,s,"x",GetUnitX(GetSpellTargetUnit())) call StoreReal(gc,s,"y",GetUnitY(GetSpellTargetUnit())) call StoreReal(gc,s,"speed",50) call StoreUnit(gc,s,"target",GetSpellTargetUnit()) call StoreInteger(gc,s,"group",G2I(g)) call TimerStart(time,0.05,true,function Shock_Move) set c = null set t = null set gc=null call DestroyGroup(g) set g=null endfunction //=========================================================================== function InitTrig_Shock takes nothing returns nothing local trigger gg_trg_Shock set gg_trg_Shock = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Shock, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Shock, Condition( function Shock_Conditions ) ) call TriggerAddAction( gg_trg_Shock, function Shock_Actions ) call Preload("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl") endfunction |
