• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

CheTranqui

Corporal
30 Badges
Mar 9, 2018
45
2
  • Age of Wonders: Planetfall
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV: Cadet
  • Pillars of Eternity
  • Europa Universalis III: Collection
  • Cities: Skylines
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Surviving Mars
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris - Path to Destruction bundle
  • Stellaris: Synthetic Dawn
  • Magicka 2
  • Stellaris
  • Cities in Motion 2
  • Semper Fi
  • Majesty 2 Collection
  • Heir to the Throne
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Divine Wind
  • Europa Universalis III
  • Crusader Kings II: The Old Gods
  • Crusader Kings II
The mod that I want to create is rather ambitious... but once I can get the hang of a few basic things, I simply have to change a few variables and it will become something quite excellent. Unfortunately, both of those basic things are seriously frustrating me at every turn. I have very little programming experience, but I did learn C# and Unity well enough to be able to create a 'randomized' Heroes of the Storm drafting program. I learned the basics and it worked well. ...very little of that knowledge translates to Blender, Python and LUA, apparently. Maybe I just didn't have enough of it to transfer... Anyway, here what I'm trying to do:

I want to gather the name of a colonist that died. The Cemetary mod gives a great example of how to query this. I now want to:

1. export the name into a simple text file using LUA.
2. import the name into a python script from within Blender.
3. change the text of an already-placed text box within Blender.

I'm thwarted at step #0.5: I figure it's easier to read a file than to write to a file... so I created a text file and tried to get Blender to read it... the end result was that Blender would never acknowledge the directory within which I had placed the file. I even used the // to identify the 'current directory'. I think that was trying to find the text file within the .blend file, thus it could never work because I cannot put a txt inside a blend. ...and if I put in my local disk directories... it would never work on anyone else's computer, would it? So, that's the 1st issue: how do I read a file. Once I figure out directories, I can continue on to find my next issue.

tl;dr How do I get Blender to read a text file and create a string from it? In particular, what directory should the file be in and how do I call to that directory?
 
For the TL;DR, you should be asking in a Blender forum, not here.

For the rest...

It seems like you want your mod to have file IO, I don't think that's going to happen. I mean if that's a thing with this game, I will certainly be cracking open every single mod to make sure it's not happening. It also seems like you want a real-time link between the game and blender output. again, not something that's preferable with "mods", even if it were doable.

I really do not think you're going to be able to make whatever this is work. There is no reloading of assets once the game in running as far as I know. Once you load, you're loaded and that's exactly how it should be.

Maybe I misunderstood you though.
 
Ty for the response/guidance. I can see that file IO could pose a security concern and would best be avoided.

What I'd like to accomplish is, in essence, to create a newspaper that presents you with stories on a daily basis, depending upon what has happened over the past few Sol. This means that it would 'listen' for disaster warnings, take note of colonist deaths, etc... and depending upon the current status of things (colonists are starving!), it would then change the text of a certain text box to match the new, relevant story.

I thought that would be most simply done via creating a text file, then having that text file read. ...I could do it all, 100% within LUA, I suppose... that would keep all of the stuff internal.. but that adds another few steps, too. Now I need to learn how to draw a text box, create and format text, and such.

If file IO is generally out-of-the-question, how would one go about accomplishing what I'm lookin' for conceptually, then?

...I suppose... maybe I could go about not using a Newspaper format and just using an in-game window itself... thus encapsulating the entire concept within LUA and using the windows/etc already present... that'd definitely change the feel of stuff, tho. a little less ideal.
 
Last edited:
For the TL;DR, you should be asking in a Blender forum, not here.

For the rest...

It seems like you want your mod to have file IO, I don't think that's going to happen. I mean if that's a thing with this game, I will certainly be cracking open every single mod to make sure it's not happening. It also seems like you want a real-time link between the game and blender output. again, not something that's preferable with "mods", even if it were doable.

I really do not think you're going to be able to make whatever this is work. There is no reloading of assets once the game in running as far as I know. Once you load, you're loaded and that's exactly how it should be.

Maybe I misunderstood you though.

Not sure it's really helpful for the OP, but it does appear that file I/O is allowed. The sample "Time Capsules" mod writes out information about what you did in one game at a given set of coordinates in order to give you ruined buiidngs in future runs on those same coordinates. I assume they set some sensible precautions on it (like, only write to the game's data directory) but in general it's probably a good idea to inspect download mods anyway.
 
I saw that. Since it's logical to have some concern over such a practice, I've decided to forego it and simplify my work. Gonna post a new thread with the new question. I've made a lot of progress, though! (I think I have, at least!)