Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Radical_Pi

#46
SWBF1 Modding Tutorials / Basic LUA guide
September 13, 2009, 03:41:47 PM
Hey guys, since AG made that topic on ODF editing, I figured I might as well go through an LUA file with you.

In case you don't know, whenever a map is loaded, its LUA script is run. The job of the LUA is to load the map data and make sure there is enough memory available for the map. For most maps, there are 2 or 3 LUA files. 1 to load the game in each era, and 1 to add the map to the list of maps.

FYI this is a WIP so not every part of the LUA will be explained

Note: any time you see ***, replace it with your map id

First of all, you will find the LUA scripts in BFBuilder\Data***\Common\Scripts\***

***a.lua or ***i.lua are the GCW scripts. ***c.lua or ***r.lua are the CW scripts. There is also an addme.lua which eventually becomes addme.script, but I'm not going to go through that right now.

Now, I will explain a normal mod map LUA file line by line.

NOTE: This is the CW file. The GCW one is the same in terms of concept.


--start header -- This is a comment. Does not have any impact on the final script
function ScriptInit() -- tells the game that this is where the map loader begins
local CIS = 1 -- Script constants. Best not to touch these
local REP = 2
local ATT = 1
local DEF = 2
--end header
--start objectives
AddMissionObjective(REP,"red", "level.rya1.objectives.1"); -- The map objectives shown on the select unit screen. REP means it is shown to the Clones, red doesn't really mean anything, and "level.rya1..." is the language key displayed. (Don't ask about language keys in this topic)
AddMissionObjective(REP,"orange", "level.rya1.objectives.2");
AddMissionObjective(REP,"orange", "level.rya1.objectives.3");
AddMissionObjective(CIS,"red", "level.rya1.objectives.1");
AddMissionObjective(CIS,"orange", "level.rya1.objectives.2");
AddMissionObjective(CIS,"orange","level.rya1.objectives.3");
--end objectives
--start soundlvl
ReadDataFile("sound\\tat.lvl;tat1cw"); -- loads the map-specific sound files. Unless you plan on recording a whole new sound set, this should work just fine for you
--end soundlvl

-- Start sidelvls
ReadDataFile("SIDE\\cis.lvl", -- load the data file for the droids
"cis_inf_basic", -- the main 4 troopers
"cis_inf_countdooku", -- plus the jedi
"cis_inf_droideka"); -- plus the 5th trooper
ReadDataFile("SIDE\\rep.lvl", -- same as above but for clones
"rep_inf_basic",
"rep_inf_macewindu",
"rep_inf_jet_trooper");
--end sidelvls
--start loadouts
SetTeamName(CIS, "CIS") -- Sets the name of the team
SetTeamIcon(CIS, "cis_icon") -- Sets the icon used for the team
AddUnitClass(CIS, "cis_inf_battledroid",10) -- Adds the unit to the troop options. CIS means it's a droid, "cis_inf..." is which unit it is, and the number is how many of them are on the field as AI
AddUnitClass(CIS, "cis_inf_assault",1)
AddUnitClass(CIS, "cis_inf_pilotdroid",2)
AddUnitClass(CIS, "cis_inf_assassindroid",2)
AddUnitClass(CIS, "cis_inf_droideka",1)
SetHeroClass(CIS, "cis_inf_countdooku") -- Adds the jedi unit. Basically same as above
SetTeamName(REP, "Republic") -- See above but for clones
SetTeamIcon(REP, "rep_icon")
AddUnitClass(REP, "rep_inf_clone_trooper",10)
AddUnitClass(REP, "rep_inf_arc_trooper",1)
AddUnitClass(REP, "rep_inf_clone_pilot",2)
AddUnitClass(REP, "rep_inf_clone_sharpshooter",2)
AddUnitClass(REP, "rep_inf_jet_trooper",1)
SetHeroClass(REP, "rep_inf_macewindu")
--end loadouts
--start teamstats
SetUnitCount(ATT, 16) -- Number of AI on the field at once in SP. Ignored in MP
SetReinforcementCount(ATT, 200) -- Number of reinforcements
SetUnitCount(DEF, 16) -- See above
SetReinforcementCount(DEF, 200)
--end teamstats
--start alliances
SetTeamAsFriend(ATT, 1) -- AI stuff. No need to change unless adding natives
SetTeamAsEnemy(ATT, 2)
SetTeamAsFriend(DEF, 2)
SetTeamAsEnemy(DEF, 1)
SetAttackingTeam(ATT);
--end alliances

--start memorypools
ClearWalkers() -- Reset defaults on memory
AddWalkerType(0, 4)-- special -> droidekas -- Allocates the memory for a walker (AT-TE etc). First number is pairs of legs. 0 means droideka. Second number MUST be equal to number on the field at any one time. Not sure if it is adjusted when humans use dekas
AddWalkerType(1, 4)-- 1x2 (1 pair of legs) -- see above
AddWalkerType(2, 0)-- 2x2 (2 pairs of legs)
AddWalkerType(3, 0)-- 3x2 (3 pairs of legs)
SetMemoryPoolSize("PowerupItem", 60) -- Allocates the memory for other items. Not making a full list of options. First is entity type, second is max on the field at once
SetMemoryPoolSize("EntityMine", 40)
--end memorypools
--start worldlvl
ReadDataFile("dc:rya1\\rya1.lvl") -- Read in the actual map.
--end worldlvl
--start spawndelay
SetSpawnDelay(10.0, 0.25) -- Max and Min spawn delay, respectively
--end spawndelay
--start flyheight
--end flyheight
--start ainotify
--end ainotify
--start stayinturrets
--end stayinturrets
--start denseenvironment
SetDenseEnvironment("false") -- Changes some rendering options. Set to true on maps like endor
--end denseenvironment
--start birdsandfish
--end birdsandfish
--start deathregions
AddDeathRegion("deathregion") -- added this to the file because of importance. Any region you add in Zeroeditor that you want people to die in upon entry must have a copy of this
--end deathregions

--start soundconfig
OpenAudioStream("sound\\tat.lvl","tatcw_music"); -- Load the audio from an LVL file. first argument is the path to the file, second is the audio stream in the file
OpenAudioStream("sound\\tat.lvl","tat1");
OpenAudioStream("sound\\tat.lvl","tat1");
OpenAudioStream("sound\\cw.lvl","cw_vo");
OpenAudioStream("sound\\cw.lvl","cw_tac_vo");
OpenAudioStream("sound\\tat.lvl","tat1_emt");
SetBleedingVoiceOver(CIS,CIS,"cis_off_com_report_us_overwhelmed",1); -- Sound to play when a team has 2 CPs or less. First argument is the team to play it for, second is what team must have the low CP count, 3rd is the name of the audio entry in one of the streams listed above, and I need help with the 4th
SetBleedingVoiceOver(CIS,REP,"cis_off_com_report_enemy_losing",1);
SetBleedingVoiceOver(REP,CIS,"rep_off_com_report_enemy_losing",1);
SetBleedingVoiceOver(REP,REP,"rep_off_com_report_us_overwhelmed",1);
SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1,1);-- Same format as above, plays when there are less than 20 reinforcements left for a team
SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1,1);
SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1,1);
SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1,1);
SetOutOfBoundsVoiceOver(2,"Allleaving"); -- Sound to play when a player goes out of bounds. First is the team ID, second is the audio name
SetOutOfBoundsVoiceOver(1,"Impleaving");
SetAmbientMusic(CIS,1.0,"cis_tat_amb_start",0,1);-- Backround music to be played throughout the game. First is the team to play it for, second is the percentage of reinforcements remaining to start the music, 3rd is the audio name, and 4th and 5th I don't know
SetAmbientMusic(CIS,0.99,"cis_tat_amb_middle",1,1);
SetAmbientMusic(CIS,0.1,"cis_tat_amb_end",2,1);
SetAmbientMusic(REP,1.0,"rep_tat_amb_start",0,1);
SetAmbientMusic(REP,0.99,"rep_tat_amb_middle",1,1);
SetAmbientMusic(REP,0.1,"rep_tat_amb_end",2,1);
SetVictoryMusic(CIS,"cis_tat_amb_victory");-- Music to play on Victory/Defeat. You should know the format by now
SetDefeatMusic (CIS,"cis_tat_amb_defeat");
SetVictoryMusic(REP,"rep_tat_amb_victory");
SetDefeatMusic (REP,"rep_tat_amb_defeat");
SetSoundEffect("ScopeDisplayZoomIn","binocularzoomin");-- Sets up a sound effect. First is the event for the effect, second is the audio name
SetSoundEffect("ScopeDisplayZoomOut","binocularzoomout");
SetSoundEffect("SpawnDisplayUnitChange","shell_select_unit");
SetSoundEffect("SpawnDisplayUnitAccept","shell_menu_enter");
SetSoundEffect("SpawnDisplaySpawnPointChange","shell_select_change");
SetSoundEffect("SpawnDisplaySpawnPointAccept","shell_menu_enter");
SetSoundEffect("SpawnDisplayBack","shell_menu_exit");
SetPlanetaryBonusVoiceOver(REP,REP,0,"rep_bonus_rep_medical");-- Sound to play when a planetary bonus is activated in Galactic Conquest. First is the team to play it for, second is the team who got the bonus, 3rd is the bonus id, and 4th is the audio name
SetPlanetaryBonusVoiceOver(REP,CIS,0,"rep_bonus_cis_medical");
SetPlanetaryBonusVoiceOver(REP,REP,1,"");
SetPlanetaryBonusVoiceOver(REP,CIS,1,"");
SetPlanetaryBonusVoiceOver(REP,REP,2,"rep_bonus_rep_sensors");
SetPlanetaryBonusVoiceOver(REP,CIS,2,"rep_bonus_cis_sensors");
SetPlanetaryBonusVoiceOver(REP,REP,3,"rep_bonus_rep_hero");
SetPlanetaryBonusVoiceOver(REP,CIS,3,"rep_bonus_cis_hero");
SetPlanetaryBonusVoiceOver(REP,REP,4,"rep_bonus_rep_reserves");
SetPlanetaryBonusVoiceOver(REP,CIS,4,"rep_bonus_cis_reserves");
SetPlanetaryBonusVoiceOver(REP,REP,5,"rep_bonus_rep_sabotage");--sabotage
SetPlanetaryBonusVoiceOver(REP,CIS,5,"rep_bonus_cis_sabotage");
SetPlanetaryBonusVoiceOver(REP,REP,6,"");
SetPlanetaryBonusVoiceOver(REP,CIS,6,"");
SetPlanetaryBonusVoiceOver(REP,REP,7,"rep_bonus_rep_training");--advanced training
SetPlanetaryBonusVoiceOver(REP,CIS,7,"rep_bonus_cis_training");--advanced training
SetPlanetaryBonusVoiceOver(CIS,CIS,0,"cis_bonus_cis_medical");
SetPlanetaryBonusVoiceOver(CIS,REP,0,"cis_bonus_rep_medical");
SetPlanetaryBonusVoiceOver(CIS,CIS,1,"");
SetPlanetaryBonusVoiceOver(CIS,REP,1,"");
SetPlanetaryBonusVoiceOver(CIS,CIS,2,"cis_bonus_cis_sensors");
SetPlanetaryBonusVoiceOver(CIS,REP,2,"cis_bonus_rep_sensors");
SetPlanetaryBonusVoiceOver(CIS,CIS,3,"cis_bonus_cis_hero");
SetPlanetaryBonusVoiceOver(CIS,REP,3,"cis_bonus_rep_hero");
SetPlanetaryBonusVoiceOver(CIS,CIS,4,"cis_bonus_cis_reserves");
SetPlanetaryBonusVoiceOver(CIS,REP,4,"cis_bonus_rep_reserves");
SetPlanetaryBonusVoiceOver(CIS,CIS,5,"cis_bonus_cis_sabotage");--sabotage
SetPlanetaryBonusVoiceOver(CIS,REP,5,"cis_bonus_rep_sabotage");
SetPlanetaryBonusVoiceOver(CIS,CIS,6,"");
SetPlanetaryBonusVoiceOver(CIS,REP,6,"");
SetPlanetaryBonusVoiceOver(CIS,CIS,7,"cis_bonus_cis_training");--advanced training
SetPlanetaryBonusVoiceOver(CIS,REP,7,"cis_bonus_rep_training");--advanced training
--end soundconfig

--start activebonus
--end activebonus

--start camerashots
AddCameraShot(-0.404895, 0.000992, -0.914360, -0.002240, -85.539894, 20.536297, 141.699493);-- Adds a camera location to see during the spawn timer. freecam in SPTest can tell you the values for this (use fake console to get camera coordinates)
AddCameraShot(0.040922, 0.004049, -0.994299, 0.098381, -139.729523, 17.546598, -34.360893);
AddCameraShot(-0.312360, 0.016223, -0.948547, -0.049263, -217.381485, 20.150953, 54.514324);
--end camerashots

--start footer
end -- Pass control back to the main game
--end footer


A few important notes:

ALL paths to files MUST use double slashes!!!! The game will go wacky if you don't use them

To access files specific to your mod, prefix the path to an lvl with "dc:". Without that, it will go to the main _lvl_pc folder under GameData

Advanced LUA coming soon!
#47
SWBF1 Modding / Re: Modding Questions
September 13, 2009, 03:10:31 PM
k great.

I almost forgot, when you unzip the BFBuilder files, in the Assets folder you should find something called SPTest.exe. Move that to the same folder as the main battlefront EXE. it is an ingame debugger and you should be sure to run any map you make by it. It will save the errors it finds to a file called BFront.log, which I can use to find most problems.

Also, if you have any problems, feel free to contact me in the SB or on XFire :)

Also, save adding the vehicles for last, since I need to tell you what to do in LUA
#48
AT-TE for me. Much faster, much more maneuverable, and the pilots don't care about em one tiny bit :P

Perhaps you could add AT-RT to the list? (Republic walker on Geonosis)
#49
SWBF1 Modding Tutorials / Re: Basic ODF File Editing
September 13, 2009, 03:04:43 PM
Couple of slight technicalities that just bug me cuz I'm that way :P

The water splashes are visual effects, not audio effects
WeaponAmmo values of 0 make it recharge, not the other way around.
I believe AimValue is how accurate your aim is (not 100% sure)
Might want to note in maxspeed that you will slide if you change that value. The animation just doesn't like changes

In GameObjectClass, that is only read by ZeroEditor, so the GeometryName there has no effect ingame.
#50
SWBF1 Modding / Re: Modding Questions
September 13, 2009, 11:31:33 AM
Oh yeah, I almost forgot. If you have the DVD version of SWBF, you need to install my BoPC fix that is stickied in the modding forum, or zeroeditor will refuse to run at all.
#51
SWBF1 Modding / Re: Modding Questions
September 13, 2009, 11:08:15 AM
It really varies based on how much you want to put into it. If you are just making a fun little map that isn't too complex, then you could finish it in a day. Some totally new and complex map could take maybe a month to do, it all depends on how much time you have and how much you want to put into it.
#52
SWBF1 Modding / Re: Modding Questions
September 13, 2009, 10:57:58 AM
http://starwarsbattlefront.filefront.com/file/Star_Wars_Battlefront_Modding_Tools;34987 for the mod tools

I also recommend you install:
http://www.secretsociety.com/forum/downloads/BF1/ZeroeditorUpdate122904.zip -- Update to the world editor
http://www.secretsociety.com/forum/downloads/BF1/BFBuilderProWIP030605.zip -- Enhanced version of the new map maker
http://www.secretsociety.com/forum/downloads/BF1/Boundaries_fix.zip -- Fixes crash in world editor

Make sure you install these before running BFBuilder(Pro). The ZE update and boundaries fix can be installed in DataTEMPLATE via the instructions in the files and it should pass the updates onto any new maps

Now, to make your first map, run "0 BFBuilder Pro.hta". Click Project->New Project. I recommend making a test map to learn how to add textures to the world, place objects, paths, etc. Look in the documentation for how to do those.

Name the map whatever you want, and make the mod id whatever you want too. Playable eras is up to you, but for a test map both is the best. Click "Create New World" and it will start working. BFBUILDER IS NOT HANGING. BE PATIENT.

After that, click on the Edit button (not on the menu, on the bar that just showed up). It should launch ZeroEditor. Agree to the EULA and get working.

Go to the Documentation folder and go through the world editing tutorials. After you're done with them, you should know the basics of how to work in ZeroEditor. Go ahead and play around with it. I do have a few things to share with you though.

1) ZE can only open files in a directory at or below the location of the zeroeditor.exe. That means you can only access objects in Data*** or lower, with *** being the ID you gave your map. If you want to use objects from another map, go to BFBuilder\Assets\Shipped Worlds\*world* and copy the MSH and the ODF from the MSH and ODF folder, respectively. Most of the stuff you want will probably be ***_bldg_***.odf and .msh. Those files go in BFBuilder\Data***(Your map id)\Worlds\***(map id) and the MSH and ODF folder there. To place the object, get the ODF of it, not the MSH. You don't need to do anything else with the files other than place the object on the map. When the object is added to the map, it will be automatically compiled into the map.

2) Objects common to most maps (CPs, turrets, vehicle spawns (those are a bit complex), etc.) are in BFBuilder\Data***\Common\ODF. EDITING THESE FILES DOES NOTHING!!!!! They are only there as placeholders, and are loaded from the global common.lvl. Any com_weap or com_inf or com_holo is not meant to be placed on the map by you, and are linked to by other objects. Things of importance to you would be com_bldg_controlzone.odf and variants. You want nothing that has _exp in it. You also might be interested in com_item_healthrecharge and com_item_weaponrecharge, which are the health and ammo droids.

3) Vehicles. The most confusing part of world editing. While you may feel an urge to grab the ODF of the vehicle and drop it on the map, THAT IS THE WRONG THING TO DO! All usable vehicles must be placed by a com_item_vehicle_spawn object. They will show up on the map as an arrow showing which way the vehicle will face. To set the vehicle, input the ODF name of the vehicle (ask someone if you are unsure of the name) to the Object Instance property field meant for each team (I hope you can figure that out). ATK is the one used when that team has the CP, and DEF is for when the team doesn't have the CP I believe. Vehicles also require changes to the LUA code, which I can't explain right now.

I've got to go, so I might add more later

P.S. admins this should probably be moved to modding
#53
SWBF 1 and 2 Tournaments / Re: Platform Wars Redux- War 2
September 12, 2009, 08:59:24 PM
Rex shh they both show a PC win :P

Sorry I couldn't be there guys. My parents insisted I get all my homework done tonight :(
#54
Tech Support / Re: Weird Expose Problems
September 12, 2009, 08:30:24 PM
hmm, do you see problems in any non-apple program? Basically anything that uses the standard apple APIs for the window (almost any regular mac program would use them).

I've found that as time goes on, a computer gets more and more buggy (yes, this does happen to macs too. It's just not noticed as much since you get an upgrade every year :P ), and every once in a while it just needs a fresh start. Backing up everything and doing a full reinstall usually fixes most problems, although this isn't needed if you plan on upgrading to snow leopard soon.
#55
One thing you might want to add to Dedicated Server software. I noticed that you cannot have it running at the same time as battlefront on the same computer
#56
SWBF1 Modding / Re: [WIP] AG's 2fort
September 11, 2009, 02:13:43 PM
So you're doing real modeling with XSI for this?
#57
Other Games / Re: New LucasArts game announced
September 11, 2009, 02:07:36 PM
ehh, even for a downloadable game, it doesn't look that good to me. I doubt I'll get the PC version
#58
Welcome Center / Re: I am new MPC GAMER
September 11, 2009, 02:05:44 PM
Hey welcome! Hope to see you in the Platform War! :cheers:
#59
Tech Support / Re: Glitch with diskwarrior
September 11, 2009, 01:59:09 PM
hmm if it loosing the connection to the hard drive it sounds more like an OS or hardware problem than a glitch with the program. I'd say try re-installing the OS since as time goes on an OS slows down and you just need a clean slate to run with

Plus, if there are incorrect values in metadata of files, I'd say it's an OS problem also
#60
Tech Support / Re: Civ3
September 08, 2009, 07:30:42 PM
If it is the hard drive, try shrinking your partition by 10 megs or something like that. The same problem would probably apply to the HD since it is still an int measurement