TheCrystal
New Member
- Reaction score
- 36
Well, I'm new to JASS and all so I'm kind of cheating with GUI on some of my "Err, what do I do?" moments.
1. I'm trying to make a KB system for me (I rather not download one) and I'm having it activate every .03 seconds with a Timer.
Here's the GUI trig
It works, I know it but there's a problem with the KB part itself.
The Text doesn't display, but if I put it BEFORE I set the Group, it displays. I'm not sure what's wrong here.
(Btw, how would I do events with functions?)
2. From what I understand I have to null locals such as "local unit u = BLEH" correct? And points, etc. So I'd best do this by doing a "local unit u = null" and all that at the END of a function?
3. Since I'm guessing points leak, would this leak?
(Writing this up in Firefox, sorry if I messed something up)
Or only when the thing returns specifically with a Point, like GetUnitLoc?
4. Am I doing the KB for 1 all wrong or am I on the right path? (Trial and Error)
Thanks in advance.
Edit:
5. I'm trying to base an equation or something off of an AoE deal, the damage lowering the farther out of range the unit gets. So if the ability does say, 100 damage with 100 AoE, the unit at the edge of the AoE should have 1 damage dealt. Is there an equation or something I can get out of this that someone is willing to figure out for me? I can't seem to imagine one.
1. I'm trying to make a KB system for me (I rather not download one) and I'm having it activate every .03 seconds with a Timer.
Here's the GUI trig
Trigger:
- KnockBackCall Copy
- Events
- Time - ThreeHundredthOfSecTimer expires
- Conditions
- Actions
- Custom script: call KnockBack()
- Events
It works, I know it but there's a problem with the KB part itself.
JASS:
function KnockBack takes nothing returns nothing
local group g = CreateGroup()
local unit u = null
local integer i = 0
call GroupAddGroup(BeingKnockedBack,g)
call DisplayTextToPlayer(Player(0),0,0,"KnockBackLoopActivating")
loop
set u = FirstOfGroup(g)
exitwhen u == null
set i = GetUnitUserData(u)
call GroupRemoveUnit(g,u)
call SetUnitX(u,GetUnitX(u)+15*Cos(KnockBackAngleReal<i>*bj_DEGTORAD))
call SetUnitY(u,GetUnitY(u)+15*Sin(KnockBackAngleReal<i>*bj_DEGTORAD))
set KnockBackReal<i>=KnockBackReal<i>-15
if KnockBackReal<i> <= 30 then
call GroupRemoveUnit(BeingKnockedBack,u)
endif
endloop
endfunction</i></i></i></i></i>
The Text doesn't display, but if I put it BEFORE I set the Group, it displays. I'm not sure what's wrong here.
(Btw, how would I do events with functions?)
2. From what I understand I have to null locals such as "local unit u = BLEH" correct? And points, etc. So I'd best do this by doing a "local unit u = null" and all that at the END of a function?
3. Since I'm guessing points leak, would this leak?
(Writing this up in Firefox, sorry if I messed something up)
JASS:
Or only when the thing returns specifically with a Point, like GetUnitLoc?
4. Am I doing the KB for 1 all wrong or am I on the right path? (Trial and Error)
Thanks in advance.
Edit:
5. I'm trying to base an equation or something off of an AoE deal, the damage lowering the farther out of range the unit gets. So if the ability does say, 100 damage with 100 AoE, the unit at the edge of the AoE should have 1 damage dealt. Is there an equation or something I can get out of this that someone is willing to figure out for me? I can't seem to imagine one.