| 08-15-2009, 03:18 AM | #1 |
Hello, the spell i would like to make is a channeled spell that creates a circle area around the caster, to pause all units inside the circle, and several beams of light or dark energy come down in random places. I would like the light beams to heal allied units and the dark beams to damage enemy units. I know it's a lot to ask, but I would really appriciate some help... I don't even know where to start. Here's my code so far: function Trig_Light_n_Dark_Actions takes nothing returns nothing JASS:function Trig_Light_n_Dark_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' endfunction function Trig_Light_n_Dark_Actions takes nothing returns nothing local integer a = 0 local boolean b = false loop exitwhen a == 20 if (b==false) then call AddSpecialEffectLoc("war3mapImported\\Desecrate.mdx", GetRandomPointInDisk(GetUnitX(GetSpellAbilityUnit()), GetUnitY(GetSpellAbilityUnit()), 0, 500)) else call AddSpecialEffectLoc("war3mapImported\\Judgement.mdx", GetRandomPointInDisk(GetUnitX(GetSpellAbilityUnit()), GetUnitY(GetSpellAbilityUnit()), 0, 500)) endif set a = a+1 endloop endfunction //=========================================================================== function InitTrig_Light_n_Dark takes nothing returns nothing set gg_trg_Light_n_Dark = CreateTrigger( ) call TriggerAddAction( gg_trg_Light_n_Dark, function Trig_Light_n_Dark_Actions ) call TriggerAddCondition( gg_trg_Light_n_Dark, Condition( function Trig_Light_n_Dark_Conditions ) ) call Preload("war3mapImported\\Desecrate.mdx") call Preload("war3mapImported\\Judgement.mdx") endfunction |
| 08-15-2009, 07:03 PM | #2 |
You're missing a "call" in front. The second syntax error isn't reported because the compiler gives up after the first. Could you specify more precisely how you want the damage to be done? In a small area around the effect, or in the entire spell area simultaneously? |
| 08-15-2009, 07:05 PM | #3 |
In a small area around the effect. Edit: and, adding a call still comes up with a syntax error. Edit2: odd, I usually save to check errors, but when i use syntax check it comes up with different errrors. I've highlighed the new errors. |
| 08-15-2009, 07:11 PM | #4 |
You lack an ")" at the end of the line. If you want your effects to appear in only a circle, not a disk, then you needn't use that function, you can instead inline the code which would save you the use of a location. |
| 08-15-2009, 07:13 PM | #5 |
What is the difference between a circle and a disk? |
| 08-15-2009, 07:15 PM | #6 |
Disk has a certain thickness, it's basically an area between two circles. In your case, however, you set the radii for both the inner and the outer circle to the same value, so your disk has no width, it is effectively a circle. |
| 08-15-2009, 07:16 PM | #7 |
I see, so like a donut . Give me a second to try to figure this out, if i cant then i will ask you for help.Edit: Lol I need help... I don't know the maths for a circle. Edit2: Well, after looking at it some more, i got this so far: JASS:function PickRandomPointInCircle takes real centerX, real centerY, real radius returns location return centerX + (GetRandomReal(0, radius)) * Cos(0, 2 * bj_PI), centerY + (GetRandomReal(0, radius)) * Cos(0, 2 * bj_PI) endfunction |
| 08-15-2009, 07:45 PM | #8 |
Maybe this could help. Disk Point Picking |
| 08-15-2009, 07:51 PM | #9 | |
Quote:
Um... could you explain that to me? I just started trig this year so I don't understand any of this...Edit: I decided to go with GetRandomPointInDisk for now... my code has no errors but it doesnt work atm. |
| 08-15-2009, 08:10 PM | #10 |
I'm not sure if I'm right but this is how I understood that: JASS:// cX : the x offset of disk's center. // cY : the x offset of disk's center. // radius : the circle's radius. // width : refers to the width of the disk where it picks a random point. function GetRandomPointInDisk takes real cX, real cY, real width, real radius returns location local real x=GetRandomReal(cX+width, radius) local real y=GetRandomReal(cY+width, radius) local real angle=GetRandomReal(0, bj_PI*2) local real radius=SquareRoot(x*x+y*y) set x=x+radius*Cos(angle) set y=y+radius*Sin(angle) return Location(x,y) endfunction Vexorian gave that link to someone asking how to get a random point inside a disk, I just gave it to you also lol. Just wait for corrections, I expect mine to not work as intended. |
| 08-15-2009, 08:28 PM | #11 |
Yeah, yours is totally wrong. |
| 08-15-2009, 09:36 PM | #12 |
Ok, so I heared somewhere that if you use a wait function in your spell it won't be mui. Is this true? |
| 08-15-2009, 09:59 PM | #13 | |
Quote:
|
| 08-15-2009, 10:10 PM | #14 | |
Quote:
|
| 08-15-2009, 10:31 PM | #15 |
By using timers. |
