Jump to content
Sign in to follow this  
jaac

Vbldamage replacement vehicle destroyed

Recommended Posts

Hi ;)

This is my first post on this forum, I would ask you to be indulgent on my translation, I try to do better... :rolleyes:

I would replace my model in good condition, by IG destroyed model.

(as are the helicopters in Arma2)

In looking around I discovered that these helicopters had this command that I adapted to my template:

wreck="VBLdamage";

Apparently it does not, the command may not be assigned to vehicle ground.

Against by adding:

class eventhandlers

{

killed = "[_this select 0,_this select 1] exec ""\vbl\scripts\carwreck.sqs""";

};

and the following script:

_vbl = _this select 0

_killer = _this select 1

?(_vbl isKindOf "VBLdamage"):goto "wait"

#wait

~1

?((getpos _vbl select 2) < 2): goto "makewreck"

goto "wait"

#makewreck

_vblpos = getpos _vbl

_vbldir = (getdir _vbl) + 180

_vbl setpos [0,0,0]

~0.1

_wreck = "VBLdamage" createvehicle [(_vblpos select 0),(_vblpos select 1),0]

_wreck setdir _vbldir

_wreck setpos getpos _wreck

deletevehicle _vbl

exit

It works a little better...I say "a little" since being tested on 2 different computers and configs, there is a freezing of screen about one second, 1st at the destruction (1st call of the script).

Then there is no problem.

The questions are:

Anyone knows the command (in Arma2) that he would avoid going through a script?

or

How can I make this script is residing with my template to avoid the load time?

Regards ;)

vbldamage.jpg

Share this post


Link to post
Share on other sites

Yes it doesn't work on land vehicles because the helicopters/planes use a script to make their smoke trails and create the craters on the ground when they crash. it also calls the right damage model. The first thing you could do is get rid of the ancient sqs format and switch to sqf which is used in arma2. To start, lets solve the problem of the script loading delay.

1. make a new file in your vehicle's folder called startup.sqf.

2. add this code to startup.sqf:

if(isNil 'MY_Destruction_Effects_Init') then
{
MY_Destruction_Effects_Init=true;
MY_Destruction_Effects_EH_Killed=compile preprocessFileLineNumbers "\vbl\scripts\carwreck.sqf";
};

3. Under your eventhandler section, add

	init = "_any = _this execVM ""\vbl\scripts\startup.sqf""";

4. set what damage model you want the vehicle to use. add:

wreck="VBLdamage";

to your vehicles cfgvehicles section.

5. Now set up the script to run under sqf format. carwreck.sqf:

_v = _this select 0;
_wreckmodel = GetText (configFile >> "CfgVehicles" >> (typeof _v) >> "wreck");
if (_wreck!="") then 
{
_vpos = getpos _v;
_vdir = vectordir _v;
_vup = vectorup _v;
deletevehicle _v;
_wreck = (_wreckmodel) createvehicle _vpos;
_wreck setpos _vpos;
_wreck setvectordirandup [_vdir,_vup];
};

6. add the killed eventhandler:

killed = "_this select 0 setVehicleInit ""[this] spawn MY_Destruction_Effects_EH_Killed"";processInitCommands";

completely untested, but it should work!

edit

----

just a thought, the delay is probably from the damage model having errors on it, plus being uncompressed. binerizing the model would solve this.

Edited by Sakura_Chan

Share this post


Link to post
Share on other sites

Thank you for your reply ;)

I tested and I have a problem...

The damage model does not load, in place, the vbl back on suspensions. :confused:

before

firstdamage.jpg

after

seconddamage.jpg

startup.sqf and carwreck.sqf are in /vbl/scripts

Here is a part of my cfgvehicles:

class CfgVehicles

{

class Land; // External class reference

class LandVehicle : Land

{

class NewTurret; // External class reference

// class ViewPilot; // External class reference

class Sounds; // External class reference

class AnimationSources;

class DestructionEffects;

};

class Car : LandVehicle

{

class Sounds : Sounds

{

class Engine; // External class reference

class Movement; // External class reference

};

insideSoundCoef = 0.9;

class HitPoints

{

class HitRGlass

{

armor = 0.3;

material = -1;

name = "sklo predni P";

passThrough = 0;

};

class HitLGlass

{

armor = 0.3;

material = -1;

name = "sklo predni L";

passThrough = 0;

};

class HitGlass1

{

armor = 0.1;

material = -1;

name = "glass1";

visual = "glass1";

passThrough = 0;

};

class HitGlass2

{

armor = 0.1;

material = -1;

name = "glass2";

visual = "glass2";

passThrough = 0;

};

class HitGlass3

{

armor = 0.1;

material = -1;

name = "glass3";

visual = "glass3";

passThrough = 0;

};

class HitGlass4

{

armor = 0.1;

material = -1;

name = "glass4";

visual = "glass4";

passThrough = 0;

};

class HitBody

{

armor = 1;

material = -1;

name = "karoserie";

visual = "";

passThrough = 1;

};

class HitFuel

{

armor = 0.3;

material = -1;

name = "palivo";

visual = "";

passThrough = 0;

};

class HitLFWheel

{

armor = 0.15;

material = -1;

name = "wheel_1_1_steering";

visual = "";

passThrough = 0.3;

};

class HitLBWheel

{

armor = 0.15;

material = -1;

name = "wheel_1_2_steering";

visual = "";

passThrough = 0.3;

};

class HitLMWheel

{

armor = 0.15;

material = -1;

name = "wheel_1_3_steering";

visual = "";

passThrough = 0.3;

};

class HitLF2Wheel

{

armor = 0.15;

material = -1;

name = "wheel_1_4_steering";

visual = "";

passThrough = 0.3;

};

class HitRFWheel

{

armor = 0.15;

material = -1;

name = "wheel_2_1_steering";

visual = "";

passThrough = 0.3;

};

class HitRBWheel

{

armor = 0.15;

material = -1;

name = "wheel_2_2_steering";

visual = "";

passThrough = 0.3;

};

class HitRMWheel

{

armor = 0.15;

material = -1;

name = "wheel_2_3_steering";

visual = "";

passThrough = 0.3;

};

class HitRF2Wheel

{

armor = 0.15;

material = -1;

name = "wheel_2_4_steering";

visual = "";

passThrough = 0.3;

};

class HitEngine

{

armor = 0.4;

material = -1;

name = "motor";

visual = "";

passThrough = 0.2;

};

};

secondaryExplosion = 0;

dammageHalf[] = {};

dammageFull[] = {};

getInAction = "GetInLow";

getOutAction = "GetOutLow";

cargoGetInAction[] = {"GetInLow"};

cargoGetOutAction[] = {"GetOutLow"};

weapons[] = {"CarHorn"};

gunnerHasFlares = 0;

class eventhandlers

{

init = "_any = _this execVM ""\vbl\scripts\startup.sqf""";

};

soundEnviron[] = {"", 0.000562341, 1.0};

soundCrash[] = {"\ca\wheeled\Data\Sound\crash2", 1.0, 1};

extCameraPosition[] = {0.5, 2, -10};

soundGear[] = {"", 1e-005, 1};

supplyRadius = 1.2;

driverAction = "ManActShipDriver";

cargoAction[] = {"ManActTestDriver"};

hideUnitInfo = 0;

castDriverShadow = 0;

castCargoShadow = 0;

class AnimationSources

{

class HitLFWheel

{

source = "Hit";

hitpoint = "HitLFWheel";

raw = 1;

};

class HitRFWheel : HitLFWheel {

hitpoint = "HitRFWheel";

};

class HitLBWheel : HitLFWheel {

hitpoint = "HitLBWheel";

};

class HitRBWheel : HitLFWheel {

hitpoint = "HitRBWheel";

};

class HitLF2Wheel : HitLFWheel {

hitpoint = "HitLF2Wheel";

};

class HitRF2Wheel : HitLFWheel {

hitpoint = "HitRF2Wheel";

};

class HitLMWheel : HitLFWheel {

hitpoint = "HitLMWheel";

};

class HitRMWheel : HitLFWheel {

hitpoint = "HitRMWheel";

};

class HitGlass1 {

source = "Hit";

hitpoint = "HitGlass1";

raw = 1;

};

class HitGlass2 : HitGlass1 {

hitpoint = "HitGlass2";

};

class HitGlass3 : HitGlass1 {

hitpoint = "HitGlass3";

};

class HitGlass4 : HitGlass1 {

hitpoint = "HitGlass4";

};

};

};

class Landrover: Car {};

class VBL: Landrover

{

scope = 2;

accuracy = 0.3;

side = 2;

faction = "FR";

wheelCircumference = 2.834;

Model = "\VBL\VBL";

Picture = "\Ca\wheeled\data\ico\HMMWV50_CA.paa";

Icon = "\Ca\wheeled\data\map_ico\icomap_hmwv50_CA.paa";

mapSize = 5;

displayName = VBL;

vehicleClass = "Vehicule_Fr";

crew = "USMC_Soldier";

typicalCargo[] = {"USMC_Soldier", "USMC_Soldier", "USMC_Soldier_AT", "USMC_Soldier_Officer"};

damperSize = 0.2;

damperForce = 1;

damperDamping = 1;

armor = 50;

damageResistance = 0.00562;

terrainCoef = 2.2;

enableGPS = 1;

type = 1;

cost = 100000;

armorGlass = 0.5;

armorWheels = 0.1;

// soundServo[] = {"\Ca\sounds\Vehicles\Servos\turret-1", 0.01, 1.0, 10};

soundEnviron[] = {"", 0.562341, 1};

transportSoldier = 3;

wreck="VBLdamage";

// destrType = "DestructWreck";

maxspeed = 105;

acceleration = 80;

animated = false;

fuelCapacity = 200;

canFloat=true;

nightVision=true;

hasGunner = 0;

class Turrets {};

hascommander = false;

memoryPointsGetInDriver = "pos driver";

memoryPointsGetInDriverDir = "pos driver dir";

memoryPointsGetInCargo = "pos cargo";

memoryPointsGetInCargoDir = "pos cargo dir";

selectionBrakeLights = "brzdove svetlo";

selectionBackLights = "zadni svetlo";

selectionDashboard = "podsvit pristroju";

class Exhausts

{

class Exhaust1

{

position = "vyfuk start";

direction = "vyfuk konec";

effect = "ExhaustsEffect";

};

};

class eventhandlers

{

killed = "_this select 0 setVehicleInit ""[this] spawn MY_Destruction_Effects_EH_Killed"";processInitCommands";

};

I tested with my first script (in sqf), the result is the same.

Thank you again for your interest.. ;)

Share this post


Link to post
Share on other sites
Yes it doesn't work on land vehicles because the helicopters/planes use a script to make their smoke trails and create the craters on the ground when they crash. it also calls the right damage model.

Not exactly. The wreck is not called by the script, it's handled by the engine.

It's done by a new LOD in the model as far as I know.

Here is a thread about it, but no definitive answer.

Edited by Maddmatt

Share this post


Link to post
Share on other sites

Yes I discovered that recently, I disabled the plane crash effects and the damage model still appeared.

to the op= does it say processInitComm ands or processInitCommands at the end?

Share this post


Link to post
Share on other sites

Jaac I noticed that the stock A2 hummers do the same thing.

When the tyres are destroyed the vehicle sits lower but as soon as the vehicle is fully destroyed and on fire it seems to raise up on it's suspension.

So it's not just yours mate.

Share this post


Link to post
Share on other sites

Thanks for the precision ;) I reassured.

Well, it does not help my problem...

after multiple tries, I think the script "startup.sqf" does not work.

might need to be change this. but I do not know how to it.

also, I tried the lod wreck with "destrType = "DestructWreck";" but without results :butbut:

to be continued...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×