--------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- --------> HalloWeenPhino03.lua <-------- --------> 1.0 - 09-05-2015 <-------- --------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- CoinData = { Index = "IM_Haloween01", MinLot = 1, MaxLot = 2, } ReturnAI = {} ReturnAI.END = 1 ReturnAI.CPP = 2 MemBlock = {} function HalloWeenPhino03(Handle, MapIndex) cExecCheck ( "HalloWeenPhino03" ) local Var = MemBlock[Handle] if Var == nil then if MapIndex ~= "Fbattle01" then return ReturnAI.CPP end MemBlock[Handle] = {} Var = MemBlock[Handle] Var.Handle = Handle Var.MapIndex = MapIndex cAIScriptFunc( Var.Handle, "ObjectDied", "Phino_Dead" ) end return ReturnAI.CPP end function Phino_Dead( MapIndex, KillerHandle, DeadHandle ) cExecCheck("Phino_Dead") cNoticeString( MapIndex, "ObjectDied has been triggered." ) if MapIndex == nil then CoinReward_DebugLog( "MapIndex == nil on death" ) return end if KillerHandle == nil then CoinReward_DebugLog( "MapIndex = " .. MapIndex .. " : KillerHandle == nil on death" ) return end if DeadHandle == nil then CoinReward_DebugLog( "MapIndex = " .. MapIndex .. " : DeadHandle == nil on death" ) return end local AggroList = { cAggroList( DeadHandle, 5000000 ) } if AggroList == nil then CoinReward_DebugLog( "MapIndex = " .. MapIndex .. " : AggroList == nil" ) return end for i=1, #AggroList do if AggroList[i] ~= nil then local PlayerName = cGetPlayerName( AggroList[i] ) local PlayerCoinIndex = CoinData.Index local PlayerCoinLot = math.random( CoinData.MinLot, CoinData.MaxLot ) CoinReward_DebugLog( "MapIndex = " .. MapIndex .. " : Rewarding " .. PlayerName .. " with " .. PlayerCoinLot .. " " .. PlayerCoinIndex ) cScriptMessage_Obj( AggroList[i], "CoinReward_Notice", PlayerName, tostring(PlayerCoinLot) ) cRewardItem( AggroList[i], PlayerCoinIndex, PlayerCoinLot ) end end MemBlock[DeadHandle] = nil return ReturnAI.CPP end function CoinReward_DebugLog( Message ) cExecCheck("CoinReward_DebugLog") cAssertLog( Message ) end