SSM: Fix glitches for ALL buildings at once, not per map!
Posted: Sun Oct 25, 2009 7:08 am
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:
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:
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:
A piece of barb wire:
First, write this in notepad:
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:
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!!
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
Here is what the guard tower looks like in battlecraft with the barbed wire:
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
Code: Select all
Object.create stebarbwire_m1
Object.absolutePosition 499.89/77.06/498.60
Object.rotation 0.00/90.00/0.00
Code: Select all
ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.setRotation 0/0/0
Code: Select all
ObjectTemplate.addTemplate stebarbwire_m1
ObjectTemplate.setPosition -0.11/-2.94/-1.4
ObjectTemplate.setRotation 0/90/0
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!!