Page 1 of 1

Killing dummy objects easy code

Posted: Thu Feb 07, 2013 8:08 pm
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.


Re: Killing dummy objects easy code

Posted: Fri Feb 15, 2013 2:16 pm
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' ?

Re: Killing dummy objects easy code

Posted: Fri Feb 15, 2013 7:29 pm
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

Re: Killing dummy objects easy code

Posted: Sat Feb 16, 2013 3:48 am
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.

Re: Killing dummy objects easy code

Posted: Sun Feb 24, 2013 8:01 pm
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?

Re: Killing dummy objects easy code

Posted: Sun Feb 24, 2013 9:41 pm
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

Re: Killing dummy objects easy code

Posted: Sun Feb 24, 2013 9:57 pm
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