Making bots shoot through walls

Ask questions, discuss ideas, get answers
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: Making bots shoot through walls

Post by BotHunter »

Hey. Right now when you walk through the shield it hurts you slightly. is there any way to fix that?? Here is my code:

Code: Select all

ObjectTemplate.create Bundle US_Shield_Generator
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.hasDynamicShadow 1

rem objectTemplate.aiTemplate US_Shield_Generator_ai
rem -------------------------------------
ObjectTemplate.addTemplate lodUS_Shield_Generator
ObjectTemplate.addTemplate US_Shield_Generator_Bottom_rot_Shadow
rem -------------------------------------
objectTemplate.loadSoundScript Sounds/windmill.ssc




LodSelectorTemplate.create DistanceSelector US_Shield_GeneratorSelector
LodSelectorTemplate.addLodDistance 200


ObjectTemplate.create LodObject lodUS_Shield_Generator
ObjectTemplate.lodselector US_Shield_GeneratorSelector
ObjectTemplate.addTemplate US_Shield_GeneratorInterior
ObjectTemplate.addTemplate US_Shield_GeneratorExterior


ObjectTemplate.create Bundle US_Shield_GeneratorInterior
ObjectTemplate.geometry Base_m1
ObjectTemplate.addTemplate US_Shield_Generator_Bottom_rot
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.addTemplate US_Shield_Generator_Top_rot
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.addTemplate ShieldDomespawner
ObjectTemplate.setPosition 0/0/0



ObjectTemplate.create SimpleObject US_Shield_GeneratorExterior
ObjectTemplate.geometry US_Shield_Generator_l1



ObjectTemplate.create RotationalBundle US_Shield_Generator_Bottom_rot
ObjectTemplate.geometry Bottom_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/0
ObjectTemplate.setPivotPosition 0/0/0
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed 12/0/0

ObjectTemplate.create RotationalBundle US_Shield_Generator_Bottom_rot_Shadow
ObjectTemplate.geometry Bottom_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasCollisionPhysics 0
ObjectTemplate.createInvisible 1
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/0
ObjectTemplate.setPivotPosition 0/0/0
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed 12/0/0


ObjectTemplate.create RotationalBundle US_Shield_Generator_Top_rot
ObjectTemplate.geometry Top_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/0
ObjectTemplate.setPivotPosition 0/0/0
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed -12/0/0








ObjectTemplate.create Obstacle ShieldBlock
ObjectTemplate.geometry shield_down
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.AddToCollisionGroup c_CGLandscape
ObjectTemplate.AddToCollisionGroup c_CGStaticObjects
ObjectTemplate.createInvisible 1
ObjectTemplate.loadSoundScript Sounds/Landmine.ssc




rem *** ShieldDome ***
ObjectTemplate.create PlayerControlObject ShieldDome
ObjectTemplate.setNetworkableInfo Shield_Bubble_Info
ObjectTemplate.geometry None
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.cullRadiusScale 3
ObjectTemplate.addArmorEffect 321 e_White_rays_01 0/8.31/0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 0
ObjectTemplate.speedMod 0
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 320
ObjectTemplate.maxHitPoints 320
ObjectTemplate.material 51
ObjectTemplate.drag 1.0
ObjectTemplate.inertiaModifier 0/0/0
ObjectTemplate.mass 20
ObjectTemplate.criticalDamage 360
ObjectTemplate.setSoldierExitLocation -2.5/0/0 0/0/0
ObjectTemplate.damageFromWater 1
ObjectTemplate.setMinimapIcon "empty.tga"

rem ----------------------------------
ObjectTemplate.addTemplate ShieldBlock

ObjectTemplate.addTemplate e_glowShield
ObjectTemplate.SetPosition 0/-4/0
rem ----------------------------------



rem *** claymorespawner2 - Thanks to Apache thunder *** 
ObjectTemplate.create ObjectSpawner ShieldDomespawner
ObjectTemplate.setObjectTemplate 1 ShieldDome
ObjectTemplate.setObjectTemplate 2 ShieldDome
ObjectTemplate.minSpawnDelay 30
ObjectTemplate.maxSpawnDelay 30
ObjectTemplate.timeToLive 99999
ObjectTemplate.distance 99999
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.team 2
ObjectTemplate.MaxNrOfObjectSpawned 1
Walk quietly and carry a sniper rifle
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: Making bots shoot through walls

Post by BotHunter »

Hold on a sec, I just found this: http://bfmods.com/mdt/scripting/ObjectT ... tacle.html

What does it mean by "The collision mesh defines the amount of damage."
Walk quietly and carry a sniper rifle
User avatar
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Making bots shoot through walls

Post by Apache Thunder »

Not sure who wrote that up in the old MDT site but it's a bit wrong. For one, it's not set up to "behave like a projectile". The addToCollision group merely prevents projectiles from interacting with the barbwire object.


Obstacles are basically a special object class that allows vehicles to drive through with no resistance while soldiers get slowed down a little and take damage. There is an unused command that alters how much damage this object actually does to the player:

Code: Select all

ObjectTemplate.damage 0
Higher number = more damage done. In your case you want zero, so setting it to zero will prevent damage, though the "damage effect" would still occur. That is the soldier would slow down slightly with the red damage color appearing on screen for a split second. But no damage is actually done if the command is set to zero.

I set the number to something really high for most of the things I've used this for in my BFH'42 mod. I used this as a "death box" to prevent glitching into houses. Soldiers that glitch in die instantly. It worked pretty well. The creek mesh on Alpine Assault in my BFH'42 mod is also a an obstacle. I wanted soldiers/vehicles to wade through it but still allow projectiles to hit it. (this was before I discovered the c_CGStaticObjects collision group, but even now it still would not have allowed soldiers to pass through do to soldier objects losing custom collision group settings after entering a vehicle) In that instance the damage was set to 0. It still had a slowdown effect on soldiers walking through it though.

The size/shape of the collision mesh does not impact damage. It merely defines the area of damage.

Last time I checked with Alpine Assault in my BFH'42 mod anyway is that Projectiles can still collide with obstacles (since my creek mesh is an obstacle object. Projectiles can still hit it while soldiers/vehicles pass through it).

Here's what the code for your obstacle should look like if you want to prevent it from doing any damage:

Code: Select all

ObjectTemplate.create Obstacle ShieldBlock
ObjectTemplate.geometry shield_down
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.createInvisible 1
ObjectTemplate.loadSoundScript Sounds/Landmine.ssc
ObjectTemplate.damage 0
That should solve your damage issues.

I'm not sure why you added the c_CGLandScape and c_CGStaticObjects collision groups. I have to assume your shield doesn't have mobile physics. So the landscape collision group isn't needed. As for c_CGStaticObjects, it's not assigned to anything by default, so adding it to just your shields will have no impact on anything. For it to work, you'd have to assign the c_CGStaticObjects group to both your shield object and all the other mobile objects you want to pass through it. But remember in this instance it would not work well for soldiers since even if you add soldiers to the collision group, they lose that group the instant they enter and leave a vehicle. I'm not sure why this happens and haven't found away around it. So keeping it an obstacle is your best option. Adding c_CGStaticObjects to your shield would be most useful if you still want certain projectiles pass through. Otherwise adding it to an Obstacle is redundant since vehicles and soldiers can already pass through it. ;)
ImageImageImage
I have cameras in your head!
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: Making bots shoot through walls

Post by BotHunter »

Is there any way to prevent bots from being able to escape A PCO?
Walk quietly and carry a sniper rifle
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Making bots shoot through walls

Post by Vilespring »

Block the exit point. I have made some tanks where you cant get out! (too many turrets) :lol:
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: Making bots shoot through walls

Post by BotHunter »

I don't think that works very well :?
Walk quietly and carry a sniper rifle
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Making bots shoot through walls

Post by freddy »

BotHunter wrote:Is there any way to prevent bots from being able to escape A PCO?
This works for regular players, guessing the bots have to obey the same rules

Code: Select all

ObjectTemplate.subPos 1
ObjectTemplate.setSoldierExitLocation 0/-900/0 0/0/0  <--- set the exit under water level of the map
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: Making bots shoot through walls

Post by BotHunter »

What happens when there is no water in the map? :)
Walk quietly and carry a sniper rifle
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Making bots shoot through walls

Post by Vilespring »

there always is. The water level is floating in some .CON file. :D
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
BotHunter
Posts: 480
Joined: Thu Jan 10, 2013 11:22 pm
Contact:

Re: Making bots shoot through walls

Post by BotHunter »

Ahh. I see. :)
Walk quietly and carry a sniper rifle
Post Reply