| 03-13-2009, 01:44 AM | #1 |
Hey there; I'm having a slight problem with a spell. It's not firing the dummy ability correctly; for which I'm using xecast to do it. Everything else works great [updated] JASS://globals private xecast dummycast //endglobals //on init set dummycast = xecast.create() set dummycast.abilityid = 'A002' set dummycast.orderid = 852075 //casting: set dummycast.owningplayer = dp.o loop set u = FirstOfGroup(DamageGroup) exitwhen(u == null) call GroupRemoveUnit(DamageGroup, u) call UnitDamageTarget(dp.u, u, dp.damage, false, true, at, dt, wt) call dummycast.castOnTarget(u) call SetUnitVertexColor(u, 255, 0, 0, 255) endloop Full code. Most of the actual workings have been exported to other libraries; such as PTC. I know the code works and fires however; it's just the xecast object that's not working correctly. The ability is based off of slow; I have the correct cast Id and ability name; so I'm quite confused as to why it doesn't work. Also; I feel like I'm leaking something here. I've looked it over and I havn't seen one, but I'm fairly sure I'm forgetting something =x? JASS:library Bile initializer init uses CastLearnLib, Callbacks, MotionLib, PTC globals private constant integer BILE_POOL = 'h001' private constant integer BILE_BREADTH = 'h002' private constant integer BILE_VOMIT = 'h003' private constant integer ABILCODE = 'A000' private constant real radius = 400 private constant real BELCH_X_OFFSET = 50 private constant real BELCH_Y_OFFSET = 50 private group DamageGroup = CreateGroup() private real array Damage[2] private integer array Period[2] private constant attacktype at = ATTACK_TYPE_MAGIC private constant damagetype dt = DAMAGE_TYPE_MAGIC private constant weapontype wt = WEAPON_TYPE_WHOKNOWS private constant string INSTANCE = "bile" private xecast dummycast endglobals private struct DotPoint real x real y player o unit u real damage endstruct private function End takes nothing returns nothing local PTCS p = CALLBACK_STRUCT local DotPoint dp = p.dat call RemoveUnit(dp.u) call dp.destroy() endfunction private function Dot takes nothing returns nothing local PTCS p = CALLBACK_STRUCT local DotPoint dp = p.dat local unit u = null call GroupClear(DamageGroup) set CALLBACK_PLAYER = dp.o call GroupEnumUnitsInRange(DamageGroup, dp.x, dp.y, radius, Condition(function S_EnemyTargetFilter)) set dummycast.owningplayer = dp.o loop set u = FirstOfGroup(DamageGroup) exitwhen(u == null) call GroupRemoveUnit(DamageGroup, u) call UnitDamageTarget(dp.u, u, dp.damage, false, true, at, dt, wt) call dummycast.castOnTarget(u) call SetUnitVertexColor(u, 255, 0, 0, 255) endloop endfunction private function BileBomb takes nothing returns nothing local Motion m = CALLBACK_STRUCT local DotPoint dp = DotPoint.create() local unit u = m.rotating local real x = GetUnitX(u) local real y = GetUnitY(u) call KillUnit(u) set u = CreateUnit(Player(13), BILE_POOL, x, y, 0) call SetUnitTimeScale(u, .25) call SetUnitVertexColor(u, 0, 125, 0, 60) set dp.u = u set dp.x = x set dp.y = y set dp.o = GetOwningPlayer(u) set dp.damage = Damage[R2I(m.xorig)] call AddNewPeriodicEvent(1., Period[R2I(m.xorig)], dp, Dot, End) call m.destroy() endfunction function BileCast takes nothing returns nothing local unit cast = GetTriggerUnit() local location l = GetCastLoc() local real x = GetLocationX(l) local real y = GetLocationY(l) local unit u local real cx = GetUnitX(cast) local real cy = GetUnitY(cast) local real dx = x - cx local real dy = y - cy local real ang = Atan2(dy,dx) local real fac = ang * 57.32 local real dist = SquareRoot(dy*dy+dx*dx) local Motion m = Motion.create() call RemoveLocation(l) set l = null call SetUnitFacingTimed(cast, fac, 0) set u = CreateUnit(Player(13), BILE_BREADTH, cx + Cos(ang)*BELCH_X_OFFSET, cy + Sin(ang)*BELCH_Y_OFFSET, fac) call KillUnit(u) set u = CreateUnit(GetOwningPlayer(cast), BILE_VOMIT, cx, cy, fac) call m.AddNewMotion(u, .5, dist*.08, 0, 0, 1, ang, ang, 0, BileBomb) call m.SetOrigin(GetUnitAbilityLevel(cast, ABILCODE) - 1, 0) call m.Start() endfunction private function init takes nothing returns nothing set Damage[0] = 7 set Damage[1] = 11 set Damage[2] = 14 set Period[0] = 15 set Period[1] = 20 set Period[2] = 25 set dummycast = xecast.create() set dummycast.abilityid = 'A002' set dummycast.orderid = 852075 endfunction endlibrary Anyone see any errors? Thanks. |
| 03-13-2009, 01:57 AM | #2 |
cant see any errors at a first glance .. are you sure that there are indeed units in the damagegroup ? |
| 03-13-2009, 02:03 AM | #3 | |
Quote:
They turn red and take damage; there's definantly units. |
| 03-13-2009, 03:16 AM | #4 |
has the dummy unit constant (XE_DUMMY_UNITID) of xebasic correct ? |
| 03-13-2009, 05:48 AM | #5 | |
Quote:
Yes. I got it sort of working; but it hits only 1 unit. I updated the code. |
| 03-13-2009, 07:23 AM | #6 |
> I got it sort of working; but it hits only 1 unit. Had such problem some time ago, though I'm not sure if it's it - only several abilities such as Slow could be casted from one unit in a FirstOfGroup loop, other spells were casted just once. |
| 03-13-2009, 09:09 AM | #7 |
dunno... you could try giving that dummy unit a turn speed of 999999999 ...(something like that, you get the idea ..will require a shift-click) and a cast-backswing of 0.00 And maybe check again if your slow spell: - has no cooldown - has no cast time - has no mana cost |
| 03-13-2009, 02:23 PM | #8 |
Try JASS:set dummycast.recycledelay = 1.0 |
| 03-13-2009, 02:58 PM | #9 |
hmnn slow is supposed to be instant, wonder if recycledelay would work. You shouldn't hard code the order id, it is working as a magic constant in your code, better make a constant for it, it is a good habit. It could be a bug with xecast. Something I noticed about slow is that it will not work if the unit already has the bug, also, have you set its mana cost and cooldown to 0? |
| 03-14-2009, 12:30 AM | #10 | |
Quote:
Winner! Works like a charm; thanks! +rep. |
| 03-14-2009, 01:21 AM | #11 |
Blackroot, does your slow cost 0.0 mana and cooldown? |
