- Joined
- Jan 27, 2007
- Messages
- 208
Here`s my map Custom Script
This is my map Detect Damage trigger
and my map Damage Register Trigger
note : I dont understand JASS, i just copy it from my friend.....but i do Muscle Attack Auto Cast Active trigger with myself...
JASS:
// ===========================
function H2I takes handle h returns integer
return h
return 0
endfunction
// ===========================
function LocalVars takes nothing returns gamecache
return udg_LocalVars
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTriggerAction takes handle subject, string name returns triggeraction
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
// ===========================
This is my map Detect Damage trigger
JASS:
function AnyUnitTakesDamage takes nothing returns nothing
call ConditionalTriggerExecute( gg_trg_Damage_Register )
endfunction
// part 1
function AddDamageTriggers takes nothing returns nothing
local trigger takedamage = CreateTrigger()
call TriggerRegisterUnitEvent(takedamage,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
call SetHandleHandle(takedamage,"action",TriggerAddAction(takedamage,function AnyUnitTakesDamage))
call SetHandleHandle(GetTriggerUnit(),"TakeDamageTrigger",takedamage)
endfunction
// part 2
function RemoveDamageTriggers takes nothing returns nothing
local trigger me = GetHandleTrigger(GetTriggerUnit(),"TakeDamageTrigger")
// delete action and trigger
call TriggerRemoveAction(me,GetHandleTriggerAction(me,"action"))
call DestroyTrigger(me)
call FlushHandleLocals(me)
set me = null
endfunction
// part 3
function InitTrig_Detect_Damage_Events takes nothing returns nothing
local trigger entermap = CreateTrigger()
local group startingunits = CreateGroup()
local unit u
local trigger takedamage
local trigger upondeath = CreateTrigger()
call GroupEnumUnitsInRect(startingunits,bj_mapInitialPlayableArea,null)
loop
set u = FirstOfGroup(startingunits)
exitwhen u == null
set takedamage = CreateTrigger()
call TriggerRegisterUnitEvent(takedamage,u,EVENT_UNIT_DAMAGED)
call SetHandleHandle(takedamage,"action",TriggerAddAction(takedamage,function AnyUnitTakesDamage))
call SetHandleHandle(u,"TakeDamageTrigger",takedamage)
call GroupRemoveUnit(startingunits,u)
endloop
set takedamage = null
// unit enters the map/revives
call TriggerRegisterAnyUnitEventBJ(entermap ,EVENT_PLAYER_HERO_REVIVE_FINISH)
call TriggerRegisterEnterRectSimple(entermap, bj_mapInitialPlayableArea)
call TriggerAddAction(entermap,function AddDamageTriggers)
// unit dies
call TriggerRegisterAnyUnitEventBJ(upondeath,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(upondeath,function RemoveDamageTriggers)
endfunction
and my map Damage Register Trigger
-
Damage Register
- Events
- Conditions
-
Actions
- Trigger - Run Muscle Attack Auto Cast Active <gen> (checking conditions)
-
Muscle Attack Auto Cast Active
- Events
-
Conditions
- MuscleAttackAutoCast[(Player number of (Owner of (Damage source)))] Equal to True
- (Mana of (Damage source)) Greater than or equal to 18.00
-
Actions
- Trigger - Turn off (This trigger)
- Set MuscleAttackDamageReal[(Player number of (Owner of (Damage source)))] = ((0.40 + (0.10 x (Real((Level of General Muscle Attack for (Damage source)))))) x (Real((Strength of (Damage source) (Include bonuses)))))
- Set MuscleAttackDamageInteger[(Player number of (Owner of (Damage source)))] = (Integer(MuscleAttackDamageReal[(Player number of (Owner of (Damage source)))]))
- Unit - Cause (Damage source) to damage (Triggering unit), dealing ((0.40 + (0.10 x (Real((Level of General Muscle Attack for (Damage source)))))) x (Real((Strength of (Damage source) (Include bonuses))))) damage of attack type Hero and damage type Normal
- Floating Text - Create floating text that reads (|c00ff0303 + ((String(MuscleAttackDamageInteger[(Player number of (Owner of (Damage source)))])) + |r)) above (Triggering unit) with Z offset 0.00, using font size 9.50, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Set the velocity of (Last created floating text) to 30.00 towards 90.00 degrees
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 2.50 seconds
- Floating Text - Change the fading age of (Last created floating text) to 1.75 seconds
- Floating Text - Hide (Last created floating text) for (All players matching ((Matching player) Not equal to (Owner of (Damage source))))
- Floating Text - Show (Last created floating text) for (Player group((Owner of (Damage source))))
- Trigger - Turn on (This trigger)
note : I dont understand JASS, i just copy it from my friend.....but i do Muscle Attack Auto Cast Active trigger with myself...