Post Reply 
 
Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic Modding Tutorial (without a hex editor)
Author Message
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #1
Basic Modding Tutorial (without a hex editor)
This will only work for Tropico PRIOR to the Expansion. If you have Modern Times installed, this will NOT work.

Please, do not save games using mods to the scoreboards online, or complete challenges with them.

It works! This is a trivial example, and complex stuff won't work in the same way, but you can change variables.

2011-Sept-20 00:20 GMT Update: Changed load instructions to align with new findings.

Have a look at a screenshot of the test function (below) in action.

Remember not to overwrite their files, and to have a filename after Game.hpk. More complicated examples of modding will require a different loading sequence, but this is a simple "edit values" modding introduction that means you no longer have to grope around in the dark changing hex values.

This post/thread is just an example of how we can do things without a damned hex editor -- that's so 90s. This is a trivial mod, and harder stuff (e.g. hacking the UI) More information will be added to the main modding thread. This is only partially functional (some things overwrite, some things don't).

Requirements
Step #1 - Prepare your enviroment
Open command prompt or explorer. Go to a directory. For this, I'll be using C:\Testing
  • Create the base folder for building/working on this mod: C:\Tropico4mods\ApartmentBluePrintTest
  • Create the Game folder inside it (optional, but if you don't use it, make sure you don't use HGE or HGO, or if you do you create your own strangenamed subdirectory): C:\Tropico4mods\ApartmentBluePrintTest\Game
  • Create the subfolder of your choice. We'll use it two deep here so we can add other mods inside it too, without overwriting this one. Use something like "zGeorge\apartment_hack" ( mkdir C:\Tropico4mods\ApartmentBluePrintTest\Game\zGeorge\apartment_hack ). You REALLY do not want to mess this up and overwrite one of their folders. Bad things will happen (like the game not loading).

We will be packing "Game\zGeorge\apartment_hack" using the HPK extractor, so we'll grab C:\Tropico4mods\ApartmentBluePrintTest to get the root above Game (I'll explain that in a second).

Step #2 - The Lua File!

Just copy and paste this into a file called anything you want, provided it ends in .lua. We use *.lua because once the HPK loader loads it, the main game will read it within the game directory (using autorun code).

Anyway, the code:
Code:
-- 'OnMsg' hooks are called on messages being passed
-- "ClassesPreprocess" is used part way through loading the classes.
OnMsg.ClassesPreprocess = function()
    Apartment["blueprint_cost"] = 1
    Apartment["num_families"] = 24

    -- Upgrade [1] is the first one (lua lists start at 1)
    -- This sets the aircon power to 0, the quality boost to 1, and the price to $1
    Apartment["upgrades"][1]["price"] = 1
    Apartment["upgrades"][1]["param1"] = 1
    Apartment["upgrades"][1]["power"] = 0
end
-- Dance.

Step 3 - HPK Archiver
Set it to Tropico 4 (though Tropico 3 for Tropico 3, as this might work out of the box for it too).

In the archive section ...
Set the Open Directory to the level above your subdirectory (which is why we made a new, empty, folder for this).

In my example set it to C:\Tropico4mods\ApartmentBluePrintTest\

This means that the internal folder structure will be Game\zGeorge\apartment_hack

Set the "Save File" to your Tropico Path + \Packs\boot\persist\zGeorge.hpk

In my case this is C:\Program Files (x86)\CapsuleGames\Tropico 4 - PC\Packs\boot\persist\zGeorge.hpk (big hello to GreenManGaming Users). I don't know other paths, so please provide yours. If you're stuck, find the Tropico 4 exe. In the same folder is the "Packs" directory, then you just go into boot\persist.

Launch the game, and apartments are horribly broken.

Please try NOT to save your scores to scoreboards or complete challenges with mods like this.

NOTE: I know that this is not complicated. I know that this is pretty trivial, but it's a start, as we can now load external HPKs (you just need an init.lua file).

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
(This post was last modified: 03-04-2012 11:57 PM by Swixel.)
18-09-2011 09:01 AM
Find all posts by this user Quote this message in a reply
El lider maximo Offline
Junior Member
**

Posts: 35
Joined: Aug 2011
Post: #2
RE: Basic Modding Tutorial (without a hex editor)
Swixel, a big big thank you for trying to mod this game!
18-09-2011 10:55 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #3
RE: Basic Modding Tutorial (without a hex editor)
Not a problem Smile

I'm just sad that it fails so bluntly on me, not to mention so frequently. Some of the stuff functions happily, some stuff just complains or does nothing. I'm yet to address why the building data isn't being updated ... but I've found some really interesting stuff today which might help (there MUST be some sort of "refresh" function!)

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
18-09-2011 11:04 AM
Find all posts by this user Quote this message in a reply
mrfisse Offline
Member
***

Posts: 65
Joined: Jul 2011
Post: #4
RE: Basic Modding Tutorial (without a hex editor)
Nice effort, still without a decompiler it's all just pretty pointless.
18-09-2011 11:23 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #5
RE: Basic Modding Tutorial (without a hex editor)
(18-09-2011 11:23 AM)mrfisse Wrote:  Nice effort, still without a decompiler it's all just pretty pointless.

Why do we need a decompiler? I've been working blind.

EDIT: I don't understand why people feel the need to have a decompiler before attempting anything, or why some people feel entitled to a "modkit" or feel that the developer should supply source code or a decompiler. I'm not saying that it's always the case, but I've seen a bit of it in the last few days.

EDIT #2: The above should now be read as: I've already reversed every lua file (it won't necessarily compile, but I have the values and the workflow now).

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
(This post was last modified: 18-09-2011 04:34 PM by Swixel.)
18-09-2011 11:58 AM
Find all posts by this user Quote this message in a reply
mrfisse Offline
Member
***

Posts: 65
Joined: Jul 2011
Post: #6
RE: Basic Modding Tutorial (without a hex editor)
Sorry was not trying to put you off. Just saying that without a decompiler or some mod tools there wont be any modscene for the game. It must be somewhat accessible for a modscene to get going. I just don't understand what your goal is?

Also kinda funny to hear them say that they encourage modding but at the same time provide no help or tools at all. Not very encouraging in my eyes Tongue
18-09-2011 08:19 PM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #7
RE: Basic Modding Tutorial (without a hex editor)
I can't think of any game that actually provides tools, unless the game has a giant "INSTALL PLUGIN HERE" sign hanging off the side.

Decompilers are few and far between. Without pretty heavy modification to any existing ones, they won't work (LuaDec can be tweaked to get some data, but it crashes more frequently than it's worth, and dumps junk, so I threw it into a corner and stomped it off my hard drive).

Apparently there are newer LuaDec versions, and if anyone wants to fiddle with them, they're more than welcome to do so. I don't find bytecode intimidating, just a tad time consuming. There are only 1,269 files, you can get some of the data while in the game, check it out of the game, get the names from a hexeditor or a chunkspy dump. The functions can be read out pretty trivially out of ChunkSpy if you don't like going oldschool with a hex editor -- and ChunkSpy is pretty awesome in that it tends to have X = Y assignments, or at least X1 = X; X2 = Y; X1 = X2 type of thing.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
18-09-2011 11:06 PM
Find all posts by this user Quote this message in a reply
mrfisse Offline
Member
***

Posts: 65
Joined: Jul 2011
Post: #8
RE: Basic Modding Tutorial (without a hex editor)
Oh there is games that have tools available for modding. But sure far from all games have it available. Guess it is the way the game is built from the start that somewhat hinders modding. A plain text-based config system would have been enough for most files i would think and that would modding way more accessible.
19-09-2011 08:57 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #9
RE: Basic Modding Tutorial (without a hex editor)
The real trick is starting somewhere. Once you've got a foothold it gets easier as you can work out what bits and pieces do.

As for plain text, my mod code is substantially slower uncompiled than it is compiled. I shudder to think how much more of a limitation it would impose were the lua in this uncompiled.

Anyway, even the most "basic" structures in this (save for say, number of families per apartment, costs, etc.) get complex pretty fast. Everything interoperates, and one value can change the course of the game.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
19-09-2011 09:38 AM
Find all posts by this user Quote this message in a reply
CoconutKid Offline
Has Been or Never Was?
*******

Posts: 2,019
Joined: Nov 2008
Post: #10
Exclamation RE: Basic Modding Tutorial (without a hex editor)
(19-09-2011 09:38 AM)Swixel Wrote:  ... Everything interoperates, and one value can change the course of the game.

WOW!
What a Concept!

I suspect that is why Timo answered you the way he did. They are surely interested in how fast any category of player can come up to the speed of the development team.

One can learn the game by playing the hell out of it and watching all the details. Others can learn the game by using technology to look at the motor, transmission and axle. Few will know the game the way the developers do.

Sadly, gameplay measured by high scores is no measure of either approach.

Wink
19-09-2011 04:07 PM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #11
RE: Basic Modding Tutorial (without a hex editor)
Oh, yeah, but I mean, even something like 7 families in an apartment building shifts the course of gameplay in weird ways. That's been accessible and people have done it for ages. The abuse on the high score system from things like that sort of pales in comparison to what's possible (though I suspect the 100 million+ scores are as a result of what I think they are). It's pretty trivial to make the game less enjoyable by changing a value the wrong way too (even if it looks like a good idea).

I've played by observation, but at the moment I'm trying more to setup things that don't break the game, but augment the experience instead. I'm tearing my hair out with something substantially more complicated than this (ripping the UI to pieces), and have just re-reversed the same function three times to be sure it works (and it's one of the serious voodoo files). To augment cleanly, I need to do a combination of both things, and right now I'm flicking between gameplay and code to see if my changes make a difference (and if my dock workers enjoy walking).

Anyway, this thread is about some fairly basic update-resistant modding. You just make an HPK, pack it, put it alongside Game.hpk with a name coming after it alphabetically, and the next update will patch the main game and your mod still loads (unless they change the API, which they probably won't). The use and need of tools is beyond the scope of the basic stuff, simply because even the "best" stuff out there pales in comparison to what the human mind can unravel given time.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
19-09-2011 04:24 PM
Find all posts by this user Quote this message in a reply
jc_smo Offline
Junior Member
**

Posts: 14
Joined: Sep 2011
Post: #12
RE: Basic Modding Tutorial (without a hex editor)
Hi Swixel...

What is the code to charge users in a garage?
I already tried that and it did not work:

Garage ["profit_type"] = fee
Garage ["initial_fee"] = 1

E:

Garage ["profit_type"] = 1
Garage ["initial_fee"] = 1

But neither of them worked in the Mod = \

A basic question that would really help everyone ... what are the commands by the method easy to use? For example:

Pollution: 1, 2, 3, etc.
blueprint_cost: 1000, 2000, etc.
building_points: 1, 2, 3, etc.
electricity: 1, 2, 3, etc.
job_quality: 1, 2, 3, 100, etc.
money_cost: 1, 2, 5000, 8000, etc.
num_workers: 1, 2, 3, etc.

Would you put a general list with the options?
This would greatly facilitate everybody go without opening all *.lua

Thanks for all the explanations, now gives more desire to play and share ideas with other players Wink
23-09-2011 02:36 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #13
RE: Basic Modding Tutorial (without a hex editor)
You'll probably break your economy doing this, but you could try:

Garage["entrance_min"] = 1

(23-09-2011 02:36 AM)jc_smo Wrote:  A basic question that would really help everyone ... what are the commands by the method easy to use?

Only some properties are "easy" to use, others get a bit weird and dump errors (that are hidden) about not having dynamic variables. If you get one of them (I think it's an assert), the thread/process/script it's running seems to hang and the building or unit breaks, rendering the land useless once you demolish it.

(23-09-2011 02:36 AM)jc_smo Wrote:  Would you put a general list with the options?

At the moment the only things I'm really willing to share are in the main post (the rest could get me in trouble, as I've probably said way too much about how the game works in the last week).

Since you've asked about these:
  • Pollution isn't a single value, it's a list of things. It's generally best not to mess with this as it either ruins the game (i.e. too easy), or you mess the game up in other ways (which I won't go into now).
  • blueprint_cost is the cost of the blueprint. 0 is "no blueprint", as the moment you load the menu it goes "nothing, clear it and say we have it"
  • building_points determines how long it takes to build
  • electricity is the power drawn by the base structure (ignoring upgrades)
  • job_quality is job quality ...
  • money_cost is the cost of the building
  • num_workers is the number of people who work there.

... but that said, I'll throw in a few others that are pretty obvious in the same files:
  • num_people_serviced The number of people "serviced" by the Entertainment or Welfare structure
  • education The level of education required (None, Highschool, College)

Note: I put these here for modding purposes, not cheating purposes. Modifying the game to make it easy to finish instantly isn't the aim here.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
23-09-2011 02:52 AM
Find all posts by this user Quote this message in a reply
jc_smo Offline
Junior Member
**

Posts: 14
Joined: Sep 2011
Post: #14
RE: Basic Modding Tutorial (without a hex editor)
The idea is to play in different ways, making the game rather than facilitating it.
So I asked the garage to charge for example, it can give a greater degree of difficulty in the game ...

Very, very thanks, I'll try here and see if it works for the variable charge =)
(This post was last modified: 23-09-2011 04:20 AM by jc_smo.)
23-09-2011 04:17 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #15
RE: Basic Modding Tutorial (without a hex editor)
The variable doesn't seem to work ... mmm

Adding difficulty (or even parallel play) is quite difficult due to how it's put together.

--- edited content starts here ---

There is a way to stop people from using the garage, but it's beyond the scope of "simple", and I'm currently experimenting with something to do it as a part of something larger.

Also, I wasn't suggested you wanted to cheat, I'm just saying that that's part of the reason I don't want to just list everything possible. That, and the game loses a lot of "mystery"/"magic" the more you know. It's still fun, and you still fight similar battles, it's just that I don't want to give up the secrets the developers hid (e.g. the score algorithm, which I've hinted at, and I only removed a very tiny additional hint on the edit after Timo beat me to replying).

The real problem I have with tapping into the engine isn't so much for the good, it's for the bad. Knowing things like the scoring algorithm will change how people play the game. I don't play for points, and it has always been obvious happiness factors (from observation going back to Tropico 1), so I still play the same way -- making my people stupidly happy so I'm rolling in money and have happy people doing my evil bidding. However, people who want to top the leaderboard could abuse things to do that, but in a fairly substantial way if they knew how it all worked.

As a result of that, I'd encourage the more complicated mods to be distributed in compiled form (it also complies with no giving away their sourcecode, either in terms of distribution or explaining away some of the magic). The simple ones (e.g. trivial changing of values) I'd recommend staying uncompiled (perhaps distributing as a zip for people to pack up and poke around).

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
(This post was last modified: 23-09-2011 09:18 AM by Swixel.)
23-09-2011 04:25 AM
Find all posts by this user Quote this message in a reply
jc_smo Offline
Junior Member
**

Posts: 14
Joined: Sep 2011
Post: #16
RE: Basic Modding Tutorial (without a hex editor)
I'm kind of paranoid about some things, and I have purchased since Tropico Title 3 (although a long time to have accompanied the launch of Tropico 1, it did not interest me).

Until now I did not play the right Tropico 4 because I am hooked on to end my map, which estoud etalhando much, leaving it easy to play as administrator of the island. So I liked the idea of ​​being able to increase the difficulty of the game through the MOD, because although the map to look easy and fun for other players, I'll get through boring parts well thanks to the mod.

I ended up making small changes to the mod, as the shanty I left with only one resident (as it was before the patch). Apartament prices, Mansion Condominium and I increased. Some workplaces I have come to accept only skilled workers and other things. Placing the garage with an idea of ​​price would, who can not pay for the service walks the walk as well as in real life. If you do not have money will have to drive?

It's getting good changes, will give it out to a nice play to tropico4 DLC.

Many thanks for the tips so far =)


Sorry for my English, I am Brazilian and I use google translator. xD
23-09-2011 03:57 PM
Find all posts by this user Quote this message in a reply
CoconutKid Offline
Has Been or Never Was?
*******

Posts: 2,019
Joined: Nov 2008
Post: #17
Big Grin RE: Basic Modding Tutorial (without a hex editor)
(23-09-2011 02:52 AM)Swixel Wrote:  ... At the moment the only things I'm really willing to share are in the main post (the rest could get me in trouble, as I've probably said way too much about how the game works in the last week).

Since you've asked about these:
  • Pollution isn't a single value, it's a list of things. It's generally best not to mess with this as it either ruins the game (i.e. too easy), or you mess the game up in other ways (which I won't go into now).
  • blueprint_cost is the cost of the blueprint. 0 is "no blueprint", as the moment you load the menu it goes "nothing, clear it and say we have it"
  • building_points determines how long it takes to build
  • electricity is the power drawn by the base structure (ignoring upgrades)
  • job_quality is job quality ...
  • money_cost is the cost of the building
  • num_workers is the number of people who work there.

... but that said, I'll throw in a few others that are pretty obvious in the same files:
  • num_people_serviced The number of people "serviced" by the Entertainment or Welfare structure
  • education The level of education required (None, Highschool, College)

Note: I put these here for modding purposes, not cheating purposes. Modifying the game to make it easy to finish instantly isn't the aim here.

Big GrinBig GrinBig GrinBig Grin

It sounds as if you have found the equivalent of the building data file published to the T1 players by a friend working for Breakaway during the final stages of the "Paradise Island" release. It was such a shock that the "hard core" really didn't grasp all the implications. We sort of puckered a bit about being slapped down by law suits as we finally grasped what had been handed to us.

Of course, the equivalent file for T4 has some new stuff in it (e.g. cost of blueprint), but look at the file for T1 which is no secret. It may be worth your while since it is so simple and open.

Look out for the ripe coconuts falling out of the trees!

Wink
23-09-2011 08:25 PM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #18
RE: Basic Modding Tutorial (without a hex editor)
The structures for the T3 and T4 buildings are trivial... people have been hexing them. The optimisations the lua compiler threw into some of them (e.g. the tenement) mean that certain numbers/strings are in the wrong order as we see them (but only in some cases). Because the strings are in no way hidden in lua bytecode (read: they're listed as 04<string as hex>) anyone can find them, even if they've no idea what they mean. Since people can hex most of it away, I'm not sure there'll be an issue with my explaining everything, but I haven't yet for various reasons... mostly because I'm busy with my mod Wink

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
23-09-2011 10:15 PM
Find all posts by this user Quote this message in a reply
jc_smo Offline
Junior Member
**

Posts: 14
Joined: Sep 2011
Post: #19
RE: Basic Modding Tutorial (without a hex editor)
After you finish your mod we put him to test *.*
24-09-2011 11:29 AM
Find all posts by this user Quote this message in a reply
Blanchflower Offline
Senior Member
****

Posts: 200
Joined: Nov 2010
Post: #20
RE: Basic Modding Tutorial (without a hex editor)
OK, am I right to state that if you mod the game, the score will still be taken into account, unlike using cheat codes? Is that why some players have ridiculous high number of points which is virtually impossible to achieve if you play the game in a very "pure" manner?

Cool
25-09-2011 10:12 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #21
RE: Basic Modding Tutorial (without a hex editor)
Unfortunately, yes. Though there are other ways to manipulate it, people are doing so by using trivial modifications (hence why I added a note several posts up about this not being for cheating).

It is possible to get a pretty insane score playing normally though ... it's just that the play style is boring.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
25-09-2011 10:14 AM
Find all posts by this user Quote this message in a reply
Blanchflower Offline
Senior Member
****

Posts: 200
Joined: Nov 2010
Post: #22
RE: Basic Modding Tutorial (without a hex editor)
(25-09-2011 10:14 AM)Swixel Wrote:  Unfortunately, yes. Though there are other ways to manipulate it, people are doing so by using trivial modifications (hence why I added a note several posts up about this not being for cheating).

It is possible to get a pretty insane score playing normally though ... it's just that the play style is boring.

OK, can you please tell me how to get a pretty insane score if one is playing normally? What should the play style be? Must I postpone the necessary star objective indefinately until I get a booming economy?

Thanks!

Smile
25-09-2011 10:22 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #23
RE: Basic Modding Tutorial (without a hex editor)
While I don't play for points, and my strategy works, I can't/won't answer that because fairly evident from another post that I have a fairly good understanding of how scoring works -- again, this hasn't influenced my style, I actually ignore it. But because I have seen "too much", I won't answer that. If you want a justification, it's because I feel it is at odds with the white-hat reversing I've been doing.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
25-09-2011 10:27 AM
Find all posts by this user Quote this message in a reply
Togfan Offline
Senior Member
****

Posts: 200
Joined: Apr 2012
Post: #24
RE: Basic Modding Tutorial (without a hex editor)
Sorry to revive this thread, but since I don't know if it says anywhere, how can you make this functional with MT installed?

Political views:
Capitalists (+++)
Intellectuals (+++)
Enviromentalists (++)
Nationalists (+)
Militarists (+)
Loyalists (-)
Religious (--)
Communists (---)
08-10-2012 06:00 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #25
RE: Basic Modding Tutorial (without a hex editor)
(08-10-2012 06:00 PM)Togfan Wrote:  Sorry to revive this thread, but since I don't know if it says anywhere, how can you make this functional with MT installed?

http://forum.kalypsomedia.com/showthread.php?tid=14031

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
15-10-2012 04:56 AM
Find all posts by this user Quote this message in a reply
ktgamer Offline
Newbie
*

Posts: 2
Joined: Dec 2012
Post: #26
RE: Basic Modding Tutorial (without a hex editor)
Ugh. I need help. I feel really dumb asking this, but can someone help me?

All I want to do is mod my apartments and houses to allow more families, not really interested in totally changing the game (even though I know this has an effect). Ive been searching the net for days trying to understand how to do this. I successfully raised the population limit, but I am just STUCK here.

I tried this method, I got the hpk extractor, I followed step 1. Made a mod folder, made a game folder inside it, and 2 sub folders (I basically named them the extact same thing as Swixel minus the zgeorge part.

I did part 2, and created the lua file, and I think this is where I started to get lost. I wasnt sure where to save the lua file to? Does it go in my last sub folder? (the apartment_hack one?) Or do I put it in the game folder with the nolimit lua?

Part 3 I really got lost. So I selected my mod apartmentblueprinttest folder. In the save I selected my actual game boot\persist path. Here I got lost again. Do I create a new .hpk? I tried this and just named it something other than the 2 already in there. I did not hit the compress box because I didnt see instruction to do so.

I tried it, no dice. I KNOW Im doing something wrong. I retried a ton of things to see what I was missing. Still no dice.

SO rather than pester you guys with something probably really easy I searched more. Found ONE thread where someone said to get a hex editor, find line 870 change the 00 03 06 change the 06 to change number of families. I used the hpk archiver. unpacked the game.hpk, found the classes\buildings\apartment.lua and opened it. Changed that line, and then I tried to rearchive it (didnt compress it though). I got lost again cause I didnt know what folders to rearchive it to? I tried putting it back to the same place but I didnt know if I was supposed to replace the game.hpk or what. I copied it and tried that and it still didnt work. In fact it wouldnt start period until I replaced it with the original game.hpk. I dont know if I did it wrong, he said to change it 0C for 12 families. I just wrote a number. I didnt know if he just meant that was the thing showing in the line above or what. I feel like Ive seen Swixel say if youre going to change the value of the apartments you have to change all 4 of them and I only saw that one line..

Clearly Im in way over my head, but Im trying really hard to figure this out. Can someone help me figure out where Im going wrong, I obviously need my hand help here.. Im sure its easy and Im just missing it. Any help would be greatly appreciate.
05-12-2012 05:12 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #27
RE: Basic Modding Tutorial (without a hex editor)
Well, if you're following this thread, this is for the original, not Modern Times. If you're on Modern Times you want: http://forum.kalypsomedia.com/showthread.php?tid=14031

The problem with the update mechanism is that the reloading of Lua needs to be caught and handled appropriately.

EDIT: You can use loose files, so going to the Tropico 4 directory, making "Game" then "myMod" inside it, will work. You just put "myluamodlua" inside "Game\myMod" (or even just "Game", but you risk clashes that way).

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
(This post was last modified: 05-12-2012 08:14 PM by Swixel.)
05-12-2012 08:13 PM
Find all posts by this user Quote this message in a reply
ktgamer Offline
Newbie
*

Posts: 2
Joined: Dec 2012
Post: #28
RE: Basic Modding Tutorial (without a hex editor)
Ya Im only playing regular Tropico, havent gotten Modern Times yet so Im 1.03.

Ugh I love you. Thank you for taking the time to help me out. Its working out in the mymod folder now. You made my day. =) Thanks again.
05-12-2012 10:57 PM
Find all posts by this user Quote this message in a reply
ImSorryISuck Offline
Newbie
*

Posts: 1
Joined: Jun 2013
Post: #29
RE: Basic Modding Tutorial (without a hex editor)
I'm having trouble with this, not on the process, but on the Lua file. When I open up the files after extracting them from Game.hpk, they show a lot of weird symbols and abbreviations such as EOT, SOT, FF, NUL, ETX, ENQ, VT, SI, SYN, BEL, DC1, DC2, DC3, ACK, CAN, SOH, and NAK. I don't know what most of these mean but I'm assuming EOT is End of Text and SOT is Start of Text. How do I get it to be in a clear readable code like you have it?
16-06-2013 01:54 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | kalypso media :: website | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication