![]() |
#16 | |
CUSTOM USER TITLE!!!!!!!!
|
![]() Quote:
|
|
![]() |
![]() |
Sponsored Links - Login to hide this ad! |
|
![]() |
#17 | |
Inactive as fuck
Join Date: Jun 2007
Posts: 496
![]() ![]() ![]() ![]() |
![]() Quote:
Bhaal? |
|
![]() |
![]() |
![]() |
#18 |
User
Join Date: Oct 2006
Posts: 69
![]() |
![]() Cool!! Very efficient.. I'll use this in future maps..
__________________ |
![]() |
![]() |
![]() |
#19 |
User
Join Date: Apr 2008
Posts: 49
![]() |
![]() I tried implementing the splitting lightning into my map, but I wanted it to use Rising_Dusk's Damage Detection system and hit mechanical units. I went wrong somewhere because it is no longer functioning. I mainly changed the condition line to include anything that is not a structure or dead. I also changed the damage dealings to UnitDamageTargetEx() and commented out the other ones.
Rising_Dusk's Damage Detection System ![]() //******************************************************************************* //* * //* D A M A G E D E T E C T I O N * //* Actual Code * //* v1.06 * //* * //* By: Rising_Dusk * //* * //******************************************************************************* library DamageSystem initializer DamageSystemInit globals //********************************************************* //* These are the configuration constants for the system //* //* DummyUnitID: What the dummy unit raw ID is for your map //* DamageTypeCount: The number of damage types declared in the system //* private constant integer DummyUnitID = 'hfoo' private integer DamageTypeCount = 3 //********************************************************* //* These are the constant globals for ease of use //* constant integer DAMAGE_TYPE_ATTACK = 0 constant integer DAMAGE_TYPE_SPELL = 1 constant integer DAMAGE_TYPE_EXTRA = 2 //* To add new constants, simply follow the naming convention and increment //* the number accordingly. You shouldn't change or remove the first of the //* damage types, since it is a special case, but you can change the others //* however you'd like. //********************************************************* //* These are static constants used by the system and shouldn't be changed //* //* RunTrigger: The trigger that runs on the damage event //* AddTrigger: The trigger that adds the damage event //* Count: Counts how many registrations exist //* Cache: The game cache used by the system //* //* Trg: The trigger array with acts/conds to fire //* TrgCount: Arbitrary maximum of how many events will be //* registered at once. This is only used during //* initialization and making this arbitrarily large //* (But under 8191) is not problematic. //* public trigger RunTrigger = CreateTrigger() public trigger AddTrigger = CreateTrigger() private integer Count = 0 private gamecache Cache = null private trigger array Trg private constant integer TrgCount = 256 //* Temporary variables used by the system private unit DamageSource = null private unit DamageTarget = null private integer DamageType = 0 private real Damage = 0. endglobals //****************************************************************************** //****************************************************************************** private function H2I takes handle h returns integer return h return 0 endfunction //****************************************************************************** //****************************************************************************** //* The new damage function used by the system function UnitDamageTargetEx takes unit source, unit target, real damage, attacktype attackType, integer damageType, boolean ConsiderArmor returns boolean local boolean b = false set DamageType = damageType set DamageSource = source if ConsiderArmor then set b = UnitDamageTarget(source, target, damage, false, false, attackType, DAMAGE_TYPE_NORMAL, null) else set b = UnitDamageTarget(source, target, damage, false, false, attackType, DAMAGE_TYPE_UNIVERSAL, null) endif if not b then set DamageType = 0 set DamageSource = null endif return b endfunction //* The method by which one registers a trigger with the system function TriggerRegisterDamageEvent takes trigger trg returns boolean if trg == null then return false endif set Trg[Count] = trg call StoreInteger(Cache, I2S(H2I(trg)), SCOPE_PREFIX+"Index", Count) set Count = Count + 1 return true endfunction //* The method by which one unregisters a trigger from the system function TriggerUnregisterDamageEvent takes trigger trg returns boolean local integer i = 0 if trg == null then return false endif set i = GetStoredInteger(Cache, I2S(H2I(trg)), SCOPE_PREFIX+"Index") if trg != Trg[i] then return false endif set Trg[i] = Trg[Count] call StoreInteger(Cache, I2S(H2I(Trg[i])), SCOPE_PREFIX+"Index", i) set Count = Count - 1 return true endfunction //* Initialization shorthand to register a new damage type externally function RegisterDamageType takes nothing returns integer local integer i = DamageTypeCount set DamageTypeCount = DamageTypeCount + 1 return i endfunction //****************************************************************************** //****************************************************************************** //* Wrappers for the system that can get inlined anyways function GetTriggerDamageType takes nothing returns integer return DamageType endfunction function GetTriggerDamageSource takes nothing returns unit return DamageSource endfunction function GetTriggerDamageTarget takes nothing returns unit return DamageTarget endfunction function GetTriggerDamage takes nothing returns real return Damage endfunction //****************************************************************************** //****************************************************************************** private function RunConditions takes nothing returns boolean //* The conditions for what must be true for damage detection to run return GetEventDamage() >= 0.0001 endfunction private function AddConditions takes nothing returns boolean //* The conditions for registering a unit with the damage system return true endfunction private function PreloadConditions takes unit u returns boolean //* The conditions for preloading a unit to the damage system return true endfunction //****************************************************************************** //****************************************************************************** private function Run takes nothing returns nothing local unit u = GetEventDamageSource() local unit s = DamageSource local unit t = GetTriggerUnit() local integer i = 0 local integer d = DamageType local real r = GetEventDamage() if DamageSource == null then set d = DAMAGE_TYPE_ATTACK set s = u endif loop exitwhen i > Count set Damage = r set DamageTarget = t set DamageSource = s set DamageType = d if IsTriggerEnabled(Trg[i]) and TriggerEvaluate(Trg[i]) then call TriggerExecute(Trg[i]) endif set i = i + 1 endloop set Damage = 0. set DamageTarget = null set DamageSource = null set DamageType = 0 set u = null set s = null set t = null endfunction private function Load takes nothing returns nothing call TriggerRegisterUnitEvent(RunTrigger, GetEnteringUnit(), EVENT_UNIT_DAMAGED) endfunction //****************************************************************************** //****************************************************************************** private function PreloadUnits takes nothing returns boolean if PreloadConditions(GetFilterUnit()) then call TriggerRegisterUnitEvent(RunTrigger, GetFilterUnit(), EVENT_UNIT_DAMAGED) endif return false endfunction private function DamageSystemInit takes nothing returns nothing local rect r = GetWorldBounds() local region re = CreateRegion() local boolexpr b = Condition(function PreloadUnits) local group g = CreateGroup() local integer i = 0 call FlushGameCache(InitGameCache("GameCache.x")) set Cache = InitGameCache("GameCache.x") set RunTrigger = CreateTrigger() call TriggerAddAction(RunTrigger, function Run) call TriggerAddCondition(RunTrigger, Condition(function RunConditions)) call GroupEnumUnitsInRect(g, r, b) set AddTrigger = CreateTrigger() call RegionAddRect(re, r) call TriggerRegisterEnterRegion(AddTrigger, re, null) call TriggerAddAction(AddTrigger, function Load) call TriggerAddCondition(AddTrigger, Condition(function AddConditions)) loop exitwhen i > TrgCount set Trg[i] = null set i = i + 1 endloop call RemoveRect(r) call DestroyGroup(g) call DestroyBoolExpr(b) set re = null set g = null set b = null set r = null endfunction endlibrary Splitting Lightning ![]() //*************************************************************************************************** //* =================== //* Splitting Lightning - No chategory. //* =================== //* Made by Daminon. //* //* //* How to implement: //* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ //* 1. Copy the spell "Splitting Lightning" into your map. //* //* 2. Copy this trigger into your map. //* //* //* Data info: //* ŻŻŻŻŻŻŻŻŻŻ //* Special effect on initial target = Target, this is just to get the sound of the extra lightnings. //* //* Trigger added damage = true //* //* //* Targets allowed: //* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ //* Used by the triggering spell. //* Enemy + target options //* //*************************************************************************************************** //VARABLE CONFIGURATION //Implementation //--------------------------------------------------------------------------------------------------- constant function SplittingLightning_SpellId takes nothing returns integer //The rawcode of the triggering spell. return 'A05F' endfunction //--------------------------------------------------------------------------------------------------- //Ability data //--------------------------------------------------------------------------------------------------- constant function SplittingLightning_MaxTargets takes integer Level returns integer //The amount of extra targets. return Level + 1 endfunction //--------------------------------------------------------------------------------------------------- function SplittingLightning_Radius takes real Level returns real //The radius. Know that this vaule must not be higher than the cast range of the triggering and //the dummy spell. return 350 + Level * 0 endfunction //--------------------------------------------------------------------------------------------------- function SplittingLightning_TargetOptions takes nothing returns boolean //Target options to decide which units shall be cound as valid targets. return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 and (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) == false// and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)) and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)) and GetOwningPlayer(GetFilterUnit()) != Player(PLAYER_NEUTRAL_PASSIVE) endfunction //--------------------------------------------------------------------------------------------------- function SplittingLightning_Damage takes real Level returns real //Damage dealed to all targets. return 120 + Level * 20 endfunction //--------------------------------------------------------------------------------------------------- //SPELL CODE //=================================================================================================== function Trig_SplittingLightning_Actions takes nothing returns nothing local unit C = GetSpellAbilityUnit() local unit T = GetSpellTargetUnit() local unit F local integer L = GetUnitAbilityLevel(C, SplittingLightning_SpellId()) local integer MT = SplittingLightning_MaxTargets(L) local integer MMT = 0 local integer DId = GetDummyId() local integer LiI = 0 local location Lo = GetUnitLoc(T) local real R = SplittingLightning_Radius(L) local real X1 = GetLocationX(Lo) local real Y1 = GetLocationY(Lo) local real Z1 = GetLocationZ(Lo) local real X2 = GetUnitX(C) local real Y2 = GetUnitY(C) local real Z2 local real D = SplittingLightning_Damage(L) local group G1 = CreateGroup() local group G2 = CreateGroup() local boolexpr TO = Condition(function SplittingLightning_TargetOptions) local lightning array Li local player O = GetOwningPlayer(C) call RemoveLocation(Lo) call TriggerSleepAction(0.1) call GroupEnumUnitsInRange(G1, X1, Y1, R, TO) call GroupRemoveUnit(G1, T) //call UnitDamageTarget(C, F, D, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) call UnitDamageTargetEx(C, F, D, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_SPELL, false) set bj_wantDestroyGroup = false if (CountUnitsInGroup(G1) > 0) then call DestroyEffect(AddSpellEffectById(SplittingLightning_SpellId(), EFFECT_TYPE_TARGET, X1, Y1)) loop set F = FirstOfGroup(G1) exitwhen (F == null) if (IsUnitEnemy(F, O)) then call GroupAddUnit(G2, F) endif call GroupRemoveUnit(G1, F) endloop set bj_wantDestroyGroup = false set MMT = CountUnitsInGroup(G2) if (MMT <= MT) then call GroupAddGroup(G2, G1) else call GroupClear(G1) set G1 = GetNClosestUnits(G2, X1, Y1, R, MT) endif loop set F = FirstOfGroup(G1) exitwhen (F == null) //call UnitDamageTarget(C, F, D, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS) call UnitDamageTargetEx(C, F, D, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_SPELL, false) set Lo = GetUnitLoc(F) set X2 = GetLocationX(Lo) set Y2 = GetLocationY(Lo) set Z2 = GetLocationZ(Lo) call RemoveLocation(Lo) set Li[LiI] = AddAttachedLightningEx("CLPB", false, T, Z1, F, Z2) set LiI = LiI + 1 call GroupRemoveUnit(G1, F) endloop call TriggerSleepAction(0.7) loop call DestroyAttachedLightning(Li[LiI]) exitwhen (LiI == 0) set LiI = LiI - 1 endloop endif call RemoveLocation(Lo) call DestroyGroup(G2) call DestroyGroup(G1) call DestroyBoolExpr(TO) set G2 = null set G1 = null set Lo = null set TO = null set C = null set T = null set F = null set O = null endfunction //EVENT AND CONDTION //=================================================================================================== function Trig_SplittingLightning_Conditions takes nothing returns boolean return GetSpellAbilityId() == SplittingLightning_SpellId() endfunction function InitTrig_SplittingLightning takes nothing returns nothing set gg_trg_SplittingLightning = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_SplittingLightning, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_SplittingLightning, Condition( function Trig_SplittingLightning_Conditions ) ) call TriggerAddAction( gg_trg_SplittingLightning, function Trig_SplittingLightning_Actions ) endfunction |
![]() |
![]() |
![]() |
#20 |
User
Join Date: Aug 2007
Posts: 68
![]() |
![]() These spells are not vJass, so why are they categorized as such?
|
![]() |
![]() |
![]() |
#21 | |
Procrastination Incarnate
Development Director
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#22 |
User
Join Date: Jan 2011
Posts: 2
![]() |
![]() Nice MAP ^^ |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
|