Page 1 of 2

Custom Object/Gate/Disapper with restart

Posted: Tue Jan 11, 2011 9:34 pm
by MillerMod
Hello mates!

I put a custom object, called controlled gate 3 into my map and worked fine (texture ok,i can open it...), until the map restart came. After the restart the gate disappeared! :? So i had to load again the map,than the gate was there. But in restart, no...

Can you help me?

Thx!

Re: Custom Object/Gate/Disapper with restart

Posted: Wed Jan 12, 2011 1:42 am
by Apache Thunder
Is this object a PlayerControlObject? (same object type that vehicles use) If you put it on the map directly, it will appear for only one round. If it dies or when round ends, it will disappear and never be seen again until the map is reloaded.

PCOs need to be placed on the map via objectspawners. Find the objectspawntemplates con file in your Conquest/Singleplyaer folder (may vary depending on what gamemodes you have installed for your map) and you can see how existing object spawners are coded. To place a team neutral object on the map via a spawner, code it something like this:

Code: Select all

ObjectTemplate.create ObjectSpawner gatespawner
ObjectTemplate.setObjectTemplate 0 (name of your gate PCO)
ObjectTemplate.MinSpawnDelay 25
ObjectTemplate.MaxSpawnDelay 40
ObjectTemplate.SpawnDelayAtStart 0
ObjectTemplate.TimeToLive 30
ObjectTemplate.Distance 25
ObjectTemplate.DamageWhenLost 15
Then put this in the objectspawns con file:

Code: Select all

Object.create gatespawner
Object.absolutePosition (Vec3 position of your object)
Object.rotation (vec3 rotation of your object)
Object.setTeam 0

Re: Custom Object/Gate/Disapper with restart

Posted: Wed Jan 12, 2011 8:48 am
by Swaffy
After your gate blows up or a new round begins, this is what happens:

- Object Spawner: It will come back and spawn. New rounds require PCOs to be respawned.
- Static Object: It will not be there any more. A PCO should not be added to a map as a Static Object unless you want it to have a "one-time use" effect.

Re: Custom Object/Gate/Disapper with restart

Posted: Wed Jan 12, 2011 10:24 am
by MillerMod
Well, i tried this, but the same situation.
I put the gate, like a vehicle to spawn, and after restart, same again ...

Re: Custom Object/Gate/Disapper with restart

Posted: Wed Jan 12, 2011 5:33 pm
by Swaffy
Can you show me the Objects.con of your gate?

Re: Custom Object/Gate/Disapper with restart

Posted: Wed Jan 12, 2011 6:31 pm
by MillerMod
Swaffy wrote:Can you show me the Objects.con of your gate?
Sure mate!

Code: Select all

REM === Controlled Gate 3 ===

ObjectTemplate.create PlayerControlObject ControlledGate3
ObjectTemplate.setnetworkableInfo ControlledGate3_Info
ObjectTemplate.geometry ControlledGate_HouseBase_M1
ObjectTemplate.setHasCollisionPhysics 1
rem --------------------------------------------
ObjectTemplate.addTemplate ControlledGate_House_WhiteRed_M1
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate ControlledGate_GateRail
ObjectTemplate.setPosition 2/-0.1/9.5
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate MilitaryControlledGate3_GateR
ObjectTemplate.setPosition -998/0/1.6
ObjectTemplate.setRotation -90/0/0
ObjectTemplate.addTemplate MilitaryControlledGate3_GateL
ObjectTemplate.setPosition -998/0/17.4
ObjectTemplate.setRotation 90/180/0
ObjectTemplate.addTemplate ControlledGate_Entry
ObjectTemplate.setPosition 0/1/0
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate ControlledGate_Seat
ObjectTemplate.setPosition 0/1.2/0
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate ControlledGate_Camera
ObjectTemplate.setPosition -0.5/2/0.6
ObjectTemplate.setRotation 40/0/0
rem --------------------------------------------
ObjectTemplate.setSoldierExitLocation 0/0/1 0/0/0
ObjectTemplate.setCrossHairType CHTNone
ObjectTemplate.setVehicleIcon "ControlledObject/Icon_WhiteRedHouse.dds"
ObjectTemplate.setVehicleIconPos 90/70



rem *** MilitaryFence ControlledGate3 Gate R ***
ObjectTemplate.create RotationalBundle MilitaryControlledGate3_GateR
ObjectTemplate.geometry MilitaryFence_ControlledGate_R_M1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.setNetworkableInfo ControlledGate3_Gate_R_Info
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_WheelBase
ObjectTemplate.setPosition 0.7/0.461/0
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_Wheel
ObjectTemplate.setPosition 0.7/0.29/0
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_WheelBase
ObjectTemplate.setPosition 7.3/0.461/0
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_Wheel
ObjectTemplate.setPosition 7.3/0.29/0
ObjectTemplate.setRotation 0/0/0
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0.4/0/0
ObjectTemplate.setMaxSpeed 0.5/0/0
ObjectTemplate.setAcceleration 100/0/0
ObjectTemplate.SetPivotPosition 0/0/-1000
ObjectTemplate.setInputToYaw c_PIYaw


rem *** MilitaryFence ControlledGate3 Gate L ***
ObjectTemplate.create RotationalBundle MilitaryControlledGate3_GateL
ObjectTemplate.geometry MilitaryFence_ControlledGate_L_M1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.setNetworkableInfo ControlledGate3_Gate_L_Info
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_WheelBase
ObjectTemplate.setPosition 0.7/-0.461/0
ObjectTemplate.setRotation 0/180/0
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_Wheel
ObjectTemplate.setPosition 0.7/-0.29/0
ObjectTemplate.setRotation 180/0/0
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_WheelBase
ObjectTemplate.setPosition 7.3/-0.461/0
ObjectTemplate.setRotation 0/180/0
ObjectTemplate.addTemplate MilitaryFence_ControlledGate_Wheel
ObjectTemplate.setPosition 7.3/-0.29/0
ObjectTemplate.setRotation 180/0/0
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0.4/0/0
ObjectTemplate.setMaxSpeed 0.5/0/0
ObjectTemplate.setAcceleration 100/0/0
ObjectTemplate.SetPivotPosition 0/0/-1000
ObjectTemplate.setInputToYaw c_PIYaw





rem *** ControlledGate WhiteRed House ***
ObjectTemplate.create SimpleObject ControlledGate_House_WhiteRed_M1
ObjectTemplate.geometry ControlledGate_House_WhiteRed_M1
ObjectTemplate.setHasCollisionPhysics 1


rem *** ControlledGate White House ***
ObjectTemplate.create SimpleObject ControlledGate_House_White_M1
ObjectTemplate.geometry ControlledGate_House_White_M1
ObjectTemplate.setHasCollisionPhysics 1


rem *** MilitaryFence ControlledGate Wheel Base ***
ObjectTemplate.create SimpleObject MilitaryFence_ControlledGate_WheelBase
ObjectTemplate.geometry MilitaryFence_ControlledGate_WheelBase_M1
ObjectTemplate.setHasCollisionPhysics 1


ObjectTemplate.create SimpleObject ControlledGate_GateRail
ObjectTemplate.geometry ControlledGate_GateRail_M1
ObjectTemplate.setHasCollisionPhysics 1


rem *** MilitaryFence ControlledGate Wheel ***
ObjectTemplate.create RotationalBundle MilitaryFence_ControlledGate_Wheel
ObjectTemplate.geometry MilitaryFence_ControlledGate_Wheel_M1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.setNetworkableInfo MilitaryFence_ControlledGate_Wheel_Info
ObjectTemplate.setMinRotation 0/0/-360
ObjectTemplate.setMaxRotation 0/0/360
ObjectTemplate.setMaxSpeed 0/0/400
ObjectTemplate.setAcceleration 0/0/1000
ObjectTemplate.setInputToRoll c_PIYaw



rem *** ControlledGate Seat ***
ObjectTemplate.create SeatObject ControlledGate_Seat
ObjectTemplate.seatFlags c_SeatShowFullBodySoldier
ObjectTemplate.seatFlags c_SeatIsOutside
ObjectTemplate.seatFlags c_SeatShowStandingSoldier


rem *** ControlledGate Entry ***
ObjectTemplate.create EntryPoint ControlledGate_Entry
ObjectTemplate.setEntryRadius 1


rem *** ControlledGate Camera ***
ObjectTemplate.create Camera ControlledGate_Camera
ObjectTemplate.setMaxSpeed 0/0/0
ObjectTemplate.setAcceleration 0/0/0


This is the 3rd controll gate of Smig's custom objects and the lines from:

Code: Select all

bf1942\levels\my_map\objects\controlledgates\objects.con

Re: Custom Object/Gate/Disapper with restart

Posted: Thu Jan 13, 2011 2:49 am
by fo0k
This is the code for the start fence from interstate.. its set to dissappear after 1 minute (it has 60000 hit points and is set to loose 1000 per second)
Use this to check your code..

Code: Select all

objects.con

ObjectTemplate.create PlayerControlObject breakfence
ObjectTemplate.geometry breakfence
ObjectTemplate.setNetworkableInfo breakfencebodyinfo
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.addToCollisionGroup c_CGProjectiles
ObjectTemplate.hitpoints 60000
ObjectTemplate.maxhitpoints 60000
ObjectTemplate.hasArmor 1
ObjectTemplate.criticalDamage 60000
ObjectTemplate.hpLostWhileCriticalDamage 1000
ObjectTemplate.TimeToLiveAfterDeath 0
ObjectTemplate.explosionRadius 0
ObjectTemplate.explosionDamage 0
ObjectTemplate.speedMod 0.0001
ObjectTemplate.setMinimapIcon 0
ObjectTemplate.setMinimapIconSize 0

Code: Select all

network.con

NetworkableInfo.createNewInfo breakfencebodyinfo
NetworkableInfo.setPredictionMode PMLinear

Code: Select all

geometries.con

GeometryTemplate.create StandardMesh breakfence
GeometryTemplate.file Milifence_Largefence_m1
GeometryTemplate.setLodDistance 0 0
GeometryTemplate.setLodDistance 1 25
GeometryTemplate.setLodDistance 2 50
GeometryTemplate.setLodDistance 3 80
GeometryTemplate.setLodDistance 4 150
GeometryTemplate.setLodDistance 5 200

Then setup your objectspawntemplates too with something like.. (time to live and distance will mean nothing in this instance of a non mobile PCO so it doesnt matter what you put there)

Code: Select all

ObjectTemplate.create ObjectSpawner breakfencespawner
ObjectTemplate.setObjectTemplate 2 breakfence
ObjectTemplate.setObjectTemplate 1 breakfence
ObjectTemplate.SpawnDelay 0
ObjectTemplate.SpawnDelayAtStart 0
ObjectTemplate.TimeToLive 999
ObjectTemplate.Distance 40
ObjectTemplate.DamageWhenLost 10
then just spawn it.. :)

Code: Select all

Object.create breakfencespawner
Object.absolutePosition 379.585/75.452/1965.64
Object.setOSId 1

Re: Custom Object/Gate/Disapper with restart

Posted: Fri Jan 14, 2011 3:52 pm
by MillerMod
Well Fook thx!

But i think, this is a little complicated. There has to be a simple and easy way to get the gates work. Smig did a real good job of them, so i think we can do it right somehow.

There is a map, called North_Sea_Docks.rfa, there are 2 of the controlled gates and they work after the restart! The creator of the map spawned the gates like an object as i did, but maybe i forget soemthing ... :(

Re: Custom Object/Gate/Disapper with restart

Posted: Sat Jan 15, 2011 2:22 am
by Swaffy
If you took the gate from that mod, you are probably missing a file or more. Keep looking.

Re: Custom Object/Gate/Disapper with restart

Posted: Sat Jan 15, 2011 4:42 pm
by MillerMod
Swaffy wrote:If you took the gate from that mod, you are probably missing a file or more. Keep looking.
No Bro!
I took the files from the original site : http://www.smig.name/

So any ideas? :D Cause i have one: change the gates to an open gate,with no controlled gates.:)