Killing dummy objects easy code

Lots of cool and useful tips to mod either serverside or clientside
Post Reply
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Killing dummy objects easy code

Post by freddy »

Easy way to "kill" dummy objects instead of using deathbubbles or fiddling with the criticalDamage values. No extra code for taking care of the wreck or such needed.

Code: Select all

ObjectTemplate.Active BF109
ObjectTemplate.timeToLiveAfterDeath 6
ObjectTemplate.destroyed 1
As it spawns already "destroyed" it exists for the time set in the timeToLiveAfterDeath code before it vanish, it works fine to addtemplate spawners, soldierspawns and so on. The engine is disabled by default but weapons still work.

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

Re: Killing dummy objects easy code

Post by fo0k »

so a solution to this is good but could you put this into perspective a bit more.. why would someone want to 'kill dummy objects' ?
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Killing dummy objects easy code

Post by freddy »

Well its often needed to use dummy objects to fulfil a function of two parameters, in ssm modding theres not much to choose from either.

Lets try this as an example, say you have two flags and you want a soldierspawn to apear for one team when both flags are taken by the other team, so we use for example a sub for its soldierspawn, rip it from the sub and add it to a jeep and let the flags spawn these vehicles and so when both conditions are met the soldierspawn shows up.

so far so good but we cant have that spawn there forever, if the flags get taken back we want the soldierspawn to dissapear again, and this is where the "kill the dummy object" code comes in. its much easier then using hpLostWhileCriticalDamage or deathbubbles or even let the object fall to its death etc, you can set the time for creation (SpawnDelay) and dissapearence (timeToLiveAfterDeath) with ease, it think even in decimals (havent tried that yet tho)

Another but perhaps not so common example of when you would want to remove a dummy object in a certain timeframe
viewtopic.php?f=43&t=56
or
viewtopic.php?f=43&t=1611
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Killing dummy objects easy code

Post by fo0k »

I see.. yeah that is simple and useful when you put it like that. I'm not so ssm minded.

I like anything like this though.. its a 'switch' basically.. and bf could use more switches.. they do fun stuff.
Shrooms
Posts: 70
Joined: Wed Aug 11, 2010 12:35 am

Re: Killing dummy objects easy code

Post by Shrooms »

Freddy, I like the idea. I want to change it up. Make the dummy objects indestructible, preventing base campers from destroying planes and such. I'm not sure how I can achieve this though. Repair points is my current solution. You know of an alternative?
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Killing dummy objects easy code

Post by freddy »

Shrooms wrote:Freddy, I like the idea. I want to change it up. Make the dummy objects indestructible, preventing base campers from destroying planes and such. I'm not sure how I can achieve this though. Repair points is my current solution. You know of an alternative?
changing the materials of the dummy object should work fine ssm, or perhaps try something with the AddToCollisionGroup argument
"c_CGProjectiles - Allows bullets to pass through it (e.g., fencing) "

http://bfmods.com/mdt/scripting/ObjectT ... Group.html
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Killing dummy objects easy code

Post by freddy »

i just come to think of that you can spawn indestructible and visible objects ssm, aslong as they have the networkinfo.

theres a thread somewhere with the things you can spawn, i remember the Katyusha rocketramp and the ptboats sidegunner as an example

edit: http://battlefieldmodding.com/ssm/phpBB ... 543c01f1c5
Post Reply