[Tutorial] How to change your units' gravity settings

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

[Tutorial] How to change your units' gravity settings

Post by Marth8880 »

A wild tutorial appeared!
Marth used Post!
It was super-effective!
Oh dear, it seems everybody else just didn't look quite hard enough... You all thought it was impossible, you all denied the truth! But it looks like the tables have turned...

As you may know from reading the thread's title, I have finally figured out how to alter the game's gravity settings, or rather, the speed and way which a unit falls. The reason I care so deeply about doing this is for the Sol Map Pack, which, if you know anything about it, pretty much requires changes to the gravity if it is to truly simulate cosmic environments such as Luna, or Pluto, or Venus, or Titan. Nonetheless, this works well and is a good enough simulation of low gravity.

Anyway, enough of that - onto the tutorial.



****Note that the changes made in this tutorial are specifically configured for Luna’s gravity. Edit them for your own map as needed.****
  1. Browse to data_ABC\Common\scripts\ and open up globals.lua. Scroll down until you see this:

    Code: Select all

    Land = {
    	Size = 3,  
    
    	Vec = {
    		{0.0,-1.0,0.0},
    		{0.0, 0.2,  0.0},
    		{0.0,  0.0,  0.0},
    	},
    
    	Slope = {
    		{0.0, 0.2, 0.0},
    		{0.0, -0.2, 0.0},
    		{0.0,  0.0,  0.0},
    	},
    
    	Ore = {
    		{0.0, 0.0, 0.0},
    		{0.0, 0.0, 0.0},
    		{0.0, 0.0, 0.0},
    	},
    
    	RSlope = {
    		{0.0, 0.0, 0.0},
    		{0.0, 0.0, 0.0},
    		{0.0, 0.0, 0.0},
    	},
    
    	Time = {
    		.17, .17, .17
    	},
    }
  2. The last set of values – the Time values – is what we want to change. For Luna, I set them all to 17.17. Here’s what that would look like:

    Code: Select all

    Time = {
    		17.17, 17.17, 17.17
    	},
  3. Once you’ve made your changes, save and exit. Then, browse to data_ABC\Common\odfs\ and open up com_inf_default.odf. Here, we will edit the jump values. First, change JumpHeight to 6.8. Then change JumpForwardSpeedFactor to 1.8, and JumpStrafeSpeedFactor to 1.6. Now, under SprintAccelerateTime, add this line:

    Code: Select all

    // So units don't hurt themselves from jumping in low-gravity atmospheres
    CollisionScale      = "0.0 0.0 0.0"
  4. Now, in the ControlSpeed section, change the jump thrust factor to 0.09, so it looks like this:

    Code: Select all

    ControlSpeed            = "jump   0.09 0.03 0.35"	// 0.03 0.03 0.35
  5. Save and close. Next, browse to data_ABC\Common\ and open ingame.req. Delete all of the contents in the file – minus any of your own custom things that you want to keep loaded – and change it so it looks like this:

    Code: Select all

    ucft
    {
    REQN
    	{
    		"animbank"
    		"human"
    		"humanfp"
    		"humanlz"
    	}
    	
       	REQN
       	{
    "class"
    "com_item_powerup_ammo"
    "com_item_powerup_health100"
    		"com_item_powerup_health25"
    		"com_item_powerup_dual"
    		"com_item_powerup_offense"
    		"com_item_powerup_defense"
    		"com_item_powerup_energy"
    		"com_inf_default"
    }
    }
  6. Save and close. Now, open up your mission’s LUA, and add these lines above ReadDataFile(“ingame.lvl”):

    Code: Select all

    ReadDataFile("dc:common.lvl")
    ReadDataFile("dc:ingame.lvl")
    So it looks like this:

    Code: Select all

    ReadDataFile("dc:common.lvl")  -- This loads globals.lua
    ReadDataFile("dc:ingame.lvl")  -- This loads com_inf_default
    ReadDataFile("ingame.lvl")
  7. Save and exit. Now run VisualMunge and munge with Common checked.
  8. Once it’s finished munging, browse to data_ABC\_LVL_PC\, copy common.lvl and ingame.lvl, and paste them into GameData\addon\ABC\data\_LVL_PC\.
  9. Run Battlefront and have fun with low gravity!

I plan on adding onto this tutorial, making it more comprehensive - all once I learn more about the values and parameters in globals.lua myself. I also plan on creating a proof-of-concept video pretty soon in the near future, so be on the lookout for that as well.

If anybody has any questions or queries, you know what to do. ;)
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: [Tutorial] How to change your units' gravity settings

Post by skelltor »

Nice job but is there a way for this to apply to only one unit? Andd can you post a video of this ingame please?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: [Tutorial] How to change your units' gravity settings

Post by Marth8880 »

Umm, I'm not sure about changing the fall speed for only one unit, I'll have to look into that more. As for a video of it, I personally think it would be better if I release a map tomorrow that has the feature implemented. ;) *wink wink nudge nudge*
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: [Tutorial] How to change your units' gravity settings

Post by Noobasaurus »

Persisting is key! I remember when I saw the "Gravity" (or whatever it was called topic) and everyone denied it. Great find, I'll have to find some way to use this! :thumbs:
baumerindustries
Lance Corporal
Posts: 96
Joined: Mon Apr 11, 2011 8:24 am
Games I'm Playing :: Bf2 EAW EAWFOC[SI]
xbox live or psn: No gamertag set
Location: In front of my english vocab and translating my confused thinkings into English....

Re: [Tutorial] How to change your units' gravity settings

Post by baumerindustries »

Good Job! :thumbs:

I hope your next map is a space map, that includes starfighters with stealth :D I could need them :D
User avatar
Cerfon Rournes
Master Bounty Hunter
Master Bounty Hunter
Posts: 1558
Joined: Thu Jul 08, 2010 5:53 pm
Projects :: WIP. I will reveal what it is later on..
Games I'm Playing :: SWBF2-SWRC
xbox live or psn: No gamertag set
Location: New York, USA
Contact:

Re: [Tutorial] How to change your units' gravity settings

Post by Cerfon Rournes »

Awesome find. :)
Now, if there was some way to make this work in a certain region only..
Post Reply