| 01-28-2010, 08:04 PM | #1 | |
Unfortunately I couldn't get much out of xefx's demo spell, seeing as how it incorporated collider and whatnot. So I was setback trying to use it for my purposes. I have two spells. One where the unit throws a vial concoction at a target point which subsequently explodes upon landing and damages enemies in an area with smaller damage over time. So it's pretty much flamestrike with a missile. The other is where a unit throws a glaive that hits a targeted enemy. Now I'm just entering into vJASS, and am still researching all it can do. So far I've just been using it to replace hashtables. Anyways any help using the xefx system would be appreciated. Here is the code I'm doing too.
|
| 01-28-2010, 08:37 PM | #2 |
Hello! For a starter in vJASS, you're doing pretty well. Let me give you some pointers before we get into the real issue! JASS:// Since you're using keywords, you don't need ugly prefixes in the names: private function AlcheBomb_Conditions takes nothing returns boolean private function AlcheBomb_Actions takes nothing returns nothing // Scope initializers need not be public. Make it private. public function InitTrig_AlcheBomb takes nothing returns nothing JASS:// This is redundant code! // You have almost exactly the same thing in two places. call GroupEnumUnitsInRange(D.g, D.X2, D.Y2, 350 + 85. * (GetUnitAbilityLevel(D.c, SpellID) - 1), null) loop set t = FirstOfGroup(D.g) exitwhen t == null if IsUnitEnemy(t, GetOwningPlayer(D.c)) and GetWidgetLife(t) >= 1 then call UnitDamageTarget(D.c, t, 5 * GetUnitAbilityLevel(D.c, SpellID), true, false, atk, dmg, wpn) call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", t, "origin")) endif set X1 = GetUnitX(t) set Y1 = GetUnitY(t) call GroupRemoveUnit(D.g, t) endloop // ============================================= // Move the code to a separate function function DamageUnitsInRange takes integer damage, Data d returns nothing // ... endfunction You could also do the looping in a more efficient way. The trick is to use the filterFunction as the loop, and let the groupEnum call do the loop for you. If you're interested, you can follow the link in my sig. Concerning xefx A very short tutorial. JASS:function Tutorial takes nothing returns nothing local unit caster = GetSpellAbilityUnit() local integer x = GetSpellTargetX() local integer y = GetSpellTargetY() local integer facing = 0 // Create the effect at the point (x,y) // Effect will face right (0 radians) local xefx fx = xefx.create(x, y, facing) // Give the effect an appearance. set fx.fxpath = "Human\\DeathMissile.mdx" call TriggerSleepAction(3) // Spell is now above caster's head set fx.x = GetUnitX( caster ) set fx.y = GetUnitY( caster ) set fx.z = 200 // z means height call TriggerSleepAction(3) call fx.destroy() set caster = null endfunction |
| 01-30-2010, 04:31 AM | #3 |
Quick update! Thanks much, this has been very helpful and informative and I'm reading your tutorial right now. It's very helpful in learning vJASS and some general things =) I'm trying this out and will see how I do. If I have any problems I'll post here again. |
| 01-31-2010, 12:37 AM | #4 |
Alright I'm working with a mobile fx. I'm clueless on proper mathmatics to move it towards the destination. I looked at this tutorial: http://www.hiveworkshop.com/forums/t...apes-gui-7337/ And was checking out the line portion, but I can't wrap my head around it. :( In part because it's in GUI and in part because I never got to Trig or Calculus in highschool. How would I move the fx from it's current target to the target point at a speed of 700. I know I'd create a timer and tell it to move a few units on a line that runs from the target caster to the target point every 0.x seconds. I just don't know how to figure out those numbers. |
| 01-31-2010, 01:44 AM | #5 |
Well, you'd need to use trigonometry to convert your movement speed (700 multiplied by whatever your timer period is) and movement angle into usable x and y coordinate offsets. |
| 01-31-2010, 06:22 PM | #6 | |
I may have to look at some example codes in order to understand this. It seems pretty simple as far as the equation would go. The destination doesn't move, and the missile moves along a straight line with a fixed course. Alright I found a pretty worthwhile formula to use for a grenade spell. Unfortunately I don't know how to transfer the FX from the XE system from the acitons trigger into the timer trigger in order to allow it to move. Any help here? Also, how can I optomize and make this trigger work properly? I was thinking of running all the data inside the struct, as I've seen it done before and it doesn't seem to hard. Just make the create static method run the starting actions, then create a static method Loop and have that one run like the timer, but I'm not sure if it'll work properly, as it was done for activatables. So any help? =) I'm looking forward to figure this out and doing this spell :) I can start my Beta map once it's done.
|
| 01-31-2010, 11:29 PM | #7 |
move xefx fx to your struct instead create it as local variable |
| 02-01-2010, 10:18 AM | #8 |
For linear movement in the XY-plane: JASS:private struct Data xefx fx real x_speed real y_speed endstruct globals // Move 700 each second. private constant real SPEED=700 // Update 25 times per second private constant real TIMER_INTERVAL = 0.04 // How much speed in each loop? private constant real SPEED_PER_INTERVAL = SPEED * TIMER_INTERVAL // 700 * 0.04 = 28 // It runs 25 times per second, so it will move: // 28*25 = 700 // each second, like we want it too. endglobals // Now, we know speed per loop. // Warcraft, however, works with X and Y coordinates. // We need to know how much to change x and y each loop. local Data d = Data.create() set d.fx = xefx.create( ... ) // Here's the trigonometry: set d.x_speed = Cos(angle) * SPEED_PER_INTERVAL set d.y_speed = Sin(angle) * SPEED_PER_INTERVAL // And in the loop: d.fx.x = d.fx.x + d.x_speed d.fx.y = d.fx.y + d.y_speed |
