ZiggyMcjoney
Data editor?! AAAHHHHH!
- Reaction score
- 95
For lack of a better name, here is my first JASS spell (and first submitted spell ever ), Wheel of Misfortune!
GUI/JASS: JASS
MUI: Yes
Leakless: Hopefully
Lagless: Haven't noticed any lag, although it would if you used an immense amount of summons.
Requires: Jass NewGen (check the Useful Tools thread in World Editor Help to download this)
Importation Instructions:
1. Import the "Dummy Unit (Forcefield)" unit to your map.
2. Import the "Wheel of Misfortune" spell.
3. Import this trigger. It'll save alot of trouble if you name the trigger WheelofMisfortune when you import it.
4. Done!
The map is attached at the bottom of the post.
What it does:
The Wheel of Misfortune is a spell that creates 10 units around you (calling them "Beacons" for lack of a better name). A random beacon will then explode, dealing damage to all nearby units and adding them to a group. The units from that group will then move to the next beacon, and that next beacon will explode, adding all damaged units to the group. At the end of the spiral, all units that were picked up by the Wheel are let free (if they're still alive). It's difficult to explain, but you might be able to make sense of it by looking at this screenshot, or playing the map:
Screenshot:
Code:
Those who are illiterate towards JASS can still edit using the block of globals at the top of the trigger.
I'll accept any comments and constructive criticism with open arms, as I'm still a bit of a nublet when it comes to JASS.
Thanks, hopefully you find this useful .
Tell me if I've forgotten any information on this post.
Version 1.4: Nulled some variables, fixed some issues with the trigger using static values instead of the globals and made the spell not hit structures. View attachment Wheel of Misfortune v1.4 by GG_Pope.w3x
GUI/JASS: JASS
MUI: Yes
Leakless: Hopefully
Lagless: Haven't noticed any lag, although it would if you used an immense amount of summons.
Requires: Jass NewGen (check the Useful Tools thread in World Editor Help to download this)
Importation Instructions:
1. Import the "Dummy Unit (Forcefield)" unit to your map.
2. Import the "Wheel of Misfortune" spell.
3. Import this trigger. It'll save alot of trouble if you name the trigger WheelofMisfortune when you import it.
4. Done!
The map is attached at the bottom of the post.
What it does:
The Wheel of Misfortune is a spell that creates 10 units around you (calling them "Beacons" for lack of a better name). A random beacon will then explode, dealing damage to all nearby units and adding them to a group. The units from that group will then move to the next beacon, and that next beacon will explode, adding all damaged units to the group. At the end of the spiral, all units that were picked up by the Wheel are let free (if they're still alive). It's difficult to explain, but you might be able to make sense of it by looking at this screenshot, or playing the map:
Screenshot:
Code:
Those who are illiterate towards JASS can still edit using the block of globals at the top of the trigger.
JASS:
//*******************************************************************************
//* Wheel of Misfortune by GG_Pope(Vantuex/Arche/ZiggyMcJoney) *
//*******************************************************************************
//* Some quick notes: *
//* # Give credit if you use this spell in your map. *
//* # This spell is MUI, leakless (hopefully) and lagless. *
//* # Written in vJass with Jass NewGen v1.4.0.1 (thanks Vexorian!) *
//* # Bugs can be reported to the thread on TheHelper.net where you got this*
//* from or at my email, <a href="mailto:[email protected]">[email protected]</a> (note, I don't read this *
//* frequently!) *
//* *
//* Import Instructions: *
//* # 1. Import the "Dummy Unit (Forcefield)" unit to your map. *
//* # 2. Import the "Wheel of Misfortune" spell. *
//* # 3. Import this trigger. It'll save alot of trouble if you name the *
//* trigger WheelofMisfortune when you import it. *
//* # 4. Done! *
//*******************************************************************************
scope WheelofMisfortune
globals
//Customizable Options:
private integer direction = GetRandomInt(0,1) // 0 = Anti-Clockwise, 1 = Clockwise. Changes the direction in which the beacons explode.
private integer maxloops = 10 //This variable changes the amount of units created.
private integer unitid = 039;nWOM039; //The Unit ID of the dummy unit. You won't have to change this unless you change the unit this spell creates.
private integer spellid = 039;AWOM039; //The Order ID of the spell you're casting. You won't have to change this unless you change the spell this trigger fires off.
private string effect1 = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl" //This is the first special effect, created when the beacon is destroyed. Defaulted as Death Coil.
private string effect2 = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl" //This is the second special effect, created when the beacon is destroyed. Defaulted as Thunder Clap.
private string orderstring = "absorb" //This is the order string of the spell you're using to trigger this. You won't have to change
private real damage = 50 * (GetUnitAbilityLevel(GetTriggerUnit(), spellid)) //This variable changes the damage dealt by the spell.
private real radius = 150 //This variable changes how big the radius of the explosions are.
private real spellradius = 250 //This variable changes how far away the beacons are created from the caster.
private real frequency = 0.30 //This variable changes how quickly the beacons explode. Values below 0.30 will likely be inaccurate.this unless you change the order string on the spell in the object editor.
//For options not listed above:
//In the object editor, change "Data - Follow Through Time" to customize the channeling time.
//To change the order string if your hero uses another spell with the 'absorb' string, change Data - Base Order ID to another string. You must also change the "orderstring" global variable in the globals block above if you do this.
//To change the model of the beacon, change the model on the Dummy Unit.
//It is unecessary to change this:
private location l
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == spellid
endfunction
private function GroupConditions takes nothing returns boolean
return GetWidgetLife(GetFilterUnit()) > .405 and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false
endfunction
private function Move takes nothing returns nothing
call SetUnitPositionLoc(GetEnumUnit(), l)
call PauseUnit(GetEnumUnit(), true)
call SetUnitVertexColor(GetEnumUnit(), 100, 100, 100, 50)
call UnitDamageTarget(GetTriggerUnit(), GetEnumUnit(), damage, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
endfunction
private function End takes nothing returns nothing
call PauseUnit(GetEnumUnit(), false)
call SetUnitVertexColor(GetEnumUnit(), 255, 255, 255, 255)
endfunction
private function Actions takes nothing returns nothing
local integer li = GetRandomInt(1,maxloops)
local integer listatic = li
local integer lia = 1
local unit array wall
local real x
local real y
local group ug = CreateGroup()
local group move = CreateGroup()
loop
exitwhen lia > maxloops
set x = GetUnitX(GetTriggerUnit()) + spellradius * Cos(li * (360/maxloops) * bj_DEGTORAD)
set y = GetUnitY(GetTriggerUnit()) + spellradius * Sin(li * (360/maxloops) * bj_DEGTORAD)
set wall[lia] = CreateUnit(GetOwningPlayer(GetTriggerUnit()), unitid, x, y, 270)
if li == maxloops then
set li = 1
else
set li = li + 1
endif
set lia = lia + 1
endloop
if direction == 0 then
set li = 1
else
set li = 10
endif
loop
exitwhen li>maxloops or GetUnitCurrentOrder(GetTriggerUnit()) != String2OrderIdBJ(orderstring)
call TriggerSleepAction(frequency)
set x = GetUnitX(wall[li])
set y = GetUnitY(wall[li])
call RemoveUnit(wall[li])
set wall[li] = null
call DestroyEffect(AddSpecialEffect(effect1,x,y))
call DestroyEffect(AddSpecialEffect(effect2,x,y))
set l = Location(x,y)
set ug = GetUnitsInRangeOfLocMatching(radius, l, Condition(function GroupConditions))
call GroupAddGroup(ug, move)
call DestroyGroup(ug)
call ForGroup(move, function Move)
call RemoveLocation(l)
if direction == 0 then
set li = li + 1
else
set li = li - 1
endif
endloop
call ForGroup(move, function End)
call DestroyGroup(move)
loop
exitwhen li>maxloops
set x = GetUnitX(wall[li])
set y = GetUnitY(wall[li])
call RemoveUnit(wall[li])
set wall[li] = null
call DestroyEffect(AddSpecialEffect(effect1, x, y))
set li = li + 1
endloop
set move = null
set ug = null
set l = null
endfunction
function InitTrig_WheelofMisfortune takes nothing returns nothing
set gg_trg_WheelofMisfortune = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_WheelofMisfortune, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_WheelofMisfortune, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_WheelofMisfortune, function Actions )
endfunction
endscope
I'll accept any comments and constructive criticism with open arms, as I'm still a bit of a nublet when it comes to JASS.
Thanks, hopefully you find this useful .
Tell me if I've forgotten any information on this post.
Version 1.4: Nulled some variables, fixed some issues with the trigger using static values instead of the globals and made the spell not hit structures. View attachment Wheel of Misfortune v1.4 by GG_Pope.w3x