Home   Help Search Login Register  

Author Topic: Advanced but Simple Death match help  (Read 4892 times)

0 Members and 1 Guest are viewing this topic.

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Advanced but Simple Death match help
« 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
« Last Edit: 12 Jun 2007, 19:24:59 by ArMaTeC »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced but Simple Death match score help
« Reply #1 on: 30 May 2007, 17:48:46 »
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?
« Last Edit: 30 May 2007, 18:00:36 by Mr.Peanut »
urp!

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: Advanced but Simple Death match score help
« Reply #2 on: 30 May 2007, 17:56:52 »
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

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced but Simple Death match score help
« Reply #3 on: 30 May 2007, 18:05:03 »
1) The "KILLED" eventhandler should  still behave the same as in OFP. Is the script unchanged from OFP version?
2) Should this line:
Code: [Select]
?!isNull player : _name = name _unit;be
Code: [Select]
?!isNull _unit : _name = name _unit;
« Last Edit: 30 May 2007, 18:14:05 by Mr.Peanut »
urp!

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: Advanced but Simple Death match score help
« Reply #4 on: 30 May 2007, 18:12:51 »
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
Code: [Select]
_person =  name _unit
and the _unit is Null ArmA crashs
« Last Edit: 30 May 2007, 18:16:08 by ArMaTeC »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced but Simple Death match score help
« Reply #5 on: 30 May 2007, 18:14:24 »
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?
urp!

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: Advanced but Simple Death match score help
« Reply #6 on: 30 May 2007, 18:43:03 »
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?

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced but Simple Death match score help
« Reply #7 on: 30 May 2007, 18:47:08 »
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:
Code: [Select]
@alive player
player addEventHandler ......
urp!

Offline ArMaTeC

  • Members
  • *
  • City Life 2
    • armatechsquad.com
Re: Advanced but Simple Death match score help
« Reply #8 on: 30 May 2007, 18:53:12 »
So the bottom should look like this.

Code: [Select]
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"}];

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced but Simple Death match score help
« Reply #9 on: 30 May 2007, 18:55:53 »
Yes
urp!

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced but Simple Death match score help
« Reply #10 on: 30 May 2007, 22:08:25 »
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.
urp!

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Advanced but Simple Death match score help
« Reply #11 on: 30 May 2007, 23:43:11 »
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:

Code: [Select]
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:

Code: [Select]
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. 
« Last Edit: 30 May 2007, 23:45:33 by DucusSumus »

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Advanced but Simple Death match score help
« Reply #12 on: 31 May 2007, 02:05:46 »
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):

Code: [Select]
_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. 

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Advanced but Simple Death match score help
« Reply #13 on: 31 May 2007, 02:49:39 »
What are the variables kils and kils1 supposed to be? 

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Advanced but Simple Death match score help
« Reply #14 on: 31 May 2007, 03:05:21 »
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.