- Reaction score
- 534
I present thee Heat Cyclone:
It is a long time since I coded my last spell, especially in vJASS. So, the other day, I decided to make sure I remember how by coding a new spell. ^^
It is rather simple really, I just wanted to make an efficient spell with an efficient timer system.
Anyways.
Here's the code:
I'm a bit rusty with all this, and so I will gladly accept comments!
Thanks to JetFangInferno for the FireWhirlwind model, to Jesus4Lyf for his system KeyTimers2 and GTrigger, and to Tinki3 for the map template.
Enjoy!
EDIT: Small tweaks
EDIT2: Removed the order Id from configurable section. It now checks directly for the correct id.
EDIT3: struct is now private. Removed useless configuration. Made the effect path configurable.
EDIT4: MAJOR changes done to the spell. Removed lag almost entirely. Changed the missile effect and the base dummy spell.
EDIT5: Few tweaks updated.
EDIT6: Last update! Everything should be quite good now, and stable.
EDIT7: Version 2.0 (optional version) includes Jesus4Lyf's GTrigger system.
EDIT8: Update!
It is a long time since I coded my last spell, especially in vJASS. So, the other day, I decided to make sure I remember how by coding a new spell. ^^
It is rather simple really, I just wanted to make an efficient spell with an efficient timer system.
Anyways.
Here's the code:
JASS:
scope HeatCyclone initializer Init
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//¤
//¤ *****************
//¤ - Heat Cyclone v2.0 -
//¤ *****************
//¤
//¤ By: Daxtreme
//¤
//¤ --> How to implement in your map:
//¤
//¤ 1. Copy the spell "Heat Cyclone" into your map.
//¤ 2. Copy the spell named "Heat cyclone dummy" into your map.
//¤ 3. (Optional, if you haven't a dummy unit already) Copy the unit "Dummy unit" into your map.
//¤ 4. Copy this trigger into your map.
//¤ 5. Import the FireTornado.mdx model into your map.
//¤ 6. Import the Tornado2b.blp texture into your map.
//¤ 7. Copy the trigger named "KT" into your map.
//¤ 8. Copy the trigger named "GT" into your map.
//¤ 9. Change the rawcodes in the configuration section so they fit with your map's.
//¤
//¤ --> How to customize it:
//¤
//¤ 1. You can configure the spell using the few globals just below. Change their values.
//¤ 2. The main editing happens in the object editor. The spell "Heat cyclone dummy" is the one that's
//¤ editable. Damage, Fireball speed, and distance are all examples of editable stuff.
//¤
//¤ CREDITS:
//¤
//¤ - JetFangInferno's Fire Tornado.
//¤ - Jesus4Lyf's KeyTimers2 and GTrigger Events sytems.
//¤ - Tinki3's spell map test template.
//¤
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//
// *** Configuration Section ***
//
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
globals
private constant integer RawCode = 039;A000039; // The spell's rawcode in the editor
private constant integer dummyid = 039;u001039; // The dummy's id
private constant integer dummyspell = 039;A002039; // The dummy spell's id
private constant string effectpath = "war3mapImported\\FireTornado.mdx" // Path of the custom effect
private constant string orderstring = "carrionswarm" // Order string of the dummy spell
private constant real dummylife = 5. // If you want to increase the spell's duration, increasing the dummy's lifespan is
// important.
private constant real angle = 18. // Angle increment between each fireball. The smaller the laggier.
private constant real period = 0.035 // Time between each instance of the dummy spell. Do not reduce this below 0.01
// as the lag will increase
endglobals
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
//
// *** Spell Code ***
//
// --> I highly recommend editing the following only if you know what you're doing.
//
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
private struct data
unit c
integer lvl
integer i = 0
integer id
effect fireww
unit dummy
real x
real y
endstruct
private function Timer takes nothing returns boolean
local data d = KT_GetData()
local real x2
local real y2
if ( GetUnitCurrentOrder(d.c) != d.id ) then
call DestroyEffect(d.fireww)
call data.destroy(d)
set d.c = null
set d.fireww = null
set d.dummy = null
return true
endif
set d.i = d.i + 1
set x2 = d.x + 50. * Cos((angle * I2R(d.i)) * bj_DEGTORAD) // The 50. is to ensure the dummy correctly turns.
set y2 = d.y + 50. * Sin((angle * I2R(d.i)) * bj_DEGTORAD) // Else, the spell does not make a perfect cyclone.
call SetUnitFacing(d.dummy, bj_RADTODEG * Atan2(y2 - d.y, x2 - d.x))
call IssuePointOrder(d.dummy, orderstring, x2, y2)
return false
endfunction
private function Actions takes nothing returns boolean
local data d = data.create()
set d.c = GetTriggerUnit()
set d.lvl = GetUnitAbilityLevel(d.c, RawCode)
set d.x = GetUnitX(d.c)
set d.y = GetUnitY(d.c)
set d.fireww = AddSpecialEffectTarget(effectpath, d.c, "origin")
set d.id = GetUnitCurrentOrder(d.c)
set d.dummy = CreateUnit(GetOwningPlayer(d.c), dummyid, d.x, d.y, 0.)
call UnitAddAbility(d.dummy, dummyspell)
call SetUnitAbilityLevel(d.dummy, dummyspell, d.lvl)
call UnitApplyTimedLife(d.dummy, 039;BTLF039;, dummylife)
call KT_Add(function Timer, d, period)
return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
call GT_AddActionToStartsEffectEvent(RawCode, function Actions)
endfunction
endscope
I'm a bit rusty with all this, and so I will gladly accept comments!
Thanks to JetFangInferno for the FireWhirlwind model, to Jesus4Lyf for his system KeyTimers2 and GTrigger, and to Tinki3 for the map template.
Enjoy!
EDIT: Small tweaks
EDIT2: Removed the order Id from configurable section. It now checks directly for the correct id.
EDIT3: struct is now private. Removed useless configuration. Made the effect path configurable.
EDIT4: MAJOR changes done to the spell. Removed lag almost entirely. Changed the missile effect and the base dummy spell.
EDIT5: Few tweaks updated.
EDIT6: Last update! Everything should be quite good now, and stable.
EDIT7: Version 2.0 (optional version) includes Jesus4Lyf's GTrigger system.
EDIT8: Update!