gameplay:multiplayer:heldenmod:codev0_6
Heldenmod Code V0.6
Zur Übersichtsseite zum Heldenmod
So, hier mal mein kompletter Heldenmod im MPComfort Skript integriert: ACHTUNG - funktioniert erstmal nur mit dem MPcomfort ;) Siehe die Testmaps auf dedk.de für den kompletten code
function SetupHeroMod() mpMOD_HeroMOD = {} for i = 1,8 do mpMOD_HeroMOD[i] = {} for u = 1,12 do mpMOD_HeroMOD[i][u] = {} end end mpMOD_HeroMOD[1][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(1) end mpMOD_HeroMOD[1][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(1) end mpMOD_HeroMOD[2][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(2) end mpMOD_HeroMOD[2][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(2) end mpMOD_HeroMOD[3][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(3) end mpMOD_HeroMOD[3][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(3) end mpMOD_HeroMOD[4][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(4) end mpMOD_HeroMOD[4][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(4) end mpMOD_HeroMOD[5][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(5) end mpMOD_HeroMOD[5][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(5) end mpMOD_HeroMOD[6][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(6) end mpMOD_HeroMOD[6][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(6) end mpMOD_HeroMOD[7][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(7) end mpMOD_HeroMOD[7][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(7) end mpMOD_HeroMOD[8][2][3] = function() mpMOD_HeroMOD_PilgrimUnverwundbarkeit(8) end mpMOD_HeroMOD[8][6][1] = function() mpMOD_HeroMOD_HeliasUeberzeugung(8) end mpMOD_HeroMODId = {} for i = 1,8 do mpMOD_HeroMODId[i] = {} for u = 1,12 do mpMOD_HeroMODId[i][u] = {} for v = 1,3 do if not(mpMOD_HeroMOD[i][u][v] == nil) then mpMOD_HeroMODId[i][u][v] = AddTribute( CreateATribute(8, "", { Gold = 0}, mpMOD_HeroMOD[i][u][v] ) ) end end end end mpMOD_HeroMODCDs = {} for i = 1,8 do mpMOD_HeroMODCDs[i] = {} for u = 1,12 do mpMOD_HeroMODCDs[i][u] = {} for v = 1,3 do mpMOD_HeroMODCDs[i][u][v] = 0 end end end mpMOD_HeroMODAbilityTimeLeft = {} for i = 1,8 do mpMOD_HeroMODAbilityTimeLeft[i] = {} for u = 1,12 do mpMOD_HeroMODAbilityTimeLeft[i][u] = {} for v = 1,3 do mpMOD_HeroMODAbilityTimeLeft[i][u][v] = 0 end end end -- HELIAS mpMOD_HeroMOD_HeliasUeberzeugung = function(_player) local _temp = {Logic.GetPlayerEntities(_player, Entities.PU_Hero6,1) } Logic.HeroSetAbilityChargeSeconds(_temp[2], Abilities.AbilityConvertSettlers) local _heroPos = GetPosition(_temp[2]) local _break = true local _units = 0 Circle_Effect(_heroPos, 3000, _pId, GGL_Effects.FXDarioFear) for i=1, table.getn(gv_leadertable) do local _leaders = {Logic.GetEntitiesInArea( gv_leadertable[i][1], _heroPos.X, _heroPos.Y, 3000, 30 )} for u = 2, table.getn(_leaders) do _units = _units + mpMOD_HeroMOD_Helias_Convert(_player, _leaders[u], gv_leadertable[i][2]) if _units > 1 then break end end if _units > 1 then break end end mpMOD_HeroMODCDs[_player][6][1] = 120 mpMOD_HeroMODId[_player][6][1] = AddTribute( CreateATribute(8, "", { Gold = 0}, mpMOD_HeroMOD[_player][6][1] ) ) end mpMOD_HeroMOD_Helias_Convert = function(_pId, _leaders, _value) if Logic.GetDiplomacyState(_pId, GetPlayer( _leaders)) == Diplomacy.Hostile then local _soldiers = {Logic.GetSoldiersAttachedToLeader(_leaders)} local _freeplace = math.floor(Logic.GetPlayerAttractionLimit(_pId))-math.floor(Logic.GetPlayerAttractionUsage(_pId)) if _freeplace >= (table.getn(_soldiers)+1) then ChangePlayer(_leaders,_pId) return _value else return 2 end end return 0 end GUIAction_Hero6ConvertSettlers = function() local _guiplayer = GUI.GetPlayerID() GUI.PayTribute( 8, mpMOD_HeroMODId[_guiplayer][6][1] ) end mpMOD_HeroMOD_PilgrimUnverwundbarkeit = function(_player) if mpMOD_HeroMODCDs[_player][2][3] <= 0 then local _temp = {Logic.GetPlayerEntities(_player, Entities.PU_Hero2,1) } if not(IsDead(_temp[2])) then mpMOD_HeroMODAbilityTimeLeft[_player][2][3] = 20 mpMOD_HeroMODCDs[_player][2][3] = 120 StartSimpleJob(mpMOD_HeroMOD_PilgrimUnverwundbarkeitJob, _player, _temp[2]) end end mpMOD_HeroMODId[_player][2][3] = AddTribute( CreateATribute(8, "", { Gold = 0}, mpMOD_HeroMOD[_player][2][3] ) ) end mpMOD_HeroMOD_PilgrimUnverwundbarkeitJob = function(_pId, _heroId) if IsDead(_heroId) or mpMOD_HeroMODAbilityTimeLeft[_player][2][3] == 0 then mpMOD_HeroMODAbilityTimeLeft[_player][2][3] = 0 return true end mpMOD_HeroMODAbilityTimeLeft[_player][2][3] = mpMOD_HeroMODAbilityTimeLeft[_player][2][3] - 1 --local _heroPos = GetPosition(_temp[2]) --Logic.CreateEffect( GGL_Effects.FXDarioFear, _heroPos.X, _heroPos.Y, _pId ); end HeroManualCooldown = function(_pId, _mpMOD_HeroId, _mpMOD_AbilityId, _heroId, _ability, _rechargeTime) if not(IsExisting(_heroId)) then mpMOD_HeroMODCDs[_pId][_mpMOD_HeroId][_mpMOD_AbilityId] = 0 return true end if IsDead(_heroId) then mpMOD_HeroMODCDs[_pId][_mpMOD_HeroId][_mpMOD_AbilityId] = _rechargeTime end if mpMOD_HeroMODCDs[_pId][_mpMOD_HeroId][_mpMOD_AbilityId] >= 0 then mpMOD_HeroMODCDs[_pId][_mpMOD_HeroId][_mpMOD_AbilityId] = mpMOD_HeroMODCDs[_pId][_mpMOD_HeroId][_mpMOD_AbilityId] - 1 end if not(_ability == nil) then local _origRechargeTime = Logic.HeroGetAbilityRechargeTime(_heroId, _ability) if not(_rechargeTime == nil) then local _rechargeTime = math.floor(_origRechargeTime / _rechargeTime * (_rechargeTime - mpMOD_HeroMODCDs[_pId][_mpMOD_HeroId][_mpMOD_AbilityId])) Logic.HeroSetAbilityChargeSeconds(_heroId, _ability, _rechargeTime) else return true end end end ActionOnHeroCreated = function() local _eId = Event.GetEntityID() local _eType = Logic.GetEntityType( _eId ) local _pId = GetPlayer(_eId) if _eType == Entities.PU_Hero2 then StartSimpleJob(HeroManualCooldown, _pId, 2, 3, _eId, nil, 120) elseif _eType == Entities.PU_Hero6 then StartSimpleJob(HeroManualCooldown, _pId, 6, 1, _eId, Abilities.AbilityConvertSettlers, 120) end end ActionOnEntityHurt = function() local _attacker = Event.GetEntityID1() --Angreifer local _hurt = Event.GetEntityID2() --Angriffsziel local _eTypeAttacker = Logic.GetEntityType(_attacker) local _eTypeDefender = Logic.GetEntityType(_hurt) if (_eTypeAttacker == Entities.PU_LeaderRifle1 or _eTypeAttacker == Entities.PU_SoldierRifle1) and (_eTypeDefender == Entities.PU_LeaderCavalry1 or _eTypeDefender == Entities.PU_LeaderCavalry2 or _eTypeDefender == Entities.PU_SoldierCavalry1 or _eTypeDefender == Entities.PU_SoldierCavalry2) then MakeInvulnerable(_hurt) elseif Logic.GetEntityType( _hurt )== 185 then if mpMOD_HeroMODAbilityTimeLeft[_player][2][3] > 0 then MakeInvulnerable(_hurt) else MakeVulnerable(_hurt) end else MakeVulnerable(_hurt) end end Trigger.RequestTrigger( Events.LOGIC_EVENT_ENTITY_HURT_ENTITY, "", "ActionOnEntityHurt", 1) Trigger.RequestTrigger( Events.LOGIC_EVENT_ENTITY_CREATED, "", "ActionOnHeroCreated", 1) IsNear = function(_entity, _target, _range) return GetDistance(_entity, _target) <= _range end GetDistance = function(_a, _b) if type(_a) ~= "table" then _a = GetPosition(_a); end if type(_b) ~= "table" then _b = GetPosition(_b); end return math.sqrt((_a.X - _b.X)^2+(_a.Y - _b.Y)^2) end rangedHeroTable = {Entities.PU_Hero10, Entities.PU_Hero4, Entities.CU_Barbarian_Hero} for i = 1,8 do Comfort_TrackEntityIni(i,Entities.PU_Hero10) Comfort_TrackEntityIni(i,Entities.PU_Hero4) Comfort_TrackEntityIni(i,Entities.CU_Barbarian_Hero) end DestroyRangedEffectJob = function() for _pId = 1,8 do for _pHId = 1,3 do if table.getn(Track_Entity_Table[_pId][rangedHeroTable[_pHId]]) > 0 then for _pId2 = 1,8 do for _pHId2 = 1,3 do if not(_pId == _pId2 and _pHId == _pHId2) then if table.getn(Track_Entity_Table[_pId2][rangedHeroTable[_pHId2]]) > 0 then if (_pId == _pId2) or not(Logic.GetDiplomacyState(_pHId, _pHId2) == Diplomacy.Hostile) then if IsNear(Track_Entity_Table[_pId][rangedHeroTable[_pHId]][1], Track_Entity_Table[_pId2][rangedHeroTable[_pHId2]][1], 3000) then local hero1time = Logic.GetRangedEffectTimeLeft(Track_Entity_Table[_pId][rangedHeroTable[_pHId]][1]) local hero2time = Logic.GetRangedEffectTimeLeft(Track_Entity_Table[_pId2][rangedHeroTable[_pHId2]][1]) if not(hero1time == nil or hero2time == nil) then if (hero1time > 0 and hero2time > 0) then local _rechargeTime = Logic.HeroGetAbiltityChargeSeconds(Track_Entity_Table[_pId2][rangedHeroTable[_pHId2]][1], Abilities.AbilityRangedEffect) ReplaceEntity( Track_Entity_Table[_pId2][rangedHeroTable[_pHId2]][1], rangedHeroTable[_pHId2] ) Logic.HeroSetAbilityChargeSeconds(Track_Entity_Table[_pId2][rangedHeroTable[_pHId2]][1], Abilities.AbilityRangedEffect, _rechargeTime) end end end end end end end end end end end end StartSimpleJob(DestroyRangedEffectJob) --mpMOD_HeroMOD_PilgrimUnverwundbarkeit(2) --SetHostile(1,2) end -- FOLGENDEN CODE NICHT VERAENDERN => COMFORTS function CxToolsInclude() CxTools = CxTools or {}; function CxTools:Init() CxTools:InitUnpackFix(); CxTools:InitTriggers(); end --######################################################################### --### --### Utility Functions --### function CxTools.Panic(_text) --Message("-----------------------------------------"); --Message("Error: " .. tostring(_text)); --Message("-----------------------------------------"); assert(true,tostring(_text)) --local _table = { text = _text }; --StartSimpleJob(CxTools.GlobalTriggerDebug, _table); end --######################################################################### --### --### unpack()-Fix --### function CxTools:InitUnpackFix() if not unpack{true} then local unpack2; unpack2 = function(_table, _i) _i = _i or 1; assert(type(_table) == "table"); if _i <= table.getn(_table) then return _table[_i], unpack2(_table, _i + 1); end end unpack = unpack2; end end --######################################################################### --### --### Trigger Functions --### --Trigger-Fix / improvement function CxTools:InitTriggers() CxTools.tTriggers = {}; CxTools.nTriggerNum = 0; CxTools.GlobalTriggerConditionCallbackWrapperName = "TriggerConditionCallbackWrapper"; CxTools.GlobalTriggerActionCallbackWrapperName = "TriggerActionCallbackWrapper"; CxTools.GlobalTriggerDebug = "MessageTriggerDebug"; CxTools.Mission_OnSaveGameLoaded = Mission_OnSaveGameLoaded; Mission_OnSaveGameLoaded = function() CxTools:HookAPITrigger(); CxTools.Mission_OnSaveGameLoaded(); end; CxTools:HookAPITrigger(); assert( not _G[CxTools.GlobalTriggerConditionCallbackWrapperName] ); _G[CxTools.GlobalTriggerConditionCallbackWrapperName] = function(_sId) return CxTools:callbackWrapperCondition(_sId); end assert( not _G[CxTools.GlobalTriggerActionCallbackWrapperName] ); _G[CxTools.GlobalTriggerActionCallbackWrapperName] = function(_sId) return CxTools:callbackWrapperAction(_sId); end --Comfort Functions CxTools.StartSimpleJobOrig = StartSimpleJob; StartSimpleJob = function(...) return CxTools:StartSimpleJob(unpack(arg)); end CxTools.StartSimpleHiResJobOrig = StartSimpleHiResJob; StartSimpleHiResJob = function(...) return CxTools:StartSimpleHiResJob(unpack(arg)); end CxTools.StartJobOrig = StartJob; StartJob = function(...) return CxTools:StartJob(unpack(arg)); end CxTools.StartHiResJobOrig = StartHiResJob; StartHiResJob = function(...) return CxTools:StartHiResJob(unpack(arg)); end assert( not _G[CxTools.GlobalTriggerDebug] ); _G[CxTools.GlobalTriggerDebug] = function(_table) assert(type(_table) == "table"); _table.seconds = _table.seconds or 0; _table.seconds = _table.seconds + 1; if math.mod(_table.seconds, 15) == 0 then Message("-----------------------------------------"); Message("Error: " .. tostring(_table.text)); Message("-----------------------------------------"); if _table.seconds == 45 then return true; end end end end function CxTools:HookAPITrigger() CxTools.RequestTriggerOrig = Trigger.RequestTrigger; CxTools.UnrequestTriggerOrig = Trigger.UnrequestTrigger; Trigger.RequestTrigger = function(_event, _fCond, _fAction, _isActive, _pCond, _pAction) return CxTools:AddTrigger(_event, _fCond, _fAction, _isActive, _pCond, _pAction); end Trigger.UnrequestTrigger = function( _id ) CxTools:UnrequestTrigger( _id ); end end function CxTools:AddTrigger( _eventType, _funcCondition, _funcAction, _isActive, _paramsCond, _paramsAction ) assert(type(_eventType) == "number"); assert(not _funcCondition or type(_funcCondition) == "string" or type(_funcCondition) == "function" ); assert(type(_funcAction) == "string" or type(_funcAction) == "function"); if _isActive == true then _isActive = 1; elseif _isActive == false then _isActive = 0; else assert( type(_isActive) == "number" and (_isActive == 0 or _isActive == 1) ); end _paramsCond = _paramsCond or {}; _paramsAction = _paramsAction or {}; local sTriggerId = table.getn(CxTools.tTriggers) + 1; if sTriggerId > CxTools.nTriggerNum then CxTools.nTriggerNum = sTriggerId; end local entry = {}; entry.sId = sTriggerId; if _funcCondition ~= "" then entry.funcCondition = _funcCondition; end entry.funcAction = _funcAction; entry.paramsCond = _paramsCond; entry.paramsAction = _paramsAction; local condition = CxTools.GlobalTriggerConditionCallbackWrapperName; local action = CxTools.GlobalTriggerActionCallbackWrapperName; if not _funcCondition or _funcCondition == "" then condition = nil; end local realTriggerId = CxTools.RequestTriggerOrig( _eventType, condition, action, _isActive, {sTriggerId}, {sTriggerId} ); entry.realId = realTriggerId; CxTools.tTriggers[sTriggerId] = entry; return realTriggerId; end function CxTools:callbackWrapperCondition( _sTriggerId ) local tRes = { xpcall( function() return CxTools:callbackWrapperConditionReal( _sTriggerId ); end, CxTools.Panic ) }; table.remove( tRes, 1 ); return unpack( tRes ); end function CxTools:callbackWrapperConditionReal( _sTriggerId ) assert(type( _sTriggerId) == "number" ); local entry = CxTools.tTriggers[_sTriggerId]; assert( entry ); assert( entry.sId == _sTriggerId ); assert( entry.funcCondition ); assert( entry.paramsCond ); local tRes; if type(entry.funcCondition) == "function" then tRes = { xpcall( function() return entry.funcCondition( unpack( entry.paramsCond ) ); end, CxTools.Panic ) }; else local f = _G[entry.funcCondition]; assert(type(f) == "function"); tRes = { xpcall( function() return f( unpack( entry.paramsCond ) ); end, CxTools.Panic ) }; end local bNoErr = table.remove( tRes, 1 ); if not bNoErr then CxTools.tTriggers[_sTriggerId].err = true; end return bNoErr and unpack( tRes ) or not bNoErr; end function CxTools:callbackWrapperAction( _sTriggerId ) local tRes = { xpcall( function() return CxTools:callbackWrapperActionReal( _sTriggerId ); end, CxTools.Panic ) }; table.remove( tRes, 1 ); return unpack( tRes ); end function CxTools:callbackWrapperActionReal( _sTriggerId ) assert(type( _sTriggerId) == "number" ); local entry = CxTools.tTriggers[_sTriggerId]; assert( entry ); assert( entry.sId == _sTriggerId ); assert( entry.funcAction ); assert( entry.paramsAction ); local bNoErr = true; local tRes; if not entry.err then if type(entry.funcAction) == "function" then tRes = { xpcall( function() return entry.funcAction( unpack( entry.paramsAction ) ); end, CxTools.Panic ) }; else local f = _G[entry.funcAction]; assert(type(f) == "function"); tRes = { xpcall( function() return f( unpack( entry.paramsAction ) ); end, CxTools.Panic ) }; end bNoErr = table.remove( tRes, 1 ); end -- check return value if not bNoErr or entry.err or tRes[1] == true then -- Remove this entry, as the trigger is destroyed CxTools.tTriggers[_sTriggerId] = nil; end return entry.err or (bNoErr and unpack( tRes ) or not bNoErr); end function CxTools:UnrequestTrigger( _id ) --assert( type( _id ) == "number" ); for i = 1, CxTools.nTriggerNum, 1 do local t = CxTools.tTriggers[i]; if t and t.realId == _id then CxTools.tTriggers[i] = nil; break; end end CxTools.UnrequestTriggerOrig( _id ); end --######################################################################### --### --### Trigger Comfort Functions --### function CxTools:StartSimpleJob( _functionname, ...) assert(type(_functionname) == "string" or type(_functionname) == "function"); if type(_functionname) == "string" then if arg[1] == nil then return CxTools.StartSimpleJobOrig( _functionname ); else assert(type(_G[_functionname]) == "function"); return Trigger.RequestTrigger( Events.LOGIC_EVENT_EVERY_SECOND, "", _functionname, 1, {}, arg ); end else assert(type(_functionname) == "function"); return Trigger.RequestTrigger( Events.LOGIC_EVENT_EVERY_SECOND, "", _functionname, 1, {}, arg ); end end function CxTools:StartSimpleHiResJob( _functionname, ...) assert(type(_functionname) == "string" or type(_functionname) == "function"); if type(_functionname) == "string" then if arg[1] == nil then return CxTools.StartSimpleHiResJobOrig( _functionname ); else assert(type(_G[_functionname]) == "function"); return Trigger.RequestTrigger( Events.LOGIC_EVENT_EVERY_TURN, "", _functionname, 1, {}, arg ); end else assert(type(_functionname) == "function"); return Trigger.RequestTrigger( Events.LOGIC_EVENT_EVERY_TURN, "", _functionname, 1, {}, arg ); end end function CxTools:StartJob( _functionname, ... ) assert(type(_functionname) == "string" or (type(_functionname) == "function" and type(arg[1]) == "function")); if type(_functionname) == "string" then assert(type(_G["Action_".._functionname]) == "function" and type(_G["Condition_".._functionname]) == "function"); if arg[1] == nil then return CxTools.StartJobOrig(_functionname); else assert(type(arg[1]) == "table" and (not arg[2] or type(arg[2]) == "table")); return Trigger.RequestTrigger(Events.LOGIC_EVENT_EVERY_SECOND, "Condition_".._functionname, "Action_".._functionname, 1, arg[2], arg[1]); end else assert((not arg[2] or type(arg[2]) == "table") and (not arg[3] or type(arg[3]) == "table")); return Trigger.RequestTrigger(Events.LOGIC_EVENT_EVERY_SECOND, arg[1], _functionname, 1, arg[3], arg[2]); end end function CxTools:StartHiResJob( _functionname, ... ) assert(type(_functionname) == "string" or (type(_functionname) == "function" and type(arg[1]) == "function")); if type(_functionname) == "string" then assert(type(_G["Action_".._functionname]) == "function" and type(_G["Condition_".._functionname]) == "function"); if arg[1] == nil then return CxTools.StartHiResJobOrig(_functionname); else assert(type(arg[1]) == "table" and (not arg[2] or type(arg[2]) == "table")); return Trigger.RequestTrigger(Events.LOGIC_EVENT_EVERY_TURN, "Condition_".._functionname, "Action_".._functionname, 1, arg[2], arg[1]); end else assert((not arg[2] or type(arg[2]) == "table") and (not arg[3] or type(arg[3]) == "table")); return Trigger.RequestTrigger(Events.LOGIC_EVENT_EVERY_TURN, arg[1], _functionname, 1, arg[3], arg[2]); end end --######################################################################### --### --### Init! --### CxTools:Init(); end function Globale_Hilfsvariablen_und_Funktionen() Circle_Effect = function(_pos, _range, _pId, _type) local _effect = {} local _sin30 = 0.5 * _range local _cos30 = 0.866 * _range local _sin60 = 0.866 * _range local _cos60 = 0.5 * _range for i = 1,12 do _effect[i] = {} end _effect[1].X = _pos.X + _range; _effect[1].Y = _pos.Y _effect[2].X = _pos.X - _range; _effect[2].Y = _pos.Y _effect[3].X = _pos.X; _effect[3].Y = _pos.Y + _range _effect[4].X = _pos.X; _effect[4].Y = _pos.Y - _range _effect[5].X = _pos.X + _sin30; _effect[5].Y = _pos.Y + _cos30 _effect[6].X = _pos.X + _sin60; _effect[6].Y = _pos.Y + _cos60 _effect[7].X = _pos.X + _sin30; _effect[7].Y = _pos.Y - _cos30 _effect[8].X = _pos.X + _sin60; _effect[8].Y = _pos.Y - _cos60 _effect[9].X = _pos.X - _sin30; _effect[9].Y = _pos.Y - _cos30 _effect[10].X = _pos.X - _sin60; _effect[10].Y = _pos.Y - _cos60 _effect[11].X = _pos.X - _sin30; _effect[11].Y = _pos.Y + _cos30 _effect[12].X = _pos.X - _sin60; _effect[12].Y = _pos.Y + _cos60 for i = 1,12 do Logic.CreateEffect( _type, _effect[i].X, _effect[i].Y, _pId ); end end GetHeroNameByID = function(_ID) if _ID == 1 then return "Dario"; end if _ID == 2 then return "Pilgrim"; end if _ID == 3 then return "Salim"; end if _ID == 4 then return "Erec"; end if _ID == 5 then return "Ari"; end if _ID == 6 then return "Helias"; end if _ID == 7 then return "Kerberos"; end if _ID == 8 then return "Mary"; end if _ID == 9 then return "Varg"; end if _ID == 10 then return "Drake"; end if _ID == 11 then return "Yuki"; end if _ID == 12 then return "Kala"; end end gv_guipId = GUI.GetPlayerID() gv_leadertable = {{Entities.PU_LeaderRifle1,1}, {Entities.PU_LeaderRifle2,2}, {Entities.PU_LeaderSword1,1}, {Entities.PU_LeaderSword2,1}, {Entities.PU_LeaderSword3,2}, {Entities.PU_LeaderSword4,2}, {Entities.PU_LeaderPoleArm1,1}, {Entities.PU_LeaderPoleArm2,1}, {Entities.PU_LeaderPoleArm3,2}, {Entities.PU_LeaderPoleArm4,2}, {Entities.PU_LeaderBow1,1}, {Entities.PU_LeaderBow2,1}, {Entities.PU_LeaderBow3,2}, {Entities.PU_LeaderBow4,2}, {Entities.PU_LeaderHeavyCavalry1,2}, {Entities.PU_LeaderHeavyCavalry2,2}, {Entities.PU_LeaderCavalry1,2}, {Entities.PU_LeaderCavalry2,2}} gvCol = { weiss = "@color:255,255,255", schwarz = "@color:0,0,0", rot = "@color:255,0,0", gelb = "@color:255,232,0", gruen = "@color:0,255,0", dunkelgruen = "@color:0,100,0", blau = "@color:0,0,255", lila = "@color:200,0,200", grau = "@color:150,150,150", tuerkis = "@color:0,180,180", orange = "@color:255,130,0", beige = "@color:190,190,150", hellgrau = "@color:170,170,170", dunkelgrau = "@color:120,120,120", TTgelb = "@color:255,200,0", TTrot = "@color:200,60,0", TUTgruen = "@color:90,190,20", space = "@color:0,0,0,0", } end function Setup_GUIHacks() XGUIEng.TransferMaterials( "Command_Guard","Research_Gilds" ) --XGUIEng.TransferMaterials("Build_Outpost","Command_Guard") GameCallback_GUI_SelectionChanged_OrigProtected = GameCallback_GUI_SelectionChanged; GameCallback_GUI_SelectionChanged = function() GameCallback_GUI_SelectionChanged_OrigProtected() if mpc_GameStartDelay > 0 then XGUIEng.ShowWidget( gvGUI_WidgetID.DestroyBuilding, 0 ); end EndJob( gvTradeLimitJob ) if mpc_Rules.TradeLimit.Cur > 1 then if Logic.GetEntityType( GUI.GetSelectedEntity() ) == 37 then gvTradeLimitJob = StartSimpleHiResJob( "Max_Tradevalue_Limiting" ) end end if Logic.GetEntityType( GUI.GetSelectedEntity() ) == 185 then XGUIEng.TransferMaterials("Build_Outpost","Command_Guard")--,"Build_Outpost") XGUIEng.SetWidgetPosition(1393,75,40) --gvTradeLimitJob = StartSimpleHiResJob( "Max_Tradevalue_Limiting" ) else XGUIEng.TransferMaterials("Research_Gilds","Command_Guard") XGUIEng.SetWidgetPosition(1393,150,5) end end --GUIUpdate_BuyHeroButton_OrigProtected = GUIUpdate_BuyHeroButton; --GUIUpdate_BuyHeroButton = function() -- GUIUpdate_BuyHeroButton_OrigProtected() -- GUIAction_ToggleMenu( "BuyHeroWindow", -1) --end GUITooltip_NormalButton_Orig = GUITooltip_NormalButton GUITooltip_NormalButton = function(_a,_b) --Message("blubb") --Message(_a) if Logic.GetEntityType( GUI.GetSelectedEntity() )== 185 then if _a == "MenuCommandsGeneric/command_guard" then local _text = gvCol.grau.." Zwergenzorn @cr "..gvCol.gelb.." Wirkung: "..gvCol.weiss.." Macht Pilgrim fuer 20 Sekunden unverwundbar" _text = _text.." @cr "..gvCol.gelb.." Cooldown: "..gvCol.rot.." "..mpMOD_HeroMODCDs[gv_guipId][2][3] XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText,_text) XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomCosts,""); --<Hier den Text ändern else GUITooltip_NormalButton_Orig(_a,_b); end else GUITooltip_NormalButton_Orig(_a,_b) end end GUIAction_Command_Orig = GUIAction_Command GUIAction_Command = function(_a) if Logic.GetEntityType( GUI.GetSelectedEntity() )== 185 and _a == 5 then if mpMOD_HeroMODCDs[gv_guipId][2][3] <= 0 then GUI.PayTribute( 8, mpMOD_HeroMODId[gv_guipId][2][3] ) end else GUIAction_Command_Orig(_a) end end end
gameplay/multiplayer/heldenmod/codev0_6.txt · Zuletzt geändert: 2021/09/18 19:16 von 127.0.0.1