Quantcast

Jump to content

» «
Photo

Smuggler's Run bombs in SP?

5 replies to this topic
uNiverselEgacy
  • uNiverselEgacy

    Player Hater

  • Members
  • Joined: 15 Jul 2015
  • United-States

#1

Posted 4 weeks ago

Has anyone figured out how to do it in SP? I copied the code in the script as you can see below and it sort of works.
There is only one problem though and that is the bombs don't trigger an explosion effect when they detonate. I only get the particle effect of some dirt/debris/smoke.
The bomb does deal damage when they explode and the funny thing is if I use EXPLODE_PROJECTILES to manually make them explode the explosion effect is shown just fine.
 
static void DROP_BOMB(float x1, float y1, float z1, float x2, float y2, float z2, int damage, BOOL p7, Hash weaponHash, Ped ownerPed, BOOL isAudible, BOOL isInvisible, float speed, Entity entity, BOOL p14, BOOL p15, BOOL p16, BOOL p17, BOOL p18, BOOL p19, BOOL p20) { invoke<Void>(0xBFE5756E7407064A, x1, y1, z1, x2, y2, z2, damage, p7, weaponHash, ownerPed, isAudible, isInvisible, speed, entity, p14, p15, p16, p17, p18, p19, p20); }


void func_4986(Vehicle iParam0, Hash iParam1, Vector3 *uParam2, Vector3 *uParam3, Vector3 *uParam4, Vector3 *uParam5)
{
	Vector3 vVar0;
	Vector3 Var1;
	Vector3 vVar2;
	Vector3 vVar3;
	Vector3 vVar4;
	Vector3 vVar5;

	GAMEPLAY::GET_MODEL_DIMENSIONS(iParam1, &vVar0, &Var1);
	vVar2.x = vVar0.x;
	vVar2.y = Var1.y;
	vVar2.z = vVar0.z;
	vVar3.x = Var1.x;
	vVar3.y = Var1.y;
	vVar3.z = vVar0.z;
	vVar4.x = vVar0.x;
	vVar4.y = vVar0.y;
	vVar4.z = vVar0.z;
	vVar5.x = Var1.x;
	vVar5.y = vVar0.y;
	vVar5.z = vVar0.z;
	*uParam2 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iParam0, vVar2.x, vVar2.y, vVar2.z);
	*uParam3 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iParam0, vVar3.x, vVar3.y, vVar3.z);
	*uParam4 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iParam0, vVar4.x, vVar4.y, vVar4.z);
	*uParam5 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iParam0, vVar5.x, vVar5.y, vVar5.z);
}

static float func_4983(Vehicle iParam0)
{
	float fVar0 = 0;

	switch (ENTITY::GET_ENTITY_MODEL(iParam0))
	{
	case 0xD9927FE3:	// cuban800
		fVar0 = 0.5f;
		break;

	case -749299473:
		fVar0 = 0.45f;
		break;

	case -975345305:
		fVar0 = 0.46f;
		break;

	case -1700874274:
		fVar0 = 0.55f;
		break;

	case -392675425:
		fVar0 = 0.5f;
		break;

	case 1043222410:
		fVar0 = 0.6f;
		break;

	case -32878452:
		fVar0 = 0.43f;
		break;

	case -42959138:
		fVar0 = 0.5f;
		break;
	}
	return fVar0;
}

static float func_4985(float fParam0, float fParam1, float fParam2, float fParam3, float fParam4)
{
	return ((((fParam1 - fParam0) / (fParam3 - fParam2)) * (fParam4 - fParam2)) + fParam0);

}
static Vector3 func_4984(Vector3 vParam0, Vector3 vParam1, float fParam2, float fParam3, float fParam4)
{
	return MAKE_VECTOR3(func_4985(vParam0.x, vParam1.x, fParam2, fParam3, fParam4), func_4985(vParam0.y, vParam1.y, fParam2, fParam3, fParam4), func_4985(vParam0.z, vParam1.z, fParam2, fParam3, fParam4));
}


static void drop_bomb(Vehicle iParam0, Ped ped)
{
	// VEHICLE_WEAPON_BOMB VEHICLE_WEAPON_BOMB_INCENDIARY VEHICLE_WEAPON_BOMB_GAS VEHICLE_WEAPON_BOMB_CLUSTER
	Hash weaponHashes[] = {0x9AF0B90C, 0x6AF7A717, 0x5540A91E, 0x0D28BCA3};

	// W_Smug_Bomb_01, W_Smug_Bomb_04, W_Smug_Bomb_03, W_Smug_Bomb_02
	Hash weaponModelHashes[] = {0xC4A21131, 0x351A7220, 0x23E64FB8, 0xD6D0B58E};

	Vector3 vVar0;
	Vector3 vVar1;
	Vector3 vVar2;
	Vector3 vVar3;
	Vector3 vVar4;
	Vector3 vVar5;
	Vector3 vVar6;
	Vector3 vVar7;

	auto type = VEHICLE::GET_VEHICLE_MOD(Globals::curVehicle, 9);
	if (type < 0 || type >= ARRAYSIZE(weaponHashes))
		return;

	request_model(weaponModelHashes[type]);

	func_4986(iParam0, ENTITY::GET_ENTITY_MODEL(iParam0), &vVar0, &vVar1, &vVar2, &vVar3);
	vVar4 = func_4984(vVar0, vVar1, 0.0f, 1.0f, 0.5f);
	vVar5 = func_4984(vVar2, vVar3, 0.0f, 1.0f, 0.5f);
	vVar4.z = (vVar4.z + 0.4f);
	vVar5.z = (vVar5.z + 0.4f);
	vVar6 = func_4984(vVar4, vVar5, 0.0f, 1.0f, func_4983(iParam0));
	vVar4.z = (vVar4.z - 0.2f);
	vVar5.z = (vVar5.z - 0.2f);
	vVar7 = func_4984(vVar4, vVar5, 0.0f, 1.0f, (func_4983(iParam0) - 0.0004f));

	DROP_BOMB(vVar6.x, vVar6.y, vVar6.z, vVar7.x, vVar7.y, vVar7.z,
		0, FALSE, weaponHashes[type], ped, TRUE, TRUE, 0.0f,
		0, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE);

	AUDIO::PLAY_SOUND_FRONTEND(-1, "bomb_deployed", "DLC_SM_Bomb_Bay_Bombs_Sounds", TRUE);
}

 


uNiverselEgacy
  • uNiverselEgacy

    Player Hater

  • Members
  • Joined: 15 Jul 2015
  • United-States

#2

Posted 3 weeks ago

I mean anyone any thoughts?


K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Technology / Programming] 2016
    Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#3

Posted 3 weeks ago

You are calling DROP_BOMB with damage = 0 and isInvisible set. Have you tried playing with these values?

uNiverselEgacy
  • uNiverselEgacy

    Player Hater

  • Members
  • Joined: 15 Jul 2015
  • United-States

#4

Posted 3 weeks ago

You are calling DROP_BOMB with damage = 0 and isInvisible set. Have you tried playing with these values?

Those are the exact values in the script.

I've tried different values but they don't seem to make any difference.

The parameter names are from NativeDB. Apparently some of them don't seem to do what their names suggest.


K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Technology / Programming] 2016
    Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#5

Posted 3 weeks ago

The code overall doesn't do much, other than computing the correct starting position for the bomb, so outside of playing with parameters passed to DROP_BOMB, not a whole lot that can go wrong. Could there be another script triggered on actual explosion?

SkelePap
  • SkelePap

    GTA SA 4 LIFE!

  • Members
  • Joined: 26 Jan 2016
  • Israel

#6

Posted A week ago

So how's the progress on this? Will you also make the countermeasures work in SP?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users