View Single Post
  #1  
Old 27-10-2011, 14:58
cocodrilo cocodrilo is offline
Registered User
 
Join Date: Jun 2011
Location: spain
Posts: 43
Thanks: 0
Thanked 1 Time in 1 Post
cocodrilo is on a distinguished road
Stronghold3 Trainer source code (by sicheats) Added god mode

This is the source code for the sicheats trainer, to run is necesary a dll included in the download rar. source of dll is not need, only loads a lua script and handle the onKeyDown function.

EDITED: added resources option.

Fixed: environment script execution fixed in the dll. link to dll http://www.megaupload.com/?d=UO8TMT05

Code:
--StrongHold3 trainer by cocodrilo.
--can you make your own options.
-- www.sicheats.com

function getLocalPlayer()
 local e = { GameLib.GetEstates() }
 for n,tmp in ipairs(e) do
   if tmp and tmp:GetPlayer():IsHumanControlled() then
     return tmp
   end
 end
 return nil
end

function addGold(gValue)
 local miPlayer = getLocalPlayer()
 if miPlayer~=nil then
   miPlayer.m_gameState.iGold = miPlayer.m_gameState.iGold + gValue
 end
end

function addHonour(hValue)
 local miPlayer = getLocalPlayer()
 if miPlayer~=nil then
   miPlayer.m_gameState.iHonour  = miPlayer.m_gameState.iHonour + hValue
 end
end

function addResources(rValue)
 local miPlayer = getLocalPlayer()
 if miPlayer~=nil then
   for i=1,31 do
     miPlayer.m_gameState.hResources[i] = Inc(miPlayer.m_gameState.hResources[i],rValue)
   end
 end
end

function Inc(a,b)
 return a+b
end

--Hooked Damage function. simply return, not call the original.
function miDamage()
 return
end

function setGodMode()
 local ent = GameLib.GetEntityUnderMouse()
 if ent~=nil then
  ent.Damage = miDamage
 end
end

function onKeyDown(key)
 if key==112 then  --F1: add gold
   addGold(5000)
 elseif key==113 then  --F2: add honour
   addHonour(1000)
 elseif key==114 then  --F3: no build costs
   Game.Options.Cheats.bNoBuildCosts = true
 elseif key==115 then  --F4: add resources
   addResources(1000)
 elseif key == 116 then -- F5: add god mode to selected unit
   setGodMode()
 end
end

Last edited by cocodrilo; 28-10-2011 at 17:25.
Reply With Quote
Sponsored Links