- Logdateien zur Fehleranalyse
- Nein, ich habe keine Logdateien hochgeladen
Hello, I did everything as shown in the tutorial. But HP always regenerates itself when I put on the seat belt, when I crash.
Hello, I did everything as shown in the tutorial. But HP always regenerates itself when I put on the seat belt, when I crash.
What exactly do you want to do and what tutorial is it exactly about? Without details and without logs no one will be able to help you
What exactly do you want to do and what tutorial is it exactly about? Without details and without logs no one will be able to help you I
I mean. HP goes up When I wear seat belts, when ı have an accident. I think the problem is caused by this script. Even though I did everything from scratch, my dear suddenly becomes 100%.
I mean. HP goes up When I wear seat belts, when ı have an accident. I think the problem is caused by this script. Even though I did everything from scratch, my dear suddenly becomes 100%.
can you upload / show us your complete fn_handleDamage.sqf
there is actuall no way that the HP go up with this code, so maybe there is an error in other lines of the file
can you upload / show us your complete fn_handleDamage.sqf
there is actuall no way that the HP go up with this code, so maybe there is an error in other lines of the file
wrong TaktischerSpeck
The code itself is flawed.
Return value of Damage EH is total new damage. Lower means less damage, so if you divide damage in half that doesn't mean "player gets half the damage" but "player gains 50% of his current HP value"
if you want the player to receive half the damage you need to adapt your code like this (broken down to sub-statements for better understanding):
wrong TaktischerSpeck
The code itself is flawed.
Return value of Damage EH is total new damage. Lower means less damage, so if you divide damage in half that doesn't mean "player gets half the damage" but "player gains 50% of his current HP value"
if you want the player to receive half the damage you need to adapt your code like this (broken down to sub-statements for better understanding):
This problem still persists did not fix. It was working very well before ,
could you provide server & client logfiles of this issue?
could you provide server & client logfiles of this issue?
I guess this is the file you said
I guess this is the file you said
thats the server log, we would need your client log aswell
keep in mind that you should try to trigger the error so that we maybe can spot something wrong
how so?
more damage -> less hp
HP = 1 - Damage
_damage = _oldHP + (1 - Damage / 2);
};
will it be like this?
Henne already sent you the correct code.
as I already said - the function needs the damage as return value, not the hp...
Henne already sent you the correct code.
as I already said - the function needs the damage as return value, not the hp...
Yes I know. But I want to know how to add. It will still be an error if I add it wrong. Can you check? If I added it wrong, can you fix it?
#include "..\..\script_macros.hpp"
/*
File: fn_handleDamage.sqf
Author: Bryan "Tonic" Boardwine
Description:
Handles damage, specifically for handling the 'tazer' pistol and nothing else.
*/
params [
["_unit",objNull,[objNull]],
["_part","",[""]],
["_damage",0,[0]],
["_source",objNull,[objNull]],
["_projectile","",[""]],
["_index",0,[0]]
];
//Handle the tazer first (Top-Priority).
if (!isNull _source) then {
if (_source != _unit) then {
if (currentWeapon _source in ["hgun_P07_snds_F","arifle_SDAR_F"] && _projectile in ["B_9x21_Ball","B_556x45_dual"]) then {
if (side _source isEqualTo west && playerSide isEqualTo civilian) then {
_damage = 0;
if (alive player && !life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
private ["_distance"];
_distance = 35;
if (_projectile == "B_556x45_dual") then {_distance = 100;};
if (_unit distance _source < _distance) then {
if !(isNull objectParent player) then {
if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
player action ["Eject",vehicle player];
[_unit,_source] spawn life_fnc_tazed;
};
} else {
[_unit,_source] spawn life_fnc_tazed;
};
};
};
};
//Temp fix for super tasers on cops.
if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
_damage = 0;
};
};
};
};
if(!isNull _source) then {
_isVehicle = if(vehicle _source != _source) then {true} else {false};
if (_isVehicle) then {
//_damage = false;
_unit setDamage 0.0001;
};
};
if ((vehicle _unit) isKindOf "Car" && (isNull _source || _source isEqualTo _unit)) then
{
_damage = if (life_seatbelt) then {_damage = _oldHP + (_damageTaken / 2); else { _damage};
}
[] spawn life_fnc_hudUpdate;
_damage;
Alles anzeigen
you didn't use the whole code... where did you define _oldHP? where _damageTaken?
If you don't define variables you can't use them
you didn't use the whole code... where did you define _oldHP? where _damageTaken?
If you don't define variables you can't use them
Won't it be that way?
look at that code. There are variables defined you're missing!
look at that code. There are variables defined you're missing!
if ((vehicle _unit) isKindOf "Car" && (isNull _source || _source isEqualTo _unit)) then
{
_damage = if (life_seatbelt) then {_damage = _oldHP + (_damageTaken / 2); else { _damage};
}
Can you help me organize this? I'm so confused. I don't know where to add what.
bro.. just search for some easy tutorials and instructions how SQF works.
They gave you a complete code and you just have to define the variables and dont just copy and paste
Take a looK. https://community.bistudio.com/wiki/Variables