Jump to content
Sign in to follow this  
Mara1681

Increased resistance

Recommended Posts

Hello all,

I have a command this addeventhandler ["HandleDamage",{odolnost=_this execVM "damage.sqf"}] and script:

hintSilent format ["Damage:%1\nProjectile:%2",(_this select 2),(_this select 4)];
copyToClipboard (_this select 4);
if ((_this select 4) == "GrenadeHandTimedWest" or (_this select 4) == "GrenadeHandTimedEast")
{
(_this select 0) setDamage damage (_this select 0) + (_this select 2)/15;
}
else
{
(_this select 0) setDamage damage (_this select 0) + (_this select 2)/50;
}

This script really works fine, but if pipebomb blows up near me, then the increased damage is to small. The string (_this select 4) returns a classname, then I would have to describe the whole script with variables.

But I have got an idea to resolve it... http://community.bistudio.com/wiki/in_String_(VBS2)

_classname = (_this select 4);
_classname = ToLower _classname;
if ("grenade" in _classname | "bomb" in _classname)
{
(_this select 0) setDamage damage (_this select 0) + (_this select 2)/15;
}
if ("ball" in _classname | "sd" in _classname)
{
(_this select 0) setDamage damage (_this select 0) + (_this select 2)/50;
}

It doesn't work, because in String (VBS2) is only for a game named Virtual Bettlespace 2... Is here some way, how to reach the same method in ArmA 2? Looking forward for your answers... :yay:

Edited by Mara1681

Share this post


Link to post
Share on other sites

String commands are in great demand. Only way that comes to mind is messing with toArray and go from there.

Some silly attempt at something that didn't quite turn out the way I hoped, but somehow still was in my code:

	_bullet = [];
	_bullet = toArray _ammo;
	for "_i" from 0 to count _bullet - 3 do {
		_bullet set [_i, objNull];
	};
	_bullet = _bullet - [objNull];
	_bullet = toString _bullet;
	if (_bullet in ["SD","SB"]) then {
		_radius = 75;
	};

I only needed the last two letters. For more complex matching you might lookup some of the BIS functions.

Edited by CarlGustaffa

Share this post


Link to post
Share on other sites

Thank you so much! I used this...

for "_i" from 1 to count _bullet do

...to get first letter!

B_545x39_Ball -> returns B as Bullet

F_40mm_White -> returns F as Flare

G_40mm_HE -> returns G as Grenade launcher

M_Stinger_AA or R_M136_AT -> returns R as Racket

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  

×