| 01-20-2008, 03:26 AM | #1 |
So I know how to stop leaks from handles (You flush it.... somehow... Okay maybe I don't know >_<) But I'm coding my first actual JASS spell (It's really simple, it's basically parasite, in fact half of it isn't Jass, it's practically just a DoT >_>), and I realized I don't know how to stop leaks of... well apparently anything. So I searched and couldn't find anything particularly enlightening, I geuss I need a big Hand pointing to it with big glowey lights. Anyone have one of those they could show me? ![]() |
| 01-20-2008, 03:32 AM | #2 |
Reals and integers don't leak as far as I know. |
| 01-20-2008, 04:14 AM | #3 |
Oh, well cool. But apparently, now i have another problem: My Trigger is terrible. As in like, 6 Problems. JASS:function Trig_Wildfire_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A071' ) ) then return false endif return true endfunction function Trig_Wildfire_Actions takes nothing returns nothing call AddSpecialEffectTargetUnitBJ( "origin", GetSpellTargetUnit(), "Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl" ) local handle f = GetLastCreatedEffectBJ() // Expected a Code Statement set udg_BurnLevel = udg_Burn_Level_Learned set udg_Wildfire_Target = GetSpellTargetUnit() local integer d = 45 // Expected a Code Statement loop set d = d-1 // Expected a Variable Name call UnitDamageTargetBJ( GetTriggerUnit(), GetSpellTargetUnit(), ( 30.00 * udg_BurnLevel ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE ) call TriggerSleepAction( 1.00 ) exitwhen d == 0 // Expected a Name exitwhen GetWidgetLife( udg_Wildfire_Target ) < 0.405 endloop call DestroyEffectBJ( f ) // Expected a Name set udg_Wildfire_Target = Null // Expected a Name endfunction //=========================================================================== function InitTrig_Wildfire takes nothing returns nothing set gg_trg_Wildfire = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Wildfire, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Wildfire, Condition( function Trig_Wildfire_Conditions ) ) call TriggerAddAction( gg_trg_Wildfire, function Trig_Wildfire_Actions ) endfunction Like I said, It sucks. Any help here for the noob? :( |
| 01-20-2008, 04:22 AM | #4 |
JASS:function Wildfire_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A071' endfunction function Wildfire_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit d = GetSpellTargetUnit() local integer i = 0 local integer lvl = GetUnitAbilityLevel(u, 'A071') local effect e = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", d, "origin") loop exitwhen GetWidgetLife(d) < 0.405 or i >= 45 call UnitDamageTarget(u, d, 30.00*lvl, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, null) call TriggerSleepAction(1.) set i = i + 1 endloop call DestroyEffect(e) set u = null set d = null set e = null endfunction function InitTrig_Wildfire takes nothing returns nothing set gg_trg_Wildfire = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Wildfire, EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(gg_trg_Wildfire, Condition(function Wildfire_Conditions)) call TriggerAddAction(gg_trg_Wildfire, function Wildfire_Actions) endfunction |
| 01-20-2008, 05:29 AM | #5 |
So, just a question, what does "BJ" mean? Also, that's very helpful and thank you, but more what I was looking for is showing me what I did wrong and how to avoid it in the future. Like what causes the problems :o |
| 01-20-2008, 05:35 AM | #6 |
BJ == do not use Because it does Jack-all for your map. Usually they are useless functions which act as wrapper for other functions. Some only change the order of the arguments and others use default values in-place of arguments. There are a few "useful" BJ functions (the multiboard ones are a good example). They do a fair amount and shorten the length of your code. Usually wrappers wouldn't be a problem but in Jass but function calls are rather slow and resource expensive, so the less function calls the better. PS: BJ actually stands for "Blizzard J" where J is the file type of jass scripts. |
| 01-20-2008, 05:35 AM | #7 | |
Quote:
Blow job. But, it also can refer to the Blizzard.j file, which holds a bunch of JASS functions created by Blizzard that within them call functions from common.j (and other things). JASS:call AddSpecialEffectTargetUnitBJ( "origin", GetSpellTargetUnit(), "Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl" ) local handle f = GetLastCreatedEffectBJ() // Expected a Code Statement set udg_BurnLevel = udg_Burn_Level_Learned set udg_Wildfire_Target = GetSpellTargetUnit() local integer d = 45 // Expected a Code Statement Your locals all have to be in a block at the top of your function. You can't have function calls or anything before all your locals are declared. The rest of your errors are caused by this because the local variables were never created properly, so it thinks they don't exist. |
| 01-20-2008, 05:43 AM | #8 |
ohhhhh.... That makes sense then. I tried changing a few things seperately, and then I got a giant endless block of "Expected Endif" and "Expected Endloop" errors. Odd. I'm going to bed now, and I'll get back to you guys on this later maybe, thanks! Oh, and is there any way to use the syntax checker without having to save the file first? It's getting annoying :( EDIT: So, I'm not getting any more syntax errors, but it's not actually doing any damage to the target. (And yes, I do need the Global Variables for other triggers): JASS:function Trig_Wildfire_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A071' ) ) then return false endif return true endfunction function Trig_Wildfire_Actions takes nothing returns nothing local integer d = 45 local effect f = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl", GetSpellTargetUnit(), "origin") set udg_BurnLevel = udg_Burn_Level_Learned set udg_Wildfire_Target = GetSpellTargetUnit() loop set d = d - 1 call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), ( 30.00 * udg_BurnLevel ), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE, null) call TriggerSleepAction(.5) exitwhen GetWidgetLife(udg_Wildfire_Target) < 0.405 or d == 0 endloop call DestroyEffect(f) set udg_Wildfire_Target = null set f = null endfunction //=========================================================================== function InitTrig_Wildfire takes nothing returns nothing set gg_trg_Wildfire = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Wildfire, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Wildfire, Condition( function Trig_Wildfire_Conditions ) ) call TriggerAddAction( gg_trg_Wildfire, function Trig_Wildfire_Actions ) endfunction |
| 01-20-2008, 05:12 PM | #9 |
GetSpellTargetUnit() doesn't carry over through waits. And you really shouldn't be using waits at all in the first place. |
| 01-20-2008, 06:24 PM | #10 |
Ah. Two questions then: Why are timers better, and how exactly would I use a timer? >_< Sorry for being so noob. |
| 01-20-2008, 06:57 PM | #11 |
First the "normal" wait (TriggerSleepAction) is not accurate. When you do that : call TriggerSleepAction(5). The wait won't be exactly 5s it can me more or less or why not exactly 5, but it's "random", you can't guess how exactly. Second, the TriggerSleepAction don't stop when the game is paused. So if you need an accurate time, or you need a wait which stop when the game is paused, you need a timer. |
| 01-20-2008, 09:23 PM | #12 |
Ah. So to use a timer, I'd activate the timer at the start, and have another function that goes off when the timer counts down, that deals the damage and also restarts the timer, right? |
| 01-21-2008, 01:14 AM | #13 |
Yes, then if you want it to be MUI, you need to have some sort of variable transfer (struct and CSCache or some other crazy timer attach system). |
| 01-21-2008, 09:54 AM | #14 |
you can also use gamecache |
| 01-21-2008, 10:04 AM | #15 |
or both. Use a struct an store the number of the struct on the cache |
