OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: ArMaTeC on 30 May 2007, 04:57:42
-
Hi all i need some help as im pulling out my hair whats left of it.
Ok im making a revised version of my ArmA Gunship deathmatch for 1.07/1.08 i was having trobble with the dedicated server as i keep getting null object error
can some on test it for me and is if u can locate the error
Thanks in advanced
Most upto date mission attached 31.05.07 21.52 GMT
-
1) First script: What variable is being returned as a null object?
2) Second script: More details please. What exactly is the script supposed to do and what is the error?
-
1st sometimes _victim and sometimes _killer depending on who killed who. Its strange as i thought ArmA returned who killed who and who was killed by who but its not ?
2nd its a tracking script that returns what the unit is in and who he is also what score he has so it can be displayed in the map view as a marker
-
1) The "KILLED" eventhandler should still behave the same as in OFP. Is the script unchanged from OFP version?
2) Should this line:
?!isNull player : _name = name _unit;be
?!isNull _unit : _name = name _unit;
-
this mission is 100% not andersons mission just based on it ok ill test out the ?!isNull _unit : _name = name _unit but i think i already try this.
The main problem is the score script returning null when it should not ever be null any help on it would be good
Also maybe its a bug with arma but if u try to run
_person = name _unit
and the _unit is Null ArmA crashs
-
1) I do not see any code to remove the eventhandler from the dead body and add it to the player when he respawns. Is your code only working the first time a player is killed?
-
arr maybe its the removing EH part
The adding part is in movie\rearm.sqs at bottom
As a note remember to run 1.07+ or 1.07
::Edit::
Ok i changed the tracking script and added _victim removeEventHandler ["killed", tx_kill] to playerkilled.sqs should this now all work fine?
-
You also need to add the "KILLED" eventhandler again once the player is alive. The "KILLED" eventhandler only fires on the machine of the victim, so the playerkilled script only runs there as well. You need to add the following lines to the bottom of the script:
@alive player
player addEventHandler ......
-
So the bottom should look like this.
if(SIX_DEBUG_MISS&&six_isClient)then{player globalChat "DEBUG:Rearm running track.sqs";};
[_Unit] exec "movie\track.sqs";
if(SIX_DEBUG_MISS&&six_isClient)then{player globalChat "DEBUG:Rearm running killed.sqs";};
[_Unit] exec "KILLED.sqs";
if(SIX_DEBUG_MISS&&six_isClient)then{player globalChat "DEBUG:Rearm running halo.sqs";};
[_Unit,120,20,500] exec "halo\realhalo.sqs";
[] exec "scm\messages.sqs";
[] exec "scm\kills.sqs";
@alive player
if(SIX_DEBUG_MISS&&six_isClient)then{player globalChat "DEBUG:Rearm Adding event handle killed";};
tx_kill = _Unit addEventHandler ["killed", {_this exec "score\playerkilled.sqs"}];
-
Yes
-
If you want to use it on AI, then you are stuck as far as adding and removing the eventhandlers. When the AI dies the variable _unit points to its corpse and a new variable points to its respawned body. I do not know how to deal with this in terms of MP auto-respawning. However, if the players are all human it should work.
-
Holy if statements, batman. You know you could cut a crapload of unnecessary lines out of this script with some dynamic variables. All of this:
if (_killer == s1)then {arma_s1score = arma_s1score + 1; Publicvariable _kils;};
if (_victim == s1)then {arma_s1death = arma_s1death + 1; Publicvariable _kils1;};
if (_killer == s1)then {arma_s1score = arma_s1score + 1; Publicvariable _kils;};
if (_victim == s1)then {arma_s1death = arma_s1death + 1; Publicvariable _kils1;};
if (_killer == s2)then {arma_s2score = arma_s2score + 1; Publicvariable _kils;};
if (_victim == s2)then {arma_s2death = arma_s2death + 1; Publicvariable _kils1;};
if (_killer == s3)then {arma_s3score = arma_s3score + 1; Publicvariable _kils;};
if (_victim == s3)then {arma_s3death = arma_s3death + 1; Publicvariable _kils1;};
if (_killer == s4)then {arma_s4score = arma_s4score + 1; Publicvariable _kils;};
if (_victim == s4)then {arma_s4death = arma_s4death + 1; Publicvariable _kils1;};
if (_killer == s5)then {arma_s5score = arma_s5score + 1; Publicvariable _kils;};
if (_victim == s5)then {arma_s5death = arma_s5death + 1; Publicvariable _kils1;};
if (_killer == s6)then {arma_s6score = arma_s6score + 1; Publicvariable _kils;};
if (_victim == s6)then {arma_s6death = arma_s6death + 1; Publicvariable _kils1;};
if (_killer == s7)then {arma_s7score = arma_s7score + 1; Publicvariable _kils;};
if (_victim == s7)then {arma_s7death = arma_s7death + 1; Publicvariable _kils1;};
if (_killer == s8)then {arma_s8score = arma_s8score + 1; Publicvariable _kils;};
if (_victim == s8)then {arma_s8death = arma_s8death + 1; Publicvariable _kils1;};
if (_killer == s9)then {arma_s9score = arma_s9score + 1; Publicvariable _kils;};
if (_victim == s9)then {arma_s9death = arma_s9death + 1; Publicvariable _kils1;};
if (_killer == s10)then {arma_s10score = arma_s10score + 1; Publicvariable _kils;};
if (_victim == s10)then {arma_s10death = arma_s10death + 1; Publicvariable _kils1;};
if (_killer == s11)then {arma_s11score = arma_s11score + 1; Publicvariable _kils;};
if (_victim == s11)then {arma_s11death = arma_s11death + 1; Publicvariable _kils1;};
if (_killer == s12)then {arma_s12score = arma_s12score + 1; Publicvariable _kils;};
if (_victim == s12)then {arma_s12death = arma_s12death + 1; Publicvariable _kils1;};
if (_killer == s13)then {arma_s13score = arma_s13score + 1; Publicvariable _kils;};
if (_victim == s13)then {arma_s13death = arma_s13death + 1; Publicvariable _kils1;};
if (_killer == s14)then {arma_s14score = arma_s14score + 1; Publicvariable _kils;};
if (_victim == s14)then {arma_s14death = arma_s14death + 1; Publicvariable _kils1;};
if (_killer == s15)then {arma_s15score = arma_s15score + 1; Publicvariable _kils;};
if (_victim == s15)then {arma_s15death = arma_s15death + 1; Publicvariable _kils1;};
if (_killer == s16)then {arma_s16score = arma_s16score + 1; Publicvariable _kils;};
if (_victim == s16)then {arma_s16death = arma_s16death + 1; Publicvariable _kils1;};
if (_killer == s17)then {arma_s17score = arma_s17score + 1; Publicvariable _kils;};
if (_victim == s17)then {arma_s17death = arma_s17death + 1; Publicvariable _kils1;};
if (_killer == s18)then {arma_s18score = arma_s18score + 1; Publicvariable _kils;};
if (_victim == s18)then {arma_s18death = arma_s18death + 1; Publicvariable _kils1;};
if (_killer == s19)then {arma_s19score = arma_s19score + 1; Publicvariable _kils;};
if (_victim == s19)then {arma_s19death = arma_s19death + 1; Publicvariable _kils1;};
if (_killer == s20)then {arma_s20score = arma_s20score + 1; Publicvariable _kils;};
if (_victim == s20)then {arma_s20death = arma_s20death + 1; Publicvariable _kils1;};
if (_killer == s21)then {arma_s21score = arma_s21score + 1; Publicvariable _kils;};
if (_victim == s21)then {arma_s21death = arma_s21death + 1; Publicvariable _kils1;};
if (_killer == s22)then {arma_s22score = arma_s22score + 1; Publicvariable _kils;};
if (_victim == s22)then {arma_s22death = arma_s22death + 1; Publicvariable _kils1;};
if (_killer == s23)then {arma_s23score = arma_s23score + 1; Publicvariable _kils;};
if (_victim == s23)then {arma_s23death = arma_s23death + 1; Publicvariable _kils1;};
if (_killer == s24)then {arma_s24score = arma_s24score + 1; Publicvariable _kils;};
if (_victim == s24)then {arma_s24death = arma_s24death + 1; Publicvariable _kils1;};
if (_killer == s25)then {arma_s25score = arma_s25score + 1; Publicvariable _kils;};
if (_victim == s25)then {arma_s25death = arma_s25death + 1; Publicvariable _kils1;};
if (_killer == s26)then {arma_s26score = arma_s26score + 1; Publicvariable _kils;};
if (_victim == s26)then {arma_s26death = arma_s26death + 1; Publicvariable _kils1;};
if (_killer == s27)then {arma_s27score = arma_s27score + 1; Publicvariable _kils;};
if (_victim == s27)then {arma_s27death = arma_s27death + 1; Publicvariable _kils1;};
if (_killer == s28)then {arma_s28score = arma_s28score + 1; Publicvariable _kils;};
if (_victim == s28)then {arma_s28death = arma_s28death + 1; Publicvariable _kils1;};
could be replaced with this:
call compile format ["arma_%1score",_killer] = (call compile format ["arma_%1score",_killer]) + 1;
call compile format ["arma_%1death",_victim] = (call compile format ["arma_%1death",_victim]) + 1;
{publicVariable _x} forEach ["_kils","_kils1"];
58 lines codensed down to 3.
-
That's my fault. I skipped a step; the script was trying to dynamically create identifiers, which isn't possible in ArmA's scripting language.
Try this instead (still only 5 lines):
_varName1 = format ["arma_%1score",_killer];
_varName2 = format ["arma_%1death",_victim];
call compile format ["%1 = %1 + 1",_varName1];
call compile format ["%1 = %1 + 1",_varName2];
{publicVariable _x} forEach ["_kils","_kils1"];
I know that will work.
-
What are the variables kils and kils1 supposed to be?
-
Maybe I'm missing something, but it looks like the _kils variables are superfluous. Where are they actually used? I think the variables that you really want to make public are the arma_%1score and arma_%1death ones.
-
im getting a Null-Object error in the mission on the first post could soem one take a look at it for me please i wanna have this out and ready for 1.08 on monday
-
Check your mission, but definitively too many scripts here and there, you need at least to catch the script where your null object is causing problems.
-
ok i think i found the script with the error in it can soem one take a look at it for me and see if u can work out why the <object-null> error pops up in mp but not in SP
// Gunship Deathmatch
// By ArMaTeC
//
// Usage: score board system killed
// Edited: 08.06.07 17:40
_GTBody = format [("Game Time: ") + "%1", [ceil(time)] call convertTimeFunctions];
if(ArmA_debug)then{player globalChat format["DEBUG: playerkilled.sqs Started",_GTBody];};
_victim = _this select 0;
_killer = _this select 1;
_victim removeEventHandler ["killed", tx_kill];
_victim removeEventHandler ["dammaged", tx_dammage];
_message ="";
_name_killer ="error";
_name_victim ="error";
if((!isNull _killer) or (not alive _killer))then {_name_killer = name _killer;};
if((!isNull _victim) or (not alive _victim))then {_name_victim = name _victim;};
_name_victim =
if(_killer == _victim) then {_message = format [localize "STR_ISDE",_name_killer];};
if(_killer != _victim) then {_message = format [localize "STR_KILL",_name_killer, _name_victim];};
messagewwdd = formaT [localize "STR_NFLASH",_message];
[1,messagewwdd] call six_fTxRadio;
if(ArmA_debug)then{player globalChat format["DEBUG:playerkilled.sqs news flash message %1 %2",messagewwdd,_GTBody];};
_kils = format ["arma_%1score",_killer];
_kils1 = format ["arma_%1death",_victim];
if(ArmA_debug)then{player globalChat format["DEBUG:playerkilled.sqs killer %1 - killed%2 %3",_kils,_kils1,_GTBody];};
if(_killer == s1)then {arma_s1score = arma_s1score + 1; Publicvariable _kils;};
if(_victim == s1)then {arma_s1death = arma_s1death + 1; Publicvariable _kils1;};
if(_killer == s1)then {arma_s1score = arma_s1score + 1; Publicvariable _kils;};
if(_victim == s1)then {arma_s1death = arma_s1death + 1; Publicvariable _kils1;};
if(_killer == s2)then {arma_s2score = arma_s2score + 1; Publicvariable _kils;};
if(_victim == s2)then {arma_s2death = arma_s2death + 1; Publicvariable _kils1;};
if(_killer == s3)then {arma_s3score = arma_s3score + 1; Publicvariable _kils;};
if(_victim == s3)then {arma_s3death = arma_s3death + 1; Publicvariable _kils1;};
if(_killer == s4)then {arma_s4score = arma_s4score + 1; Publicvariable _kils;};
if(_victim == s4)then {arma_s4death = arma_s4death + 1; Publicvariable _kils1;};
if(_killer == s5)then {arma_s5score = arma_s5score + 1; Publicvariable _kils;};
if(_victim == s5)then {arma_s5death = arma_s5death + 1; Publicvariable _kils1;};
if(_killer == s6)then {arma_s6score = arma_s6score + 1; Publicvariable _kils;};
if(_victim == s6)then {arma_s6death = arma_s6death + 1; Publicvariable _kils1;};
if(_killer == s7)then {arma_s7score = arma_s7score + 1; Publicvariable _kils;};
if(_victim == s7)then {arma_s7death = arma_s7death + 1; Publicvariable _kils1;};
if(_killer == s8)then {arma_s8score = arma_s8score + 1; Publicvariable _kils;};
if(_victim == s8)then {arma_s8death = arma_s8death + 1; Publicvariable _kils1;};
if(_killer == s9)then {arma_s9score = arma_s9score + 1; Publicvariable _kils;};
if(_victim == s9)then {arma_s9death = arma_s9death + 1; Publicvariable _kils1;};
if(_killer == s10)then {arma_s10score = arma_s10score + 1; Publicvariable _kils;};
if(_victim == s10)then {arma_s10death = arma_s10death + 1; Publicvariable _kils1;};
if(_killer == s11)then {arma_s11score = arma_s11score + 1; Publicvariable _kils;};
if(_victim == s11)then {arma_s11death = arma_s11death + 1; Publicvariable _kils1;};
if(_killer == s12)then {arma_s12score = arma_s12score + 1; Publicvariable _kils;};
if(_victim == s12)then {arma_s12death = arma_s12death + 1; Publicvariable _kils1;};
if(_killer == s13)then {arma_s13score = arma_s13score + 1; Publicvariable _kils;};
if(_victim == s13)then {arma_s13death = arma_s13death + 1; Publicvariable _kils1;};
if(_killer == s14)then {arma_s14score = arma_s14score + 1; Publicvariable _kils;};
if(_victim == s14)then {arma_s14death = arma_s14death + 1; Publicvariable _kils1;};
if(_killer == s15)then {arma_s15score = arma_s15score + 1; Publicvariable _kils;};
if(_victim == s15)then {arma_s15death = arma_s15death + 1; Publicvariable _kils1;};
if(_killer == s16)then {arma_s16score = arma_s16score + 1; Publicvariable _kils;};
if(_victim == s16)then {arma_s16death = arma_s16death + 1; Publicvariable _kils1;};
if(_killer == s17)then {arma_s17score = arma_s17score + 1; Publicvariable _kils;};
if(_victim == s17)then {arma_s17death = arma_s17death + 1; Publicvariable _kils1;};
if(_killer == s18)then {arma_s18score = arma_s18score + 1; Publicvariable _kils;};
if(_victim == s18)then {arma_s18death = arma_s18death + 1; Publicvariable _kils1;};
if(_killer == s19)then {arma_s19score = arma_s19score + 1; Publicvariable _kils;};
if(_victim == s19)then {arma_s19death = arma_s19death + 1; Publicvariable _kils1;};
if(_killer == s20)then {arma_s20score = arma_s20score + 1; Publicvariable _kils;};
if(_victim == s20)then {arma_s20death = arma_s20death + 1; Publicvariable _kils1;};
if(_killer == s21)then {arma_s21score = arma_s21score + 1; Publicvariable _kils;};
if(_victim == s21)then {arma_s21death = arma_s21death + 1; Publicvariable _kils1;};
if(_killer == s22)then {arma_s22score = arma_s22score + 1; Publicvariable _kils;};
if(_victim == s22)then {arma_s22death = arma_s22death + 1; Publicvariable _kils1;};
if(_killer == s23)then {arma_s23score = arma_s23score + 1; Publicvariable _kils;};
if(_victim == s23)then {arma_s23death = arma_s23death + 1; Publicvariable _kils1;};
if(_killer == s24)then {arma_s24score = arma_s24score + 1; Publicvariable _kils;};
if(_victim == s24)then {arma_s24death = arma_s24death + 1; Publicvariable _kils1;};
if(_killer == s25)then {arma_s25score = arma_s25score + 1; Publicvariable _kils;};
if(_victim == s25)then {arma_s25death = arma_s25death + 1; Publicvariable _kils1;};
if(_killer == s26)then {arma_s26score = arma_s26score + 1; Publicvariable _kils;};
if(_victim == s26)then {arma_s26death = arma_s26death + 1; Publicvariable _kils1;};
if(_killer == s27)then {arma_s27score = arma_s27score + 1; Publicvariable _kils;};
if(_victim == s27)then {arma_s27death = arma_s27death + 1; Publicvariable _kils1;};
if(_killer == s28)then {arma_s28score = arma_s28score + 1; Publicvariable _kils;};
if(_victim == s28)then {arma_s28death = arma_s28death + 1; Publicvariable _kils1;};
//call compile format ["arma_%1score",_killer] = (call compile format ["arma_%1score",_killer]) + 1;
//call compile format ["arma_%1death",_victim] = (call compile format ["arma_%1death",_victim]) + 1;
//{publicVariable _x;} forEach ["_kils","_kils1"];
if(ArmA_debug)then{player globalChat format["DEBUG: playerkilled.sqs Compleated",_GTBody];};
-
What is this line for? Looks like a typo:
_name_victim =
-
T_D helped me and produced this
// Gunship Deathmatch
// By ArMaTeC
//
// Usage: score board system killed
// Edited: 08.06.07 17:40 by ArMaTeC
// Edited: 11.06.07 17:40 by T_D
_GTBody = format [("Game Time: ") + "%1", [ceil(time)] call convertTimeFunctions];
if(ArmA_debug)then{player globalChat format["DEBUG: playerkilled.sqs Started",_GTBody];};
_victim = _this select 0;
_killer = _this select 1;
_victim removeEventHandler ["killed", tx_killed];
_victim removeEventHandler ["dammaged", tx_dammage];
_message ="";
_i ="";
_name_killer = if((isNull _killer))then {"Not found"}else{name _killer};
_name_victim = if((isNull _victim))then {"Not found"}else{name _victim};
if(_killer == _victim) then { _message = format [localize "STR_ISDE",_name_killer];};
if(_killer != _victim) then { _message = format [localize "STR_KILL",_name_killer, _name_victim];};
messagewwdd = formaT [localize "STR_NFLASH",_message];
[1,messagewwdd] call six_fTxRadio;
_updateScore =
{
private "_varName";
_varName = "arma_s"+str(_this)+"score";
call compile (_varName + " = " + _varName + "+1");
publicVariable _varName;
};
_updateDeath =
{
private "_varName";
_varName = "arma_s"+str(_this)+"death";
call compile (_varName + " = " + _varName + "+1");
publicVariable _varName;
};
for "_i" from 1 to 28 do
{
_nmbr = str(_i);
call compile("if(_killer == s" + _nmbr + ")then{" + _nmbr + " call _updateScore}");
call compile("if(_victim == s" + _nmbr + ")then{" + _nmbr + " call _updateDeath}");
};
_pos = GetPos _victim;
_tempObj=["SmokeShellRed",_pos] call six_fCreateVehicle;
sleep 5;
deletevehicle _tempObj;
the problem im havign now is with this script as it returns bool array error. Its to replace
_w1="No Unit Found";
_w2="No Unit Found";
_w3="No Unit Found";
_w4="No Unit Found";
for "_i" from 1 to 28 do
{
_nmbr = str(_i);
call compile("_w" + _nmbr + " = ""No Unit Found"";");
};
hint format["W1 = %1",_w1];
for "_i" from 1 to 28 do
{
_nmbr = str(_i);
call compile("if(alive s" + _nmbr + ")then{_w" + _nmbr + " = format ["%1 : K=%2 D=%3",name s" + _nmbr + ",arma_s" + _nmbr + "score,arma_s" + _nmbr + "death];};");
};
_GDBody = format [("Game Date: ") + "%1",date];
_separator1 = parseText "<br><br />------------------------<br><br />";
_image = "Images\ArmAtec.paa";
_txt = composeText [image _image,"Gunship Leaderboard",image _image,_separator1,parseText _GTBody,_separator1,parseText _GDBody,_separator1,"==========================",_separator1,image _image,parseText _w1,_separator1,image _image,parseText _w2,_separator1,image _image,parseText _w3,_separator1,image _image,parseText _w4,_separator1,image _image,parseText _w5,_separator1,image _image,parseText _w6,_separator1,image _image,parseText _w7,_separator1,image _image,parseText _w8,_separator1,image _image,parseText _w9,_separator1,image _image,parseText _w10,_separator1,image _image,parseText _w11,_separator1,image _image,parseText _w12,_separator1,image _image,parseText _w13,_separator1,image _image,parseText _w14,_separator1,image _image,parseText _w15,_separator1,image _image,parseText _w16,_separator1,image _image,parseText _w17,_separator1,image _image,parseText _w18,_separator1,image _image,parseText _w19,_separator1,image _image,parseText _w20,_separator1,image _image,parseText _w21,_separator1,image _image,parseText _w22,_separator1,image _image,parseText _w23,_separator1,image _image,parseText _w24,_separator1,image _image,parseText _w25,_separator1,image _image,parseText _w26,_separator1,image _image,parseText _w27,_separator1,image _image,parseText _w28];
hint _txt;
playsound "CMBeep";
-
What line generates the error?
-
hint format["W1 = %1",_w1];
and then CTD
-
Does it display the hint before you CTD? If it all happens too fast add sleep 1; just after that hint line. We need to know whether the loop below is what is causing the crash.
edit: change
call compile("if(alive s" + _nmbr + ")then{_w" + _nmbr + " = format ["%1 : K=%2 D=%3",name s" + _nmbr + ",arma_s" + _nmbr + "score,arma_s" + _nmbr + "death];};");to
call compile("if(alive s" + _nmbr + ")then{_w" + _nmbr + " = format [""%1 : K=%2 D=%3"",name s" + _nmbr + ",arma_s" + _nmbr + "score,arma_s" + _nmbr + "death];};");
-
bool error scool array error
-
I just made an edit to my post above while you were posting your reply.
-
thank you that worked sweet