Random Crazy Lua Question (Help still needed)
Moderator: Moderators
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Random Crazy Lua Question (Help still needed)
Is it possible to use the command "ScriptCB_DoFile()" to load another mission script?
Last edited by commanderawesome on Tue May 13, 2014 6:34 pm, edited 1 time in total.
- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question
Yes I've done it just recently.
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question
How?Nedarb7 wrote:Yes I've done it just recently.
- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question
For example if I want to use the coruscant (conquest) script I would use this code:
Explained:
Reads sub lvl file (cor1c_con) from the stock mission.lvl, since that is where the mission script is loaded. Second I use ScriptCB_DoFile() to execute that script.
Code: Select all
ReadDataFile("..\\..\\data\\_LVL_PC\\mission.lvl", "cor1c_con")
ScriptCB_DoFile("cor1c_con")
Reads sub lvl file (cor1c_con) from the stock mission.lvl, since that is where the mission script is loaded. Second I use ScriptCB_DoFile() to execute that script.
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question
Sweet! Thanks!Nedarb7 wrote:For example if I want to use the coruscant (conquest) script I would use this code:Explained:Code: Select all
ReadDataFile("..\\..\\data\\_LVL_PC\\mission.lvl", "cor1c_con") ScriptCB_DoFile("cor1c_con")
Reads sub lvl file (cor1c_con) from the stock mission.lvl, since that is where the mission script is loaded. Second I use ScriptCB_DoFile() to execute that script.
EDIT
Do you add this to a blank script?
And can this be done with other mod maps?
EDIT
I still need help with this.
- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question (Help still needed)
Yes and yes. The code I gave you would be the entire script. To get a different mod's mission script you'd change the path to something like this:
Code: Select all
ReadDataFile("..\\..\\addon\\modID\\data\\_LVL_PC\\mission.lvl", "mapID[era]_[mode]")
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question (Help still needed)
It crashes for some reason.
.lua script:
"UOA" is Redline's space-to-ground utapau w/ icemember's 212 sides. I tested it as I was typing and it ran as usual.
BFront2 log:
http://pastebin.com/iAFqYmmN
.lua script:
Hidden/Spoiler:
BFront2 log:
http://pastebin.com/iAFqYmmN
- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question (Help still needed)
Aaaaaaaaghhhh!!! There is a flaw in the workaround!
Here try adding this to your lua:
(what do you mean by it ran as usual?)
Here try adding this to your lua:
Code: Select all
ReadDataFile("..\\..\\addon\\UOA\\data\\_LVL_PC\\UOA\\UOA.lvl", "uoa_cw-assault")
ReadDataFile("..\\..\\addon\\UOA\\data\\_LVL_PC\\UOA\\spa_sky.lvl")
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question (Help still needed)
(I tried the map it calls for, it runs how it's supposed to.)Nedarb7 wrote:Aaaaaaaaghhhh!!! There is a flaw in the workaround!
Here try adding this to your lua:(what do you mean by it ran as usual?)Code: Select all
ReadDataFile("..\\..\\addon\\UOA\\data\\_LVL_PC\\UOA\\UOA.lvl", "uoa_cw-assault") ReadDataFile("..\\..\\addon\\UOA\\data\\_LVL_PC\\UOA\\spa_sky.lvl")
Still Crashes, now as soon as I press "Launch". Is that code supposed to be before or after ScriptCB_DoFile("UOAc_Diet Dr. Pepper")?
Log:
http://pastebin.com/RzJwuR0k
- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question (Help still needed)
Huh. Maybe it can't handle that much data all at once. For now comment those lines out or get rid of them completely. The cause of the first crash was probably the fact that it couldn't load the republic side at all. Did you make any side replacements or anything that could screw it up... is the rep.lvl actually in the stock game's side folder?
Without a side a map will crash, while a map without a map will not crash.
(We can deal with the map after you get the sides working. Also could you post what the LUA looked like when it loaded the map and sky?)
Without a side a map will crash, while a map without a map will not crash.
(We can deal with the map after you get the sides working. Also could you post what the LUA looked like when it loaded the map and sky?)
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question (Help still needed)
The map uses stock and mod units for the republic, cis is stock, both SHOULD be working. Lemme check...Nedarb7 wrote:Huh. Maybe it can't handle that much data all at once. For now comment those lines out or get rid of them completely. The cause of the first crash was probably the fact that it couldn't load the republic side at all. Did you make any side replacements or anything that could screw it up... is the rep.lvl actually in the stock game's side folder?
Without a side a map will crash, while a map without a map will not crash.
(We can deal with the map after you get the sides working)
EDIT
Stock Rep works fine. Tried it on stock death star.
- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question (Help still needed)
Hmmmm... looking back at your first error log I see that it can't find "dc:rep.lvl" and "dc:cis.lvl", it could be that it uses its own stock units if you know what I mean. Like you said, if it is using stock it should be working. I've gotten around the map not loading issue (back to this post), so that shouldn't a problem anymore. If your adding your own units then I'd suggest adding them now, I think it should work with at least one unit per team even if the rest don't load.commanderawesome wrote:The map uses stock and mod units for the republic, cis is stock, both SHOULD be working. Lemme check...
(I should also mention that I've gotten it to work on a custom map just today)
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question (Help still needed)
Still crashes...
Mission script:
setup_teams:
Log:
Mission script:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
-
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Random Crazy Lua Question (Help still needed)
Are you not loading the stock ingame.lvl or something? That's what that last error is basically saying.
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question (Help still needed)
Hmm... there shouldn't be anything that changed that. Can you PM me a stock one just in case?Marth8880 wrote:Are you not loading the stock ingame.lvl or something? That's what that last error is basically saying.
- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question (Help still needed)
Yet another flaw discovered. Updating the workaround again, I'll edit the post once I finish updating.
Also you have to make sure that you add your units via AddUnitClass as well (also demonstrated in the scenario in setup_teams lua)
- EDIT -
The workaround post has been edited again, hopefully this will be the last. I think you'd only have to look over the setup_teams lua again.
Also you have to make sure that you add your units via AddUnitClass as well (also demonstrated in the scenario in setup_teams lua)
- EDIT -
The workaround post has been edited again, hopefully this will be the last. I think you'd only have to look over the setup_teams lua again.
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question (Help still needed)
But i'm replacing units, not adding them...Nedarb7 wrote: Also you have to make sure that you add your units via AddUnitClass as well (also demonstrated in the scenario in setup_teams lua)
I'll try that, though...
EDIT
IT WORKS!!!! Sorta. It loads the level, but not stock rep for some reason, cis is fine. And the custom units i'm loading aren't right, but I think it's with the sides themselves. I'll keep ya posted.

Mission lua:
Hidden/Spoiler:
Hidden/Spoiler:
http://pastebin.com/9wmQKHa9
EDIT
I forgot that I renamed stock rep

- Nedarb7
- Lieutenant General
- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Random Crazy Lua Question (Help still needed)
Your units wont appear unless you use AddUnitClass(), that's what all units use (including stock). I'll test the workaround for removing the stock sides found on that same post.
- commanderawesome
- Field Commander
- Posts: 971
- Joined: Tue Aug 13, 2013 11:58 pm
- Projects :: Skin Changer - Warfront - Other stuff
- xbox live or psn: AaTc_CmdrAwesome
- Location: The Universe
Re: Random Crazy Lua Question (Help still needed)
Now it crashes.Nedarb7 wrote:Your units wont appear unless you use AddUnitClass(), that's what all units use (including stock). I'll test the workaround for removing the stock sides found on that same post.
Mission script is unmodified from before.
setup_teams:
Hidden/Spoiler:
http://pastebin.com/s7BtZHPd