Darkchaoself
What is this i dont even
- Reaction score
- 106
Another case of abused spiler tags.
Ghan_04 said:
//**************************************************************************************************************
// KentChow75 / ~Gals~ **
// presents **
// DEATH CURSE **
// **
// For the Tower Contest 2 !! **
// **
** 039;Implementation Instruction039; **
// **
// 1. For the very first thing, you need NewGenJass WorldEditor to get this **
// code works...Since it uses some of the features from it <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /> **
// --Get NewGen World Editor at <a href="http://www.wc3campaigns.net--" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net--</a> **
// **
// 2. When you have got that, it is time to start out implementation. **
// **
// 3. Copy the whole code or trigger of the DeathCurse into your map. **
// **
// 4. Copy all those 4 unit from the object editor to your map. **
// **
// 5. Copy the 2 Ability and 1 buff from the object editor to you map too. **
// **
// 6. Switch to the code now, notice the part with all Constant Function. **
// **
// 7. This is the place where you can edit, the function it does had been written as comment at there. **
// **
// 8. If you are pro enough, you may edit the other code. But watch what you are doing, it may ruin you map. **
// **
// 9. Copy all 4 things from the import manager to your map. **
// **
// 10. Tower ready in use. **
//**************************************************************************************************************
039;Troubleshooting039;
Q. Where to edit the slow percentage of the Death?
A. Advanced -> Gameplay Constants -> Spell-Frost Attack speed reduction (%)
Q. Where to edit the duration of the buff?
A. For the Death? >> ObjectEditor -> Abilities -> Dea|c00D81D07t|rh? -> Duration Hero/Unit
For the DummyClapExplode >> ObjectEditor -> Abilities -> Dummy Clap Explode -> Duration Hero/Unit
039;If there is any other question you need to ask me, you are welcomed to email me at <a href="mailto:[email protected]">kentchow75@gmail.com</a>039;
//------------------------------------------//
//Global Variable //
//------------------------------------------//
globals //
trigger DeathC = CreateTrigger() //
trigger DeathCheck = CreateTrigger() //
trigger Upgrade = CreateTrigger() //
trigger BuffChecker = CreateTrigger() //
trigger Explode = CreateTrigger() //
endglobals //
//------------------------------------------//
//Global Variable End //
//------------------------------------------//
//----------------------------------------------------------------------//
//Constant Functions //
//----------------------------------------------------------------------//
constant function Rtower1 takes nothing returns integer //
return 039;h000039; //Rawcode of DeathCurse lvl 1 //
endfunction //
//
constant function Rtower2 takes nothing returns integer //
return 039;h001039; //Rawcode of DeathCurse lvl 2 //
endfunction //
//
constant function Rtower3 takes nothing returns integer //
return 039;h002039; //Rawcode of DeathCurse lvl 3 //
endfunction //
//
constant function RDeathSpell takes nothing returns integer //
return 039;A002039; //Rawcode of DeathCurse lvl 1 //
endfunction //
//
constant function RDeathBuff takes nothing returns integer //
return 039;B001039; //Rawcode of Death?'s buff //
endfunction //
//
constant function DeathEffe takes nothing returns string //
return "Abilities\\Spells\\Items\\AIso\\AIsoTarget.mdl" //
endfunction //The effect that happen when unit being instant killed //
//
constant function GetPercen takes integer AbilLvl returns integer //
return AbilLvl*2 //Percentage of instant kill //
endfunction //(Level of Death? * <value you want> Current = 2% //
//
constant function RDummyUnit takes nothing returns integer //
return 039;h003039; //Rawcode of the dummy clapper //
endfunction //
//
constant function RDummySpell takes nothing returns integer //
return 039;A000039; //Rawcode of DummyClapExplode //
endfunction //
//
constant function GenericTimer takes nothing returns integer //
return 039;BTLF039; //Rawcode of Generic life time //
endfunction //
//----------------------------------------------------------------------//
//Constant Functions End //
//----------------------------------------------------------------------//
//-------------------------------------------------------------------------
//Explode Trigger
//-------------------------------------------------------------------------
function ExplodeCond takes nothing returns boolean
return (GetUnitUserData(GetDyingUnit())== 1) ==true //Dying unit's custom value is 1 equal to true
endfunction
function ExplodeAct takes nothing returns nothing
local unit target = GetDyingUnit()
local unit dummy
local real Tx2 = GetUnitX(target)
local real Ty2 = GetUnitY(target)
set dummy = CreateUnit(GetOwningPlayer(GetKillingUnit()),RDummyUnit(),Tx2,Ty2,270) //Create a unit at position of dying unit
call UnitAddAbility(dummy,RDummySpell()) //Add dummy clap explode to last created unit
call SetUnitAbilityLevel(dummy,RDummySpell(),1) //Set the lvl of dummy clap explode to 1
call IssueImmediateOrder(dummy,"thunderclap") //Order it to cast dummy clap explode
call UnitApplyTimedLife(dummy,GenericTimer(),2) //Add 2 second generic timed life to last created unit
set target = null //Nulling variable to prevent leaks
set dummy = null // "
endfunction
//-------------------------------------------------------------------------
//Explode Trigger
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//BuffChecker Trigger
//-------------------------------------------------------------------------
function WholeAct takes nothing returns nothing
if GetUnitAbilityLevel(GetEnumUnit(),RDeathBuff())>0 then //if picked unit has Death? buff then
call SetUnitUserData(GetEnumUnit(),1) //set unit's custom value to 1
call SetUnitExploded(GetEnumUnit(),true) //set unit explode on death equal to true
else //else
call SetUnitUserData(GetEnumUnit(),0) //set unit's custom value to 0
call SetUnitExploded(GetEnumUnit(),false) //set unit explode on death equal to false
endif
endfunction
function BuffCheckerAction takes nothing returns nothing
local group Whole = CreateGroup() //localize a group
call GroupEnumUnitsInRect(Whole,bj_mapInitialPlayableArea,null) //pick every unit in the playable map area to the group
call ForGroup(Whole,function WholeAct) //loop action of the group...refer to WholeAct
endfunction
//-------------------------------------------------------------------------
//BuffChecker Trigger End
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//Upgrade Trigger
//-------------------------------------------------------------------------
function UpgradeCond takes nothing returns boolean
return (GetUnitTypeId(GetTriggerUnit()) == Rtower2()) ==true or (GetUnitTypeId(GetTriggerUnit()) == Rtower3()) == true
endfunction //If tower being upgraded is Rtower2 or Rtower3 equal to true
function UpgradeAct takes nothing returns nothing
if GetUnitTypeId(GetTriggerUnit()) == Rtower2() then //If upgraded tower is Rtower 2
call UnitAddAbility(GetTriggerUnit(),RDeathSpell()) //then add Death? to the tower and set the lvl of it to 2
call SetUnitAbilityLevel(GetTriggerUnit(),RDeathSpell(),2)
elseif GetUnitTypeId(GetTriggerUnit()) == Rtower3() then//If upgraded tower is Rtower3 then
call UnitAddAbility(GetTriggerUnit(),RDeathSpell()) //Add Death? to the tower and set the lvl of it to 3
call SetUnitAbilityLevel(GetTriggerUnit(),RDeathSpell(),3)
endif
endfunction
//-------------------------------------------------------------------------
//Upgrade Trigger End
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//DeathCheck Trigger
//-------------------------------------------------------------------------
function DeathCheckCond takes nothing returns boolean
return (GetUnitAbilityLevel(GetTriggerUnit(),RDeathBuff())>0) ==true //Damaged unit has Death? Buff equal to true
endfunction
function DeathCheckAct takes nothing returns nothing
local real Tx = GetUnitX(GetTriggerUnit())
local real Ty = GetUnitY(GetTriggerUnit())
local integer Lvl = GetUnitAbilityLevel(GetTriggerUnit(),RDeathBuff()) //Get the level of buff in the damaged unit
if GetRandomInt(1,100) <= GetPercen(Lvl) then //Get the percentage...
call DestroyEffect(AddSpecialEffect(DeathEffe(),Tx,Ty))//Create a special effect and kill the unit in the next action
call UnitDamageTarget(GetEventDamageSource(),GetTriggerUnit(),99999999999,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call ResetTrigger(GetTriggeringTrigger()) //Reset this trigger to its original form since it is being added a few event
endif
endfunction
//-------------------------------------------------------------------------
//DeathCheck Trigger End
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//DeathC Trigger
//-------------------------------------------------------------------------
function DeathCCond takes nothing returns boolean
return (GetUnitAbilityLevel(GetAttacker(),RDeathSpell()) >0) ==true //if the attacker has Death? spell equal to true
endfunction
function DeathCAct takes nothing returns nothing
call TriggerRegisterUnitEvent(DeathCheck,GetTriggerUnit(),EVENT_UNIT_DAMAGED) //Add a unit event to DeathCheck
endfunction
//-------------------------------------------------------------------------
//DeathC Trigger End
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//Death Curse Main Trigger
//-------------------------------------------------------------------------
function DeathCurseCond takes nothing returns boolean
return (GetUnitTypeId(GetConstructedStructure()) == Rtower1()) == true
endfunction
function Trig_DeathCurse_Actions takes nothing returns nothing
call UnitAddAbility(GetConstructedStructure(),RDeathSpell()) //Add Death? to the tower and set the lvl of it to the lvl of it deserves
call SetUnitAbilityLevel(GetConstructedStructure(),RDeathSpell(),1)
endfunction
//-------------------------------------------------------------------------
//Death Curse Main Trigger End
//-------------------------------------------------------------------------
//===========================================================================
function InitTrig_DeathCurse takes nothing returns nothing
set gg_trg_DeathCurse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_DeathCurse, EVENT_PLAYER_UNIT_CONSTRUCT_FINISH )
call TriggerAddCondition(gg_trg_DeathCurse,Condition(function DeathCurseCond))
call TriggerAddAction( gg_trg_DeathCurse, function Trig_DeathCurse_Actions )
//===========================================================================
//Trigger Registration of DeathC
//===========================================================================
call TriggerRegisterAnyUnitEventBJ( DeathC, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(DeathC,Condition(function DeathCCond))
call TriggerAddAction( DeathC, function DeathCAct )
//===========================================================================
//Trigger Registration of DeathC End
//===========================================================================
//===========================================================================
//Trigger Registration of DeathCheck
//===========================================================================
call TriggerAddAction( DeathCheck, function DeathCheckAct )
call TriggerAddCondition(DeathCheck,Condition(function DeathCheckCond))
//===========================================================================
//Trigger Registration of DeathCheck End
//===========================================================================
//===========================================================================
//Triger Registration of Upgrade
//===========================================================================
call TriggerRegisterAnyUnitEventBJ(Upgrade,EVENT_PLAYER_UNIT_UPGRADE_FINISH)
call TriggerAddAction(Upgrade,function UpgradeAct)
call TriggerAddCondition(Upgrade,Condition(function UpgradeCond))
//===========================================================================
//Triger Registration of Upgrade End
//===========================================================================
//===========================================================================
//Triger Registration of BuffChecker
//===========================================================================
call TriggerRegisterTimerEvent(BuffChecker,0.5,true)
call TriggerAddAction(BuffChecker, function BuffCheckerAction)
//===========================================================================
//Triger Registration of BuffChecker End
//===========================================================================
//===========================================================================
//Triger Registration of Explode
//===========================================================================
call TriggerRegisterAnyUnitEventBJ(Explode,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(Explode, function ExplodeAct)
call TriggerAddCondition(Explode,Condition(function ExplodeCond))
//===========================================================================
//Triger Registration of Explode End
//===========================================================================
endfunction
Excellent. Looks interesting. Though, you have them backwards. Anodes are positive and cathodes are negative.