Page 1 of 1

[Tutorial] Pushing Objects

Posted: Tue Feb 09, 2016 11:38 am
by thelegend
Pushing Objects in Battlefront II


In many games the player can push and/or pull Objects like barrels, crates etc. If you are making a campaign mission in your map and want to add some variety you can use this little neat trick which makes at least pushing possible. It works fine (Except of animations which can't be added and pulling also doesn't work, but I am happy pushing Objects work fine).

You can use this method in several things like: "Go and push this box to this location to be able to jump through that hole (which is 3-4 meters above the floor in a wall)". To push objects just walk/run against your Object into any certain direction.
Maybe one day we will see a Vehicle Football or Soccer Match using tanks and walkers to push ball geometries into goals/fields...Just a thought...

Ok let's get started:

1.) First create your Object. You can also use any other assets/.msh's. Only the Object matters at all.

Here's a sample odf without any special things. Just the Geometry names:
Hidden/Spoiler:
[code]
[GameObjectClass]

ClassLabel = "prop"

GeometryName = "YourObject.msh"

[Properties]

GeometryName = "YourObject"
[/code]
2.) Now let's edit the odf to make it "pushable".

Rename ClassLabel = "prop" into:

Code: Select all

ClassLabel		=	"droid"
This is important or nothing is going to work.

Now if you want to remove any bitmaps from your minimap add this below [Properties]

Code: Select all

MapTexture = ""
MapScale 		= "0.0"
If you want to make it indestructable add this line:

Code: Select all

MaxHealth       	= "1e+37"

1e+37 means a One with 37 zeros. To make it destructable just give it a Health of ~2000 (It's up to you).

If you want to make it respawn-able just add this line:

Code: Select all

RespawnTime		= "180.0"
If you want to keep your AI (engineers) away from fixing it:

Code: Select all

AINoRepair      = "1"
Now the next important part. If you are not going to add the following lines then your Object will start "walking" away from it's placed position (Remember ClassLabel "droid". It's an AI controlled thing which has his own "mind")

Code: Select all

Acceleraton 	= 0.0
MaxSpeed 	= 0.0

MaxStrafeSpeed 	= 0.0
MaxTurnSpeed 	= 0.0
PCMaxTurnSpeed	= 0.0
PCMaxStrafeSpeed = 0.0
I added this line too. I am not sure if it does affect anything but it should prevent this prop from "floating" away after it fell down.

Code: Select all

IsAcklay = 1
Also don't forget this inside your .lua:

Code: Select all

SetMemoryPoolSize("AcklayData", 20)
One of the most interesting thing is if you push your object from a bridge (for example) then It will fall down. It has ZeroEngine Physics.

Some examples for anyone who's interested in making a mod using this method:
-As mentioned before a Soccer of Football match with vehicles might be fun
-For puzzle based maps/levels.
-For pushable covers. You push against a wall and it will work as a cover.
-As traps...

BUGS:
I just discovered this on yesterday and still need to figure out how to make better collisions.
For example you can move your camera (Using your mouse) through your Object. I added a collision and named it p_-svbot-cube and added these lines into my odf:
Hidden/Spoiler:
[code]SoldierCollision = "p_-svbot-cube"
TerrainCollision = "p_-svbot-cube"
OrdnanceCollision = "p_-svbot-cube"
BuildingCollision = "p_-svbot-cube"
VehicleCollision = "p_-svbot-cube"[/code]
I hope this might be interesting for some people. No need for any credit since it's just simple .odf editing.

EDIT: Here's my odf (unchanged) using this method for comparison:
Hidden/Spoiler:
[code][GameObjectClass]

ClassLabel = "droid"
GeometryName = "SOD_prop_barrel_01_dest.msh"


[Properties]
MapTexture = ""
MapScale = "0.0"

MaxHealth = "1e+37"

RespawnTime = "180.0"
GeometryName = "SOD_prop_barrel_01_dest"

FoleyFXGroup = "wood_foley"

AINoRepair = "1"

Acceleraton = 0.0
MaxSpeed = 0.0

MaxStrafeSpeed = 0.0
MaxTurnSpeed = 0.0
PCMaxTurnSpeed = 0.0
PCMaxStrafeSpeed = 0.0


SoldierCollision = "p_-svbot-cube"
TerrainCollision = "p_-svbot-cube"
OrdnanceCollision = "p_-svbot-cube"
BuildingCollision = "p_-svbot-cube"
VehicleCollision = "p_-svbot-cube"
IsAcklay = 1
[/code]

Re: [Tutorial] Pushing Objects

Posted: Tue Feb 09, 2016 11:54 am
by Noobasaurus
I managed to do something similar while working working on prop hunt where the player could teleport anything to directly in front of them (there's a video somewhere). I never tried it directly with force push, so it probably wouldn't work, but this is a nice find!

Re: [Tutorial] Pushing Objects

Posted: Tue Feb 09, 2016 12:16 pm
by AnthonyBF2
Nice stuff you put together but I have some suggestions/improvements -

1) Using HideHealthBar = 1 prevents HUD from showing red/blue/white lines at the top
2) You don't even need MaxHealth command, just delete that line completely, this will make AI bots not even attack it. MaxHealth how ever does distract bots which may or may not be good based on what player is doing.
3) If you don't use MaxHealth, you also wouldn't need HideHealthBar, when there is no MaxHealth, a health bar is not shown on HUD at the top.

Re: [Tutorial] Pushing Objects

Posted: Tue Feb 09, 2016 12:20 pm
by thelegend
Thanks! That's interesting. I never saw HideHealthBar before. Definitely use it for future stuff.

Re: [Tutorial] Pushing Objects

Posted: Tue Feb 09, 2016 1:41 pm
by jedimoose32
I'd love to see a video of this in action!

Re: [Tutorial] Pushing Objects

Posted: Tue Feb 09, 2016 2:04 pm
by thelegend
jedimoose32 wrote:I'd love to see a video of this in action!
I plan to do another gameplay video of my map I am currently working on which will also show this in action.