PDA

View Full Version : AP Mines and Multiplay mystery



TFC_Silence
Aug 20 2009, 14:59
Hi all, I will try to keep this as concise as possible in order to make the questions clear.

A friend and I are creating a AP mine, I know there are alot of mine scripts about, but before you right this post off as a none searcher, this is different..

My friend wants a AP mine, that does not kill, only maims the first time.

So in order to create this I set a civillian on Utes airfield and placed 3 markers on airfield to denote mines..

This is SQS file


mine ="mineE" createVehicle [(getMarkerPos "mark01" select 0),(getMarkerPos "mark01" select 1),-0.08];
mine = createTrigger["emptyDetector",getPos mine];
mine setTriggerArea [1,1,0,false];mine setTriggerActivation ["any","present",false];
mine setTriggerStatements["this","[thislist select 0] execVM""mine.sqf""",""];


mine ="mineE" createVehicle [(getMarkerPos "mark02" select 0),(getMarkerPos "mark02" select 1),-0.08];
mine = createTrigger["emptyDetector",getPos mine];
mine setTriggerArea [1,1,0,false];mine setTriggerActivation ["any","present",false];
mine setTriggerStatements["this","[thislist select 0] execVM""mine.sqf""",""];


mine ="mineE" createVehicle [(getMarkerPos "mark03" select 0),(getMarkerPos "mark03" select 1),-0.08];
mine = createTrigger["emptyDetector",getPos mine];
mine setTriggerArea [1,1,0,false];mine setTriggerActivation ["any","present",false];
mine setTriggerStatements["this","[thislist select 0] execVM""mine.sqf""",""];


this is mine.SQF file


_unit = _this select 0;

_bomb2 = "GrenadeBase" createVehicle [(getPosASL _unit select 0),( getPosASL _unit select 1),-160];
if ((Damage _unit) >= 0.55) then {_unit setDamage 1} else {_unit setDamage 0.55};



The mine Sqf file was written with help from users at armaholics

the problem with setDamge command is it damages, but if you step on another it sets it again to the same value. So I added the if,then,else statement..

It works in editor perfectly

It works in Lan mode after exporting to multiplayer perfectly

It will NOT work on a real server as an installed PBO, thats the issue.

My limited understanding of the difference between mulitplay and sinlgeplay editing is at an end with this. I have a GameLogic "server"

The problem with Server version is it always kills you outright..

Thanks for reading

F2k Sel
Aug 20 2009, 18:05
if ((Damage _unit) >= 0.55) then {_unit setDamage 1} else {_unit setDamage 0.55};

If the damage is greater than 0.55 then kill the soldier else keep the damage at 0.55

Shouldn't it be this too keep him alive


if ((Damage _unit) >= 0.55) then {_unit setDamage 0.55} else {_unit setDamage 0.55};


But that would be pointless as it's the same as setdamage 0.55 which makes the maximum damage 0.55 no matter how many times it's hit.


I haven't done any MP coding but if the units are dying it sounds like it's getting damage from both the server and the user PC.

Maybe this will work


if(isServer) then {
// code to be run only on the server
};

Place your code between {} , but it's only a guess.

Or this placed as the first line
if (!local server) exitWith {};

TFC_Silence
Aug 20 2009, 19:30
No the 'if' is correct, if unit is already damaged beyond 0.55 kill him for being silly enough to step on another :)

This sounds like a good solution, I was not aware the server does damage too, but I remember reading aout this command and not applying to this problem. I will keep you informed as to the result.

Thank you for your reply :)

---------- Post added at 08:30 PM ---------- Previous post was at 08:01 PM ----------

Thats was the answer m8


if(isServer) then

{

_unit = _this select 0;
_bomb2 = "GrenadeBase" createVehicle [(getPosASL _unit select 0),( getPosASL _unit select 1),-160];
if ((Damage _unit) >= 0.55) then {_unit setDamage 1} else {_unit setDamage 0.55};


};


Works 100% tested with a small group

Thanks again