Make My couch move

Ask questions, discuss ideas, get answers
User avatar
MR PINK BALLS
Posts: 267
Joined: Sun Oct 18, 2009 4:01 pm

Make My couch move

Post by MR PINK BALLS »

Hey guys,im designing a object from the ground up,its a couch,I suck at coding this kinda stuff,HELP,what im trying to do is make the couch move when I shoot it,since bullets don't move pco's,I was thinking of using iced earths knife code to make the gun shoot pco's so they collide and make it move,the problem im having is I have no idea how to make the couch a pco,u have to add wheels or something? bla bla bla? IDFK
Image Image

I <3 Ironmen
User avatar
No-Half-Measures
Posts: 11
Joined: Fri Dec 11, 2009 12:34 am
Location: UK
Contact:

Re: Make My couch move

Post by No-Half-Measures »

Can you not give projectiles mass as if you could just give it a greater mass than the couch.
Image
Image
User avatar
MR PINK BALLS
Posts: 267
Joined: Sun Oct 18, 2009 4:01 pm

Re: Make My couch move

Post by MR PINK BALLS »

MR PINK BALLS wrote:since bullets don't move pco's,
Image Image

I <3 Ironmen
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Make My couch move

Post by fo0k »

Use a grenade as your base object but turn it into a pco... This is how I made boulders once. I'm on the phone so can't post code ATM but will :)
POTAmatt
Posts: 89
Joined: Mon Dec 07, 2009 9:09 pm
Location: New Yawk

Re: Make My couch move

Post by POTAmatt »

Wow. That's a great idea.
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Make My couch move

Post by Apache Thunder »

Give your bullets splash damage. (aka, make them explode). Explosion force moves objects that have response physics. Or you can make them sticky with "isSticky" code. I found out that the bullets tend to impart their inertia into the target object. I fired sticky bullets at really high velocity and the vehicles flew away so fast that it couldn't be seen! The vehicle sorta teleported. That's how much energy the sticky bullets put into the PCO. Basically transferred most if not all it's velocity into the PCO. FYI, the sticky code only causes CTDs when used on projectiles with networkinfo.

So make sure never to use the code on projectiles that have network info. (which in vanilla BF42, is mainly just the hand grenades, landmines, and expacks). If you want to use it on something like a landmine, you can rem out the network info on it first. But network info tells the game to limit how many landmines you can set and removes them when the kit that laid them disappears (aka, you die).

Also, C4 can no longer be remote detonated if you remove the network info from the exppack projectile. ;)

You can also try increasing the mass of the projectile.

What I do know is that the koopa shell projectile I made for Mario kart did cause the karts to move a tiny bit when they bounced off them (in instances when the projectile didn't explode from the proximity mine settings). So projectiles should be able to move vehicles (or couches in this instance :P ) if you hit them with projectiles. FYI splash explosion force does not work on things with no armor or when the projectile isn't set to do any damage. Some form of damage must be done to cause the object to react to explosions. So you might have to convert all your props to PCOs if you want them to react to bullets. ;)

Just set them to have really high hit-points if you don't want them to be destructible. Also be sure to update the map so the new PCOs are spawned with spawners and not with the staticobjects con file as PCOs created on a map without using a spawner will never return after the PCO dies or when the round ends. (only a map reload would make them come back).
ImageImageImage
I have cameras in your head!
User avatar
MR PINK BALLS
Posts: 267
Joined: Sun Oct 18, 2009 4:01 pm

Re: Make My couch move

Post by MR PINK BALLS »

mainly the problem is the couch,the map is a large static object,it falls through that and is gone when I go down the the ground to looks for it,heres my code

Code: Select all

ObjectTemplate.Create PlayerControlObject couch
ObjectTemplate.geometry couch

ObjectTemplate.setHasCollisionPhysics 0
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasResponsePhysics 1
ObjectTemplate.HasMobilePhysics 1
ObjectTemplate.HasCollisionPhysics 0
ObjectTemplate.HasResponsePhysics 1

ObjectTemplate.HasArmor 1
ObjectTemplate.HitPoints 5
ObjectTemplate.MaxHitPoints 5
ObjectTemplate.damageFromWater 0
ObjectTemplate.explosionDamage 0
ObjectTemplate.hpLostWhileUpSideDown 0

rem ObjectTemplate.CriticalDamage 37
rem ObjectTemplate.HpLostWhileCriticalDamage 1

ObjectTemplate.mass 100
rem ObjectTemplate.Drag 1
ObjectTemplate.InertiaModifier 0/0/0
ObjectTemplate.material 1055
ObjectTemplate.ExplosionForceMod 600

ObjectTemplate.TimeToLiveAfterDeath 0
ObjectTemplate.TimeToStartFadeAfterDeath 0

ObjectTemplate.addArmorEffect 0 e_scrapmetal_willy 0/0/0
ObjectTemplate.addArmorEffect 0 e_RichoCascadesWood 0/0/0
ObjectTemplate.addArmorEffect 0 e_RichoCascadesWood 0/0/0
ObjectTemplate.addArmorEffect -1 WaterWaterExplosion  0/0/0

ObjectTemplate.setMinimapIcon ""

ObjectTemplate.addTemplate SWAT_Helmet_desteng

rem ********************************************************************************
rem *** Create Spings to add to objects to make moveable
rem *** DestructoFrontSpringL ***
ObjectTemplate.create Spring DestructoFrontSpringL
ObjectTemplate.setNetworkableInfo SpringInfo
ObjectTemplate.geometry SmallWheel_m1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.Grip c_PGFContactGrip
ObjectTemplate.setStrength 18
ObjectTemplate.setDamping 8
ObjectTemplate.CreateInvisible 1

rem *** DestructoFrontSpringR ***
ObjectTemplate.create Spring DestructoFrontSpringR
ObjectTemplate.setNetworkableInfo SpringInfo
ObjectTemplate.geometry SmallWheel_m1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.Grip c_PGFContactGrip
ObjectTemplate.setStrength 18
ObjectTemplate.setDamping 8
ObjectTemplate.CreateInvisible 1

rem *** DestructoBackSpringL ***
ObjectTemplate.create Spring DestructoBackSpringL
ObjectTemplate.setNetworkableInfo SpringInfo
ObjectTemplate.geometry SmallWheel_m1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.Grip c_PGFContactGrip
ObjectTemplate.setStrength 18
ObjectTemplate.setDamping 8
ObjectTemplate.CreateInvisible 1

rem *** DestructoBackSpringR ***
ObjectTemplate.create Spring DestructoBackSpringR
ObjectTemplate.setNetworkableInfo SpringInfo
ObjectTemplate.geometry SmallWheel_m1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.Grip c_PGFContactGrip
ObjectTemplate.setStrength 18
ObjectTemplate.setDamping 8
ObjectTemplate.CreateInvisible 1

Code: Select all

GeometryTemplate.create StandardMesh couch
GeometryTemplate.file couch
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 10
GeometryTemplate.setLodDistance 2 15
GeometryTemplate.setLodDistance 3 30
GeometryTemplate.setLodDistance 4 50
GeometryTemplate.setLodDistance 5 100

rem ********************************************************************************
rem *** Create geometry for SmallWheel_m1 ***
GeometryTemplate.create StandardMesh SmallWheel_m1
GeometryTemplate.file SmallWheel_m1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 2
GeometryTemplate.setLodDistance 2 5
GeometryTemplate.setLodDistance 3 10
GeometryTemplate.setLodDistance 4 20
GeometryTemplate.setLodDistance 5 100

Code: Select all


rem *** WillyEngine ***
ObjectTemplate.create Engine SWAT_Helmet_desteng
ObjectTemplate.setNetworkableInfo SWAT_Helmet_destengInfo
ObjectTemplate.setAttachToListener 1
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1


rem *** Add springs to make object moveable ***
ObjectTemplate.addTemplate DestructoFrontSpringL
ObjectTemplate.setPosition -0.45/0/0.45
ObjectTemplate.addTemplate DestructoFrontSpringR
ObjectTemplate.setPosition 0.45/0/0.45
ObjectTemplate.addTemplate DestructoBackSpringL
ObjectTemplate.setPosition -0.45/0/-0.45
ObjectTemplate.addTemplate DestructoBackSpringR
ObjectTemplate.setPosition 0.45/0/-0.45

rem ObjectTemplate.setMinRotation 0/0/-5000
rem ObjectTemplate.setMaxRotation 0/0/5000
rem ObjectTemplate.setMaxSpeed 0/0/55000
rem ObjectTemplate.setAcceleration 0/0/55000
rem ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
rem ObjectTemplate.setEngineType c_ETCar
rem ObjectTemplate.setTorque 10.5
rem ObjectTemplate.setDifferential 7
rem ObjectTemplate.setNumberOfGears 5
rem ObjectTemplate.setGearUp 0.95
rem ObjectTemplate.setGearDown 0.4
Image Image

I <3 Ironmen
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Make My couch move

Post by fo0k »

if its falling through that sounds more like the mesh setup? if the COG (center of grav...) in max falls below where your wheels sit (in game when resting on springs) then it will drop straight through any statics.. Ive had this prob with an rc car im working on.. it will only run on heightmap as I needed to drop the COG to get it to handle nice. it just drops through statics.
I need not tell you mesh on mesh is always buggy..



the boulder code... just need to make yourself a boulder :) then tweak.
this was setup to die on a timer so they could keep spawning and rollin down...

Code: Select all

ObjectTemplate.create simpleobject boulder
ObjectTemplate.networkableInfo boulderinfo
ObjectTemplate.geometry bouldermesh
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasMobilePhysics 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setHasResponsePhysics 1
rem ObjectTemplate.setHasPointPhysics 0
ObjectTemplate.hasCollisionEffect 1
rem ObjectTemplate.invisibleAtEndEffect 1
ObjectTemplate.drag 1.5
ObjectTemplate.mass 5000
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 60
ObjectTemplate.maxHitPoints 60
ObjectTemplate.criticalDamage 60
ObjectTemplate.hpLostWhileCriticalDamage 20
ObjectTemplate.explosionDamage 0
ObjectTemplate.timeToLive CRD_NONE/3/0/0
ObjectTemplate.dieAfterColl 0
ObjectTemplate.TimeToLiveAfterDeath 15
ObjectTemplate.FadeAtTimeToLiveAfterDeath 1
beginrem
ObjectTemplate.radius 7.0
ObjectTemplate.damageType 1
ObjectTemplate.material 70
ObjectTemplate.material2 205
ObjectTemplate.hasOnTimeEffect 1
ObjectTemplate.endEffectTemplate e_ExplGranade
ObjectTemplate.noFFSound 1
endrem
User avatar
MR PINK BALLS
Posts: 267
Joined: Sun Oct 18, 2009 4:01 pm

Re: Make My couch move

Post by MR PINK BALLS »

ok the coutch is working it all good and fine except,it falls through a large static,aka the map,not the actually map but a large,Building/static,that is the map,its refuses to stay on it,it spawns,thers a puff of dirt and it falls right through,?????WTF
Image Image

I <3 Ironmen
POTAmatt
Posts: 89
Joined: Mon Dec 07, 2009 9:09 pm
Location: New Yawk

Re: Make My couch move

Post by POTAmatt »

thers a puff of dirt and it falls right through,?????WTF
ObjectTemplate.Create PlayerControlObject couch
ObjectTemplate.geometry couch
ObjectTemplate.setHasCollisionPhysics 0 ?
Post Reply