Mod for WASD Camera and extra
Introduction
I always hope to use WASD keys to move my camera in game. Moreover, it is really annoyed that when I constructing buildings, I need to press "Alt" key and mouse scroll to zoom and it reset my mouse cursor to the center!!
However, when I search on the web, the only thing I found is using third party program to remap the keys and also it couldn't suit all my needs:
https://steamcommunity.com/app/57690/discussions/0/846958724745718767/
So, I decided to mod the game myself.
However, when I search on the web, the only thing I found is using third party program to remap the keys and also it couldn't suit all my needs:
https://steamcommunity.com/app/57690/discussions/0/846958724745718767/
So, I decided to mod the game myself.
Before modding
WARNING: All key bindings for constructing buildings will be lost and make sure you backup all your saves!!
WARNING: Please note that I have a single crash when I use first use the mod but no more after the mod clear all the key bindings for constructing buildings.
WARNING: I will not take any responsibility for any crash, saves lost or bug fix because this guide is just only for sharing and history keeping purpose.
The mod in this guide will allows you to:
- Bind WASD keys for Camera movement.
- Zoom in and out with mouse scroll without pressing "alt" when constructing buildings
- Bind QE keys for rotating buildings
WARNING: Please note that I have a single crash when I use first use the mod but no more after the mod clear all the key bindings for constructing buildings.
WARNING: I will not take any responsibility for any crash, saves lost or bug fix because this guide is just only for sharing and history keeping purpose.
The mod in this guide will allows you to:
- Bind WASD keys for Camera movement.
- Zoom in and out with mouse scroll without pressing "alt" when constructing buildings
- Bind QE keys for rotating buildings
Start modding
1. Go to "C:\Program Files (x86)\Steam\steamapps\common\Tropico 4\Game". If the "Game" directory is not exists, create one.
2. Create a file called "keybindingsMod.lua" and copy the following content into it and save.
2. Create a file called "keybindingsMod.lua" and copy the following content into it and save.
-- Keybindings Mod
KeybindingsMod = function()
for id, key in pairs(BuildingMenuUA) do
BuildingMenuUA[id].key = "None"
end
MiscKeys.CameraForward.key = "W"
MiscKeys.CameraBack.key = "S"
MiscKeys.CameraLeft.key = "A"
MiscKeys.CameraRight.key = "D"
ConstantUA.DE_ConstructionStepRotateLeft.key = "Q"
ConstantUA.DE_ConstructionStepRotateRight.key = "E"
constructionTerminalTarget.OnMouseWheelForward = function()
return "continue"
end
constructionTerminalTarget.OnMouseWheelBack = function()
return "continue"
end
end
-- Only fire once
local FiredOnce = false
-- UA Set Mode
OnMsg.UASetMode = function(actions,mode)
-- Fire until fired once
if not FiredOnce then
-- If we boot, trip it ...
if(mode == "Boot") then
FiredOnce = true
-- Run the thread to bypass it
CreateRealTimeThread(function()
-- Do mod loading code here.
KeybindingsMod()
end)
end
end
end
-- T4 (non MT) approach
OnMsg.ClassesPreprocess = function()
KeybindingsMod()
end
3. Done!
Credit
Here, I would like to thanks all the guides in the following link to make my own mod.
Inspired by the guide:
https://steamcommunity.com/sharedfiles/filedetails/?id=404449551
This help me a lot to understand how to make my own mod:
https://www.tapatalk.com/groups/tropicomoddng/files-for-mod-t506.html
This is also a great reference for another way to do key mapping:
https://steamcommunity.com/app/57690/discussions/0/846958724745718767/
And thanks all to take time to read my guide. I am sorry if you find difficulties to read my guide because my bad English as it is not my first language.
Inspired by the guide:
https://steamcommunity.com/sharedfiles/filedetails/?id=404449551
This help me a lot to understand how to make my own mod:
https://www.tapatalk.com/groups/tropicomoddng/files-for-mod-t506.html
This is also a great reference for another way to do key mapping:
https://steamcommunity.com/app/57690/discussions/0/846958724745718767/
And thanks all to take time to read my guide. I am sorry if you find difficulties to read my guide because my bad English as it is not my first language.
This guide was created by its original author on the Steam Community. Are you the author and want it removed? Request removal.