| 07-18-2007, 09:58 PM | #1 |
JASS://****************************************************** //*Holy Concentration (Clearcasting) //****************************************************** function HolyConcentrationRemoval takes nothing returns nothing local timer t = GetExpiredTimer() local string d = GetAttachmentTable(t) local unit u = GetTableUnit(d, "unit") local integer abilityid = GetTableInt(d, "abilityid") if GetUnitAbilityLevel(u, 'A05P') > 0 then call SetUnitAbilityLevel(u, abilityid, GetUnitAbilityLevel(u, abilityid) - 1) call UnitRemoveAbility(u, 'A05P') debug call BJDebugMsg("Removed") endif set u = null set t = null call ClearTable(d) call DestroyTimer(t) endfunction function HolyConcentrationApply takes unit u, integer abilityid, integer manacost returns nothing local timer t = CreateTimer() local string d = GetAttachmentTable(t) call SetUnitAbilityLevel(u, 'A05N', GetUnitAbilityLevel(u, 'A05N') + 1) call SetUnitAbilityLevel(u, 'A04E', GetUnitAbilityLevel(u, 'A04E') + 1) call SetUnitState (u, UNIT_STATE_MANA, GetUnitState(u, UNIT_STATE_MANA) - manacost) debug call BJDebugMsg("HIT2") call UnitAddAbility(u, 'A05P') call SCTDisplayTextGen(u, u, "Clearcasting", true) call SetTableObject(d, "unit", u) call SetTableInt(d, "abilityid", abilityid) call TimerStart(t, 15, false, function HolyConcentrationRemoval) set t = null set d = null endfunction JASS://****************************************************** //*Inspiration //****************************************************** function InspirationRemoval takes nothing returns nothing local timer t = GetExpiredTimer() local string d = GetAttachmentTable(t) local inspirationdata insdata = GetTableInt(d, "inspirationdata") local string targettable = GetAttachmentTable(insdata.target) local herodata targethd = GetTableInt(targettable, "herodata") debug call BJDebugMsg("Removed") set targethd.armor = targethd.armor - insdata.added call SetTableInt(targettable, "herodata", targethd) call insdata.destroy() call ClearTable(d) call DestroyTimer(t) set t = null set targettable = null endfunction function InspirationApply takes unit u, unit target returns nothing local inspirationdata insdata = inspirationdata.create() local timer t = CreateTimer() local string castertable = GetAttachmentTable(u) local string targettable = GetAttachmentTable(target) local string d = GetAttachmentTable(t) local real added local herodata hd = GetTableInt(castertable, "herodata") local herodata targethd = GetTableInt(targettable, "herodata") local player p = GetOwningPlayer(u) debug call BJDebugMsg("HIT2") call CasterCastAbility(p, 'A057', "innerfire", target, true) set added = ( targethd.armor * hd.t11actual ) - targethd.armor set insdata.added = added set targethd.armor = targethd.armor + (added) call SetTableInt(d, "inspirationdata", insdata) call TimerStart(t, 15, false, function InspirationRemoval) set castertable = null set targettable = null set d = null set t = null set p = null endfunction They're two simple buff adders with removal functions Just want to make sure its efficent,as I'm going to base alot of stuff off those functions |
| 07-18-2007, 10:46 PM | #2 |
It's not very clear what you're trying to do since there's no description of what the spells are supposed to do, so I can't tell you if this is the best way to get that effect. You could always optimize it by using vJass, though. |
| 07-18-2007, 11:11 PM | #3 |
The first one should attach a pointer to a single struct instead of attaching multiple fields, specially since right now your are using I2U which is not "ideally safe". |
| 07-18-2007, 11:23 PM | #4 | |
They're both triggered spell effects The first one adds a Slow Tornado aura to the target, second one uses a dummy caster to apply an inner fire-based buff on the target vex, Where is I2U being used? SetTableInt ? Updated to:
|
| 07-19-2007, 06:34 AM | #5 | |
Quote:
|
| 07-19-2007, 06:36 AM | #6 |
Ah, so using structs avoids that... |
| 07-19-2007, 06:42 AM | #7 |
Yes. |
| 07-19-2007, 10:02 AM | #8 |
If you plan on using buffs a lot, then perhaps I may interest you in my ABuff system? It's not released yet, but it's nearly finished and now that I have my computer back I should have it out in a couple of days. |
| 07-19-2007, 10:09 AM | #9 |
What exactly does your ABuff system do, Anitarf? I'm curious... |
| 07-19-2007, 05:11 PM | #10 |
