I'm not sure if he's going to do it for you.
I'm having a hard time following this thread, so, maybe I'll start from the beginning and ask WHY you must split your LUA into two parts?
Can't you just
some_random_number = math.random(1,4)
If some_random_number >= 3 then
ReadDataFile(lvl with a model in it)
elseif some_random_number <=2 then
ReadDataFile(lvl with other model in it)
else
print("")
print("Message Severity AA: 5")
print("I messed up with my < > logic, this should never happen and nothing got loaded")
print("")
end
Is it possible to divide my lua into 2 parts?
Moderator: Moderators
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
-
Deviss
- Master of the Force

- Posts: 3772
- Joined: Tue Aug 12, 2008 7:59 pm
- Projects :: Clone Wars Extended
Re: Is it possible to divide my lua into 2 parts?
zerted said me time ago: i'm just really slow at getting back to people.Ace_Azzameen_5 wrote:I'm not sure if he's going to do it for you.
I'm having a hard time following this thread, so, maybe I'll start from the beginning and ask WHY you must split your LUA into two parts?
Can't you just
some_random_number = math.random(1,4)
If some_random_number >= 3 then
ReadDataFile(lvl with a model in it)
elseif some_random_number <=2 then
ReadDataFile(lvl with other model in it)
else
print("")
print("Message Severity AA: 5")
print("I messed up with my < > logic, this should never happen and nothing got loaded")
print("")
end
so i hope he can do it for me
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: Is it possible to divide my lua into 2 parts?
You could just modify your one LUA? And if the same model name appears over and over there is the "replace" function of notepad...
I'm also not sure how you know how to make 120 .lua's but not 2.
Also, what does "when I change one model I have to modify 120 files" have to do with the in-game scripts?
I'm also not sure how you know how to make 120 .lua's but not 2.
Also, what does "when I change one model I have to modify 120 files" have to do with the in-game scripts?
-
Deviss
- Master of the Force

- Posts: 3772
- Joined: Tue Aug 12, 2008 7:59 pm
- Projects :: Clone Wars Extended
Re: Is it possible to divide my lua into 2 parts?
i mean for example i want change random model to other name, so i must modify 120 lua files (because i have random models in 120) :S, for this reason i wanted divide lua in 2 parts one from map sides etc and the second with random models onlyAce_Azzameen_5 wrote:You could just modify your one LUA? And if the same model name appears over and over there is the "replace" function of notepad...
I'm also not sure how you know how to make 120 .lua's but not 2.
Also, what does "when I change one model I have to modify 120 files" have to do with the in-game scripts?
EDIT
bumping my own topic xD, i was reading about custom lvl by zerted, but i dont understand how use them for put my random units chunk :S could anyone help me please? maybe mav because i know he made one thing simil to the mine
thanks in advance
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Is it possible to divide my lua into 2 parts?
I rewrote my doc on making a custom lvl. The new version gives people three different ways to do it:
To do what you want, you'll need to create an lvl (or you could always make more than one) that holds your models and a script. We'll call the lvl legion.lvl and the script legion_config.lua. The script should contain functions for the things you want done. A quick example:In ScriptPostLoad near where ingame.lvl is loaded, load your lvl. Don't forget, you will need to include the path to your lvl (it isn't included in this example): ReadDataFile("legion.lvl")
On the next line, process the script: ScriptDB_DoFile("legion_config")
Now, just call those LegionXXXX functions whenever you need them. When the map is using ReadDataFile to load the units, vehicles, etc... use LegionDataSetup(). When it's time to setup the teams, use LegionUnitSetup().
There are many ways to do it, this way seemed to be the easiest way to explain it w/o having to go into a lot of details into how things work. Also I haven't tested this exact method, but it should work.
Hidden/Spoiler:
Code: Select all
function LegionDataSetup()
--read in the models here
end
function LegionUnitSetup
--add units to teams here
endOn the next line, process the script: ScriptDB_DoFile("legion_config")
Now, just call those LegionXXXX functions whenever you need them. When the map is using ReadDataFile to load the units, vehicles, etc... use LegionDataSetup(). When it's time to setup the teams, use LegionUnitSetup().
There are many ways to do it, this way seemed to be the easiest way to explain it w/o having to go into a lot of details into how things work. Also I haven't tested this exact method, but it should work.
-
Deviss
- Master of the Force

- Posts: 3772
- Joined: Tue Aug 12, 2008 7:59 pm
- Projects :: Clone Wars Extended
Re: Is it possible to divide my lua into 2 parts?
wow you broke my brain[RDH]Zerted wrote:I rewrote my doc on making a custom lvl. The new version gives people three different ways to do it:To do what you want, you'll need to create an lvl (or you could always make more than one) that holds your models and a script. We'll call the lvl legion.lvl and the script legion_config.lua. The script should contain functions for the things you want done. A quick example:Hidden/Spoiler:In ScriptPostLoad near where ingame.lvl is loaded, load your lvl. Don't forget, you will need to include the path to your lvl (it isn't included in this example): ReadDataFile("legion.lvl")Code: Select all
function LegionDataSetup() --read in the models here end function LegionUnitSetup --add units to teams here end
On the next line, process the script: ScriptDB_DoFile("legion_config")
Now, just call those LegionXXXX functions whenever you need them. When the map is using ReadDataFile to load the units, vehicles, etc... use LegionDataSetup(). When it's time to setup the teams, use LegionUnitSetup().
There are many ways to do it, this way seemed to be the easiest way to explain it w/o having to go into a lot of details into how things work. Also I haven't tested this exact method, but it should work.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Is it possible to divide my lua into 2 parts?
I can't give you the exact code you need because I don't know exactly what you plan on doing. legion_config.lua (legion50x.lua) should have all the legion stuff that is common to all your maps.
Here's some untested example code. It has one team being loaded from legion_config.lua:
Here's some untested example code. It has one team being loaded from legion_config.lua:
Hidden/Spoiler:
