Name | Type | is_array | initial_value |
HASH | hashtable | No | |
i | integer | Yes |
//TESH.scrollpos=96
//TESH.alwaysfold=0
[SIZE="3"][B][COLOR="Yellow"]Fire Erruption v1.4[/COLOR][/B][/SIZE]
A Giant fireball comes out from the targeted point. When the fireball explodes it splits into 12 pcs, dealing damage to every enemy in a line.
|cffffcc00Level 1|r - Each fire deals 50 damage.
|cffffcc00Level 2|r - Each fire deals 100 damage.
|cffffcc00Level 3|r - Each fire deals 150 damage.
|cffffcc00Level 4|r - Each fire deals 200 damage.
|cffffcc00Level 5|r - Each fire deals 250 damage.
Originally Created by: [self=http://www.hiveworkshop.com/forums/members/defskull/]Defskull[/self] in GUI but I've decided to remake it in vJASS.
[jass]
/*
===Fire Erruption v1.4
===By: Mckill2009
INSTALLATION:
- Copy the "Fire Erruption" (see left) folder to your map
- Copy the custom units and abilities to your map
- Make sure you inputed the correct raw ID's of the custom units and abilities
- You can view raw ID's by pressing CTRL+D in the object editor
- Examples of raw ID's are 'A001', 'A003' etc...
- See the Note below for more info
REQUIRES:
- RegisterPlayerUnitEvent by Magtheridon96
- SpellEffectEvent by Bribe
CREDITS:
- This spell was originally made by defskull in GUI (requested by me)
*/
scope FireErruption
/*
Note:
- SPELL_ID and CHANNEL_ID must match/synchronize to each other
- FE_DUMSPELLID and ORDER_ID must match/synchronize to each other.
- If you create your FE_DUMMY manually from the object editor make
sure that the "Animation - Cast Backswing/Point" is set to 0.
- The cooldown and mana of your Breath of Fire must be 0.
*/
globals
private constant integer SPELL_ID = 'A001' //Main spell raw ID, Blizzard
private constant integer FE_DUMSPELLID = 'A003' //Dummy spell raw ID, Breath of Fire
private constant integer FE_DUMMYID = 'h000' //Dummy raw ID
private constant integer FIREBALL_ID = 'h002' //Fireball Dummy raw ID
private constant integer CHANNEL_ID = 852089 //Blizzard orderID (for hero)
private constant integer ORDER_ID = 852580 //Breath of Fire orderID (for dummy)
//=============================================
private constant boolean PRELOAD = true
//Sets how many times the fireball will spit fire
private constant integer CAST_COUNT = 12
//This is the ground shaking SFX
private constant string FE_SFX = "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl"
//This is the angle between spitting fire
private constant real FE_BALL_GAP = 30.
//Sets how fast the fireball grows
private constant real SCALE_INTERVAL = 0.05
//Minimum 0.03, this is the speed of the rotating fire casted
private constant real CAST_SPEED = 0.03
//Maximum size of the fireball
private constant real MAX_SCALE = 10
endglobals
private struct FireErruption extends array
unit u
unit fireball
real x
real y
real scale
real angle
real castspeed
integer castcount
integer level
effect sfx
boolean isChanneling
static constant real delay = 0.03125
static unit dummy = null //used a global dummy for the fire casting
static timer t
static integer index = 0
static integer array indexAR
//=====allocator and destructor for this struct
static integer ins = 0
static integer array insAR
static method allocate takes nothing returns integer
local thistype this = insAR[0]
if this==0 then
set ins = ins + 1
set this = ins
else
set insAR[0] = insAR[this]
endif
return this
endmethod
method deallocate takes nothing returns nothing
set insAR[this] = insAR[0]
set insAR[0] = this
endmethod
//=====
static method periodic takes nothing returns nothing
local thistype this
local integer i = 0
local real x1
local real y1
loop
set i = i+1
set this = indexAR[i]
if not IsUnitType(.u, UNIT_TYPE_DEAD) and .isChanneling then
if GetUnitCurrentOrder(.u)==CHANNEL_ID then
if MAX_SCALE > .scale then
set .scale = .scale + SCALE_INTERVAL
call SetUnitScale(.fireball, .scale, 0, 0)
elseif .fireball != null then
call DestroyEffect(.sfx)
call RemoveUnit(.fireball)
set .fireball = null
elseif CAST_COUNT > .castcount then
set .castspeed = .castspeed + delay
if .castspeed > CAST_SPEED then
set .castspeed = 0
set .castcount = .castcount + 1
set .angle = .angle + FE_BALL_GAP
call SetUnitOwner(dummy, GetOwningPlayer(.u), false)
call SetUnitPosition(dummy, .x, .y)
set x1 = .x + 100 * Cos(.angle*bj_DEGTORAD)
set y1 = .y + 100 * Sin(.angle*bj_DEGTORAD)
call SetUnitAbilityLevel(dummy, FE_DUMSPELLID, .level)
call IssuePointOrderById(dummy, ORDER_ID, x1, y1)
endif
else
call IssueImmediateOrder(.u, "stop")
set .isChanneling = false
endif
else
set .isChanneling = false
endif
else
call DestroyEffect(.sfx)
call RemoveUnit(.fireball)
set .u = null
set .fireball = null
set .sfx = null
call .deallocate()
set indexAR[i] = indexAR[index]
set indexAR[index] = this
set index = index - 1
set i = i - 1
if index==0 then
call PauseTimer(t)
call DestroyTimer(t)
call RemoveUnit(dummy)
endif
endif
exitwhen i==index
endloop
endmethod
static method cast takes nothing returns nothing
local thistype this = allocate()
set .u = GetTriggerUnit()
set .x = GetSpellTargetX()
set .y = GetSpellTargetY()
set .fireball = CreateUnit(Player(15), FIREBALL_ID, .x, .y, 0)
set .level = GetUnitAbilityLevel(.u, SPELL_ID)
set .sfx = AddSpecialEffect(FE_SFX, .x, .y)
call SetUnitScale(.fireball, 0,0,0)
set .scale = 0
set .angle = 0
set .castcount = 0
set .castspeed = CAST_SPEED
set .isChanneling = true
call SetUnitFlyHeight(.fireball, 100, 0)
if index==0 then
set t = CreateTimer()
call TimerStart(t, delay, true, function thistype.periodic)
set dummy = CreateUnit(Player(15),FE_DUMMYID,0,0,0)
call UnitAddAbility(dummy, FE_DUMSPELLID)
call UnitRemoveAbility(dummy, 'Amov')
endif
set index = index + 1
set indexAR[index] = this
endmethod
static method onInit takes nothing returns nothing
//Setting up the spell effect
call RegisterSpellEffectEvent(SPELL_ID, function thistype.cast)
static if PRELOAD then
//Preloading dummies and abilities
set dummy = CreateUnit(Player(15),FE_DUMMYID,0,0,0)
call ShowUnit(dummy,false)
call RemoveUnit(dummy)
set dummy = CreateUnit(Player(15),FIREBALL_ID,0,0,0)
call ShowUnit(dummy,false)
call UnitAddAbility(dummy, FE_DUMSPELLID)
call RemoveUnit(dummy)
endif
endmethod
endstruct
endscope
[/jass]
[hidden=Changelogs]
v1.4
- Removing of dummies applied
- Global dummy applied so that no need to create dummies in every loop
v1.3a
- Added optional preload configuration
- Removed 'Arav' ability checking
v1.3
- Library changed to scope
- Added preloads
- T32 replaced by static timer
v1.2
- Remade into vJASS
- Supports Multi-level
- The hero is channeling
- Maker's review 99% done (except for the crow form added :)
v1.3
- The gound really 'raises'
- Trigger 2 has an 'off' status if the group is empty
- Save unit for itself in Hash is removed
- Description changed
[/hidden]
//TESH.scrollpos=27
//TESH.alwaysfold=0
/**************************************************************
*
* RegisterPlayerUnitEvent
* v5.1.0.0
* By Magtheridon96
*
* I would like to give a special thanks to Bribe, azlier
* and BBQ for improving this library. For modularity, it only
* supports player unit events.
*
* Functions passed to RegisterPlayerUnitEvent must either
* return a boolean (false) or nothing. (Which is a Pro)
*
* Warning:
* --------
*
* - Don't use TriggerSleepAction inside registered code.
* - Don't destroy a trigger unless you really know what you're doing.
*
* API:
* ----
*
* - function RegisterPlayerUnitEvent takes playerunitevent whichEvent, code whichFunction returns nothing
* - Registers code that will execute when an event fires.
* - function RegisterPlayerUnitEventForPlayer takes playerunitevent whichEvent, code whichFunction, player whichPlayer returns nothing
* - Registers code that will execute when an event fires for a certain player.
* - function GetPlayerUnitEventTrigger takes playerunitevent whichEvent returns trigger
* - Returns the trigger corresponding to ALL functions of a playerunitevent.
*
**************************************************************/
library RegisterPlayerUnitEvent // Special Thanks to Bribe and azlier
globals
private trigger array t
endglobals
function RegisterPlayerUnitEvent takes playerunitevent p, code c returns nothing
local integer i = GetHandleId(p)
local integer k = 15
if t[i] == null then
set t[i] = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(t[i], Player(k), p, null)
exitwhen k == 0
set k = k - 1
endloop
endif
call TriggerAddCondition(t[i], Filter(c))
endfunction
function RegisterPlayerUnitEventForPlayer takes playerunitevent p, code c, player pl returns nothing
local integer i = 260 + 16 * GetHandleId(p) + GetPlayerId(pl)
if t[i] == null then
set t[i] = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t[i], pl, p, null)
endif
call TriggerAddCondition(t[i], Filter(c))
endfunction
function GetPlayerUnitEventTrigger takes playerunitevent p returns trigger
return t[GetHandleId(p)]
endfunction
endlibrary
//TESH.scrollpos=35
//TESH.alwaysfold=0
//============================================================================
// SpellEffectEvent
// - Version 1.1.0.0
//
// API
// ---
// RegisterSpellEffectEvent(integer abil, code onCast)
//
// Requires
// --------
// RegisterPlayerUnitEvent: hiveworkshop.com/forums/showthread.php?t=203338
//
// Optional
// --------
// Table: hiveworkshop.com/forums/showthread.php?t=188084
//
library SpellEffectEvent requires RegisterPlayerUnitEvent, optional Table
//============================================================================
private module M
static if LIBRARY_Table then
static Table tb
else
static hashtable ht = InitHashtable()
endif
static method onCast takes nothing returns nothing
static if LIBRARY_Table then
call TriggerEvaluate(.tb.trigger[GetSpellAbilityId()])
else
call TriggerEvaluate(LoadTriggerHandle(.ht, 0, GetSpellAbilityId()))
endif
endmethod
private static method onInit takes nothing returns nothing
static if LIBRARY_Table then
set .tb = Table.create()
endif
call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_EFFECT, function thistype.onCast)
endmethod
endmodule
//============================================================================
private struct S extends array
implement M
endstruct
//============================================================================
function RegisterSpellEffectEvent takes integer abil, code onCast returns nothing
static if LIBRARY_Table then
if not S.tb.handle.has(abil) then
set S.tb.trigger[abil] = CreateTrigger()
endif
call TriggerAddCondition(S.tb.trigger[abil], Filter(onCast))
else
if not HaveSavedHandle(S.ht, 0, abil) then
call SaveTriggerHandle(S.ht, 0, abil, CreateTrigger())
endif
call TriggerAddCondition(LoadTriggerHandle(S.ht, 0, abil), Filter(onCast))
endif
endfunction
endlibrary
//TESH.scrollpos=105
//TESH.alwaysfold=0
/*
===Fire Erruption v1.4
===By: Mckill2009
INSTALLATION:
- Copy the "Fire Erruption" (see left) folder to your map
- Copy the custom units and abilities to your map
- Make sure you inputed the correct raw ID's of the custom units and abilities
- You can view raw ID's by pressing CTRL+D in the object editor
- Examples of raw ID's are 'A001', 'A003' etc...
- See the Note below for more info
REQUIRES:
- RegisterPlayerUnitEvent by Magtheridon96
- SpellEffectEvent by Bribe
CREDITS:
- This spell was originally made by defskull in GUI (requested by me)
*/
scope FireErruption
/*
Note:
- SPELL_ID and CHANNEL_ID must match/synchronize to each other
- FE_DUMSPELLID and ORDER_ID must match/synchronize to each other.
- If you create your FE_DUMMY manually from the object editor make
sure that the "Animation - Cast Backswing/Point" is set to 0.
- The cooldown and mana of your Breath of Fire must be 0.
*/
globals
private constant integer SPELL_ID = 'A001' //Main spell raw ID, Blizzard
private constant integer FE_DUMSPELLID = 'A003' //Dummy spell raw ID, Breath of Fire
private constant integer FE_DUMMYID = 'h000' //Dummy raw ID
private constant integer FIREBALL_ID = 'h002' //Fireball Dummy raw ID
private constant integer CHANNEL_ID = 852089 //Blizzard orderID (for hero)
private constant integer ORDER_ID = 852580 //Breath of Fire orderID (for dummy)
//=============================================
private constant boolean PRELOAD = true
//Sets how many times the fireball will spit fire
private constant integer CAST_COUNT = 12
//This is the ground shaking SFX
private constant string FE_SFX = "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl"
//This is the angle between spitting fire
private constant real FE_BALL_GAP = 30.
//Sets how fast the fireball grows
private constant real SCALE_INTERVAL = 0.05
//Minimum 0.03, this is the speed of the rotating fire casted
private constant real CAST_SPEED = 0.03
//Maximum size of the fireball
private constant real MAX_SCALE = 10
endglobals
private struct FireErruption extends array
unit u
unit fireball
real x
real y
real scale
real angle
real castspeed
integer castcount
integer level
effect sfx
boolean isChanneling
static constant real delay = 0.03125
static unit dummy = null //used a global dummy for the fire casting
static timer t
static integer index = 0
static integer array indexAR
//=====allocator and destructor for this struct
static integer ins = 0
static integer array insAR
static method allocate takes nothing returns integer
local thistype this = insAR[0]
if this==0 then
set ins = ins + 1
set this = ins
else
set insAR[0] = insAR[this]
endif
return this
endmethod
method deallocate takes nothing returns nothing
set insAR[this] = insAR[0]
set insAR[0] = this
endmethod
//=====
static method periodic takes nothing returns nothing
local thistype this
local integer i = 0
local real x1
local real y1
loop
set i = i+1
set this = indexAR[i]
if not IsUnitType(.u, UNIT_TYPE_DEAD) and .isChanneling then
if GetUnitCurrentOrder(.u)==CHANNEL_ID then
if MAX_SCALE > .scale then
set .scale = .scale + SCALE_INTERVAL
call SetUnitScale(.fireball, .scale, 0, 0)
elseif .fireball != null then
call DestroyEffect(.sfx)
call RemoveUnit(.fireball)
set .fireball = null
elseif CAST_COUNT > .castcount then
set .castspeed = .castspeed + delay
if .castspeed > CAST_SPEED then
set .castspeed = 0
set .castcount = .castcount + 1
set .angle = .angle + FE_BALL_GAP
call SetUnitOwner(dummy, GetOwningPlayer(.u), false)
call SetUnitPosition(dummy, .x, .y)
set x1 = .x + 100 * Cos(.angle*bj_DEGTORAD)
set y1 = .y + 100 * Sin(.angle*bj_DEGTORAD)
call SetUnitAbilityLevel(dummy, FE_DUMSPELLID, .level)
call IssuePointOrderById(dummy, ORDER_ID, x1, y1)
endif
else
call IssueImmediateOrder(.u, "stop")
set .isChanneling = false
endif
else
set .isChanneling = false
endif
else
call DestroyEffect(.sfx)
call RemoveUnit(.fireball)
set .u = null
set .fireball = null
set .sfx = null
call .deallocate()
set indexAR[i] = indexAR[index]
set indexAR[index] = this
set index = index - 1
set i = i - 1
if index==0 then
call PauseTimer(t)
call DestroyTimer(t)
call RemoveUnit(dummy)
endif
endif
exitwhen i==index
endloop
endmethod
static method cast takes nothing returns nothing
local thistype this = allocate()
set .u = GetTriggerUnit()
set .x = GetSpellTargetX()
set .y = GetSpellTargetY()
set .fireball = CreateUnit(Player(15), FIREBALL_ID, .x, .y, 0)
set .level = GetUnitAbilityLevel(.u, SPELL_ID)
set .sfx = AddSpecialEffect(FE_SFX, .x, .y)
call SetUnitScale(.fireball, 0,0,0)
set .scale = 0
set .angle = 0
set .castcount = 0
set .castspeed = CAST_SPEED
set .isChanneling = true
call SetUnitFlyHeight(.fireball, 100, 0)
if index==0 then
set t = CreateTimer()
call TimerStart(t, delay, true, function thistype.periodic)
set dummy = CreateUnit(Player(15),FE_DUMMYID,0,0,0)
call UnitAddAbility(dummy, FE_DUMSPELLID)
call UnitRemoveAbility(dummy, 'Amov')
endif
set index = index + 1
set indexAR[index] = this
endmethod
static method onInit takes nothing returns nothing
//Setting up the spell effect
call RegisterSpellEffectEvent(SPELL_ID, function thistype.cast)
static if PRELOAD then
//Preloading dummies and abilities
set dummy = CreateUnit(Player(15),FE_DUMMYID,0,0,0)
call ShowUnit(dummy,false)
call RemoveUnit(dummy)
set dummy = CreateUnit(Player(15),FIREBALL_ID,0,0,0)
call ShowUnit(dummy,false)
call UnitAddAbility(dummy, FE_DUMSPELLID)
call RemoveUnit(dummy)
endif
endmethod
endstruct
endscope