SSM: Fix glitches for ALL buildings at once, not per map!

Lots of cool and useful tips to mod either serverside or clientside
Post Reply
User avatar
Iced Earth
Posts: 209
Joined: Sun Oct 18, 2009 2:07 pm
Contact:

SSM: Fix glitches for ALL buildings at once, not per map!

Post by Iced Earth »

So I had this idea months ago, but never got around to testing it. The good news is that it works!

The basis for this tutorial: Don't you hate when people glitch into walls on your server? Don't you hate fixing those glitches MAP by MAP, placing barb wire everywhere they aren't supposed to be? Well there's an easier way! Instead of doing it map by map, you can add barb wire to the object's bundle in Objects.rfa. This way, wherever the building (static object) spawns, the "glitcher trap" will spawn with it.

Like I said I had to test this out first, so after doing so and tweaking it, here is the code that will make the base of the guard towers into death traps!

Just paste all of this code to replace whats in Objects/Buildings/Common/guardtow/Objects.con:

Code: Select all

ObjectTemplate.create Bundle guardtow_M1
ObjectTemplate.geometry guardtow_M1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
rem *** Glitch fixes!***
ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition -1.69/-3.5/2.10
ObjectTemplate.setRotation 180/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition 1.75/-3.5/2.10
ObjectTemplate.setRotation 180/90/0


ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition 1.55/-3.1/-0.26
ObjectTemplate.setRotation 0/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition 1.55/-3.1/-1.57
ObjectTemplate.setRotation 0/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition 1.8/-3.2/-1.55
ObjectTemplate.setRotation -90/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition -0.09/-2.86/-0.24
ObjectTemplate.setRotation 0/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition -0.11/-2.94/-1.4
ObjectTemplate.setRotation 0/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition -1.25/-3.2/-0.64
ObjectTemplate.setRotation 0/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition -1.25/-3.2/-2.0
ObjectTemplate.setRotation 0/90/0

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition 0/-3.0/-2.0
ObjectTemplate.setRotation 0/90/0
rem *** End glitch fixes ***

ObjectTemplate.addTemplate ladder_10m
ObjectTemplate.setPosition 0/6/1.9
ObjectTemplate.setRotation 180/1/0
objectTemplate.aiTemplate guardtow_M1
objectTemplate.loadSoundScript Sounds/guardtow.ssc

ObjectTemplate.create SimpleObject Ladder_10m
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.addToCollisionGroup c_CGLadders
ObjectTemplate.addToCollisionGroup c_CGProjectiles
ObjectTemplate.geometry ladder_10m_m1
All I'm doing is adding the stuff in the "rem *** glitch fix***" part, but I thought pasting all of it would be easier for some people.

Here is what the guard tower looks like in battlecraft with the barbed wire:
Image

I will try to post other glitch fixes in here too, but I'm not gonna do all of it for you! First, a problem: The static has to have a bundle that you can add the barb wire to. Just trying to addTemplate it to a static object (like the defgun bunker) won't work. Is there a potential fix for this?

Also, here is how to fix glitches yourself:
Step 1: Open battlecraft42 (or editor42). Its best to make a new level. Just name it 'testing' and make it a flat map.
Step 2: Place the object you want to 'fix' -- Remember, it must have a bundle in objects.rfa.
Step 3: Make sure the object is floating off the ground, and make sure its placed with round numbers. For the Guard Tower I used a placement of 500/80/500. Keep the rotation at 0/0/0.
Step 4: Start adding that barbed wire! Don't go too nuts though...
Step 5: SAVE. Open staticobjects.con now. It should only contain the static you want 'fixed', and your barb wire. Copy it to notepad. Give it a file name and save here too.
Step 6: Now the fun part: MATH! Ohh yes, math. You need to figure out the position of the barb wire from the position of your object (look at my code for an example) and add/subtract. It helps to know that X in X/Y/Z is east/west, Y is down/up, and Z is south/north.

Lets do one from my guard tower as a 'for instance' to help get you started:

Guard Tower Position:

Code: Select all

Object.create guardtow_m1
Object.absolutePosition 500.00/80.00/500.00
Object.rotation 0.00/0.00/0.00
A piece of barb wire:

Code: Select all

Object.create stebarbwire_m1
Object.absolutePosition 499.89/77.06/498.60
Object.rotation 0.00/90.00/0.00
First, write this in notepad:

Code: Select all

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.setRotation 0/0/0
Now lets get counting! Remember: Subtract your object (the guard tower) from the barb wire to get your proper addTemplate coordinates. Try doing the math on this one yourself. The correct code would be:

Code: Select all

ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition -0.11/-2.94/-1.4
ObjectTemplate.setRotation 0/90/0
Also, don't forget about the rotation!! The rotation stays the same though. Just make sure you spawned the object (guard tower here) with a rotation of 0/0/0. It keeps everything simpler.

That should do it! REMEMBER, save save save! Save your object and barb wire as a new map, so you can go back to it as a reference. Same with the code; save it in notepad in case your objects.rfa file gets overwritten.

Feel free to post some glitch fixes of your own to share!!
Image
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: SSM: Fix glitches for ALL buildings at once, not per map!

Post by Apache Thunder »

Well you can simply make a entry recreating a simpleobject into a Bundle and this should be server side. I converted a staticobject to a PCO once server side. So a bundle isn't out of the question.

Just copy the object code to your OST and change SimpleObject to Bundle.

Then you addTemplate stuff to it.
ImageImageImage
I have cameras in your head!
User avatar
Iced Earth
Posts: 209
Joined: Sun Oct 18, 2009 2:07 pm
Contact:

Re: SSM: Fix glitches for ALL buildings at once, not per map!

Post by Iced Earth »

static object to a PCO??? lmfao.

Alright cool, I wasn't sure but I'll try it. I'll try objects.rfa first, if that doesn't work...OST.con.
Image
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: SSM: Fix glitches for ALL buildings at once, not per map!

Post by freddy »

whaa?? tell me more! :shock:
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: SSM: Fix glitches for ALL buildings at once, not per map!

Post by Apache Thunder »

lol Yes. I was able to server side mod a MedicLocker to a PCO and enter it. BUT it was buggy. But at the same time (since I didn't addTemplate a camera to it) I was able to get a buggy "free camera" when in the MedicLocker.

No, you wont' be able to use this method to make new static objects appear visible for the client or move existing ones. That still can't be changed. Also I did not add any network info the PCO converted object. Just know that server crashes will occur if someone enters a staticobject more then once or dies in it. But if you want to make a medic locker destructible server side...that's the way to go. (it won't disappear, but the health depot attached to it will if you set it up right)

The best way I can think of making a staticobject destructible server side is to convert it to a PCO and modify the damage system so projectiles will do damage to the material(s) already assigned to it. You could change matIDs on the mesh, but server side, modding the damage system to damage the material it already has would be the more practical approach. The staticobject as I mentioned won't dissappear after death from a visual standpoint, but it won't be solid anymore. ;)

But that aside, converting a SimpleObject to a Bundle server side should work. ;)
ImageImageImage
I have cameras in your head!
Post Reply