| 12-26-2009, 08:20 AM | #1 |
I recently have had a spell stop working on me and I can't figure out why. I've been working on this a map for a while and took a break around the time 1.24 came out so I'm sure if I accidently changed something to make this not work or whether the patch did it. Here is the spell; I also included it in a map file in case the problem lies elsewhere. It still spawns the battleship and dummy units correctly but they don't cast cluster rockets as they're suppose to. Forgive me for sloppy code layout. JASS:function Trig_saltBattleshipBarrage_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' endfunction struct saltBS unit ship unit u unit array dummy[4] real x real y real ang real time real delta = 0 integer i = 0 endstruct function Trig_saltBattleshipBarrage_Effects takes nothing returns nothing local timer t = GetExpiredTimer() local saltBS d = GetCSData(t) if d.delta >= d.time then set d.i = 0 loop call UnitApplyTimedLife(d.dummy[d.i], 'BTLF', 0.1) set d.dummy[d.i] = null set d.i = d.i + 1 exitwhen d.i > 3 endloop call d.destroy() call PauseTimer(t) call DestroyTimer(t) else set d.delta = d.delta + 0.45 call BJDebugMsg(I2S(GetHandleId(d.dummy[d.i]))) call IssuePointOrderById(d.dummy[d.i], 'A001', d.x + (GetRandomReal(0, 800) - 400), d.y + (GetRandomReal(0, 800) - 400)) set d.i = d.i + 1 if d.i > 3 then set d.i = 0 endif endif endfunction function Trig_saltBattleshipBarrage_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local location l = GetSpellTargetLoc() local real x = GetUnitX(u) local real y = GetUnitY(u) local real xtarg = GetLocationX(l) local real ytarg = GetLocationY(l) local real ang = bj_RADTODEG * Atan2(ytarg - y, xtarg - x) local real facing = GetUnitFacing(u) local integer skillLevel = GetUnitAbilityLevel(u, 'A000') local real time = 1 * skillLevel + 10 local timer t = CreateTimer() local saltBS d = saltBS.create() local integer i = 0 local real xa = (-900 * Cos(ang * bj_DEGTORAD)) local real ya = (-900 * Sin(ang * bj_DEGTORAD)) local unit ship = CreateUnit( GetOwningPlayer(u), 'h002', xtarg + xa, ytarg + ya, facing + 90 ) call SetUnitAnimation(ship,"birth") call SetUnitVertexColor(ship, 255, 255, 255, 0) call TriggerSleepAction(0.3) call SetUnitVertexColor(ship, 255, 255, 255, 255) call TriggerSleepAction(0.9) call UnitApplyTimedLife( ship, 'BFig', time + 0.45) loop exitwhen i > 3 //I put line breaks here to stop it stretching the window. set d.dummy[i] = CreateUnit( GetOwningPlayer(u), 'h001', GetUnitX(ship) + (60 * Cos(ang * bj_DEGTORAD)) + (((-100 + (40 * i)) * Cos((facing + 90) * bj_DEGTORAD))), GetUnitY(ship) + (60 * Sin(ang * bj_DEGTORAD)) + (((-120 + (40 * i)) * Sin((facing + 90) * bj_DEGTORAD))), GetUnitFacing(u) ) call UnitAddAbility(d.dummy[i], 'A001' ) call SetUnitAbilityLevel(d.dummy[i], 'A001', skillLevel) set i = i + 1 endloop set d.ship = ship set d.u = u set d.x = xtarg set d.y = ytarg set d.ang = ang set d.time = time call SetCSData(t, d) call TimerStart(t,0.45,true,function Trig_saltBattleshipBarrage_Effects) call RemoveLocation(l) set u = null set ship = null endfunction //=========================================================================== function InitTrig_saltBattleshipBarrage takes nothing returns nothing set gg_trg_saltBattleshipBarrage = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_saltBattleshipBarrage, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_saltBattleshipBarrage, Condition( function Trig_saltBattleshipBarrage_Conditions ) ) call TriggerAddAction( gg_trg_saltBattleshipBarrage, function Trig_saltBattleshipBarrage_Actions ) endfunction |
| 12-27-2009, 09:28 PM | #2 |
Can you provide a link to this CSData thing and any other resources you may be using that people reading this thread may not be familiar with. Have you considered using TimerUtils instead? |
| 12-28-2009, 01:43 AM | #3 |
Thats an odd request, CSData is mentioned in the thread you just linked so I guess it is just the precursor to TimerUtils. And it's the only thing resource that is in my map. Anyway its from Vexorian's caster system. I could try TimerUtils but this is the only spell thats giving me grief and reworking them all to fix this one seems a bit silly. I see that the CS is quite outdated now but it'd be a fair amount of effort to switch over from it. |
| 12-28-2009, 05:07 PM | #4 |
Well, a lot of legacy resources were broken by the newer patches, that is why I suggested using an up-to-date library, however if the map loads correctly for you and other spells are functioning then this likely is not the issue. Anyway, it seems to me that this is your problem: call IssuePointOrderById(d.dummy[d.i], 'A001', d.x + (GetRandomReal(0, 800) - 400), d.y + (GetRandomReal(0, 800) - 400)) The order id and ability id are two different values. You're using a value that looks like it is an ability id where you should be using an order id. |
| 12-29-2009, 04:56 AM | #5 |
Ah yeah. I changed to ById in an attempt to fix the problem. Changing it back to the orderstring makes it work in the map I posted but not in the full map .Not good, probably means something else is interfering with the spell. Probably will just rewrite the whole thing. Edit: Well it seems like any point ability other than cluster rockets works. |
