Home   Help Search Login Register  

Author Topic: Counter-Lag Force needs assistance!  (Read 914 times)

0 Members and 1 Guest are viewing this topic.

Offline Viking

  • Members
  • *
  • NORSOF
Counter-Lag Force needs assistance!
« on: 03 Mar 2004, 23:38:24 »
Hya peeps! :D

I was wondering if y'all (or some of you) could help me out with a little issue of mine:

I'm working on a Tonal/Black Hawk Down/CSAR/Defend The Chopper mission and I have this excellent respawn script. the only problem about it is that the bodies don't get deleted and, alas, lag... :(

Could you tell me what and where to put a wee thingy into my script that'll delete the bodies after, say, 10 seconds (they don't even have to dissapear after some seconds, s'long as they dissapear ;))

My script:

Quote


_aUnit = _this select 0
_agroups = _this select 1
_apg = _this select 2
_utype = _this select 3
_askill = _this select 4
_aradius = _this select 5


_c = 0
#loop
   #gloop
      _rg = count units (_agroups select _c)
      ? _rg >= _apg : goto "misscreate"
      _rg = _apg - _rg
      #iloop
         _rnum = random ((_aradius * 2))
         _num = _rnum - (_rnum mod 1)
         _num = _num - _aradius
         _d1 = getpos _aunit select 0
         _d2 = getpos _aunit select 1
         _d3 = 0
         _qs = (_aradius * _aradius) - (_num * _num)
         _qs = sqrt _qs
         _num2 = random (2)
         _num2 = _num2 - (_num2 mod 1)
         ? _num2 == 0 : _qs = _qs - (2 * _qs)
         _num2 = random (2)
         _num2 = _num2 - (_num2 mod 1)


         ? _num2 == 0 : _d1 = _d1 + _num; _d2 = _d2 + _qs
         ? _num2 == 1 : _d1 = _d1 + _qs; _d2 = _d2 + _num
         _utype createunit [[_d1,_d2,_d3],_agroups select _c,"",_askill,"PRIVATE"]
         _agroups select _c move getpos _aunit
         leader (_agroups select _c) move getpos _aunit
         _rg = _rg - 1
         ? _rg == 0 : goto "misscreate"
      goto "iloop"
      #misscreate
      _c = _c + 1
      ? _c == count _agroups : _c = 0; goto "eloop"
   goto "gloop"
   #eloop
   ~5
goto "loop"




Hope ya can help!

Cheers,
Viking

PS: Yes, I did search for this topic and NO i didn't find it anywhere ;)
Also I know of the Lag-Eliminator Script, but I can't get it to fit into my script working... And besides, deletes all bodies.... I only wan't to delete the bodies of the side that is respawned.
« Last Edit: 04 Mar 2004, 00:01:24 by Viking »
VIKING
Modeller/Skinner/Coder
NORFOR

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Counter-Lag Force needs assistance!
« Reply #1 on: 04 Mar 2004, 01:26:32 »
uhm...all i can give is some idea...but i dunno a lot about but maybe you can figure it out yourself.

It has something to do with the Eventhandler "killed" which you can make call a simple deletedeadbody script.

This should go in every units init field which you want to be deleted after it's dead.

I'm sry i couldn't give you a detailed "how to" but maybe this gives you some ideas to work it out on your own  ;D

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Counter-Lag Force needs assistance!
« Reply #2 on: 04 Mar 2004, 02:18:13 »
You can modify the delete bodies script so that only those from the spawning side are deleted.  I do not remember the exact syntax, but there is a command that will check if east or west, or resistance.  Or, you could make all the spawned soldies go into an array (using the array set [_x,name] command.  Then when a soldier dies, use the event hander "killed" to then check if the soldier is in that array group and if he is then he is deleted.

m21man

  • Guest
Re:Counter-Lag Force needs assistance!
« Reply #3 on: 04 Mar 2004, 03:02:38 »
First, make a script called "killdelete.sqs". In it put:
Code: [Select]
_guy = _this select 0
~40
deletevehicle _guy

Now your primary script should be changed to this:
Code: [Select]
_aUnit = _this select 0
_agroups = _this select 1
_apg = _this select 2
_utype = _this select 3
_askill = _this select 4
_aradius = _this select 5


_c = 0
#loop
   #gloop
      _rg = count units (_agroups select _c)
      ? _rg >= _apg : goto "misscreate"
      _rg = _apg - _rg
      #iloop
         _rnum = random ((_aradius * 2))
         _num = _rnum - (_rnum mod 1)
         _num = _num - _aradius
         _d1 = getpos _aunit select 0
         _d2 = getpos _aunit select 1
         _d3 = 0
         _qs = (_aradius * _aradius) - (_num * _num)
         _qs = sqrt _qs
         _num2 = random (2)
         _num2 = _num2 - (_num2 mod 1)
         ? _num2 == 0 : _qs = _qs - (2 * _qs)
         _num2 = random (2)
         _num2 = _num2 - (_num2 mod 1)


         ? _num2 == 0 : _d1 = _d1 + _num; _d2 = _d2 + _qs
         ? _num2 == 1 : _d1 = _d1 + _qs; _d2 = _d2 + _num
         _utype createunit [_d1,_d2,_d3],_agroups select _c,"",_askill,"PRIVATE"]
         _agroups select _c move getpos _aunit
         "_x addeventhandler [{killed},{this exec {killdelete.sqs}}]" foreach units _agroup select _c
         leader (_agroups select _c) move getpos _aunit
         _rg = _rg - 1
         ? _rg == 0 : goto "misscreate"
      goto "iloop"
      #misscreate
      _c = _c + 1
      ? _c == count _agroups : _c = 0; goto "eloop"
   goto "gloop"
   #eloop
   ~5
goto "loop"

Offline Viking

  • Members
  • *
  • NORSOF
Re:Counter-Lag Force needs assistance!
« Reply #4 on: 04 Mar 2004, 11:26:38 »
Thanks, mate!
I'll check it out and get back to ya ;)
VIKING
Modeller/Skinner/Coder
NORFOR

Offline Viking

  • Members
  • *
  • NORSOF
Re:Counter-Lag Force needs assistance!
« Reply #5 on: 04 Mar 2004, 12:11:26 »
Hey again!
I just get this error:

"Error Units: Type Array, Expected Object,Group"

(there might be more after this, cus I ain't playing on a widescreen)

And also get the additional marker-things in the command here:

"foreach units _agroup select|#| _c'"

(the |#| and the extra ' between the _c and the ")

Hope it makes sense!
« Last Edit: 04 Mar 2004, 13:44:15 by Viking »
VIKING
Modeller/Skinner/Coder
NORFOR

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Counter-Lag Force needs assistance!
« Reply #6 on: 04 Mar 2004, 16:30:29 »
There's a typo in that '..forEach _agroup select _c'...
I think it should be _agroups...
At least it's called that in every other occation in the script...

« Last Edit: 04 Mar 2004, 16:30:58 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Viking

  • Members
  • *
  • NORSOF
Re:Counter-Lag Force needs assistance!
« Reply #7 on: 04 Mar 2004, 17:29:05 »
Thanks for the heads up, HateR_Kint.

But i still get exactly the same error :-\ ???
VIKING
Modeller/Skinner/Coder
NORFOR

m21man

  • Guest
Re:Counter-Lag Force needs assistance!
« Reply #8 on: 04 Mar 2004, 23:00:24 »
Maybe a problem with the quotes? Try switching my added line to this:
Code: [Select]
"_x addeventhandler [{killed},{this exec {killdelete.sqs}}]" foreach units (_agroup select _c)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Counter-Lag Force needs assistance!
« Reply #9 on: 04 Mar 2004, 23:12:24 »
Maybe a problem with the quotes? Try switching my added line to this:
Code: [Select]
"_x addeventhandler [{killed},{this exec {killdelete.sqs}}]" foreach units (_agroup select _c)
Could be...

Maybe it's the {this exec....}... Shouldn't it be {_this exec...}
And you can also try {_x addEventHandler ["killed",{_this exec "killdelete.sqs"}]} forEach...
There might be some execution order probs with {} and "" used simultaneously  ???
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Viking

  • Members
  • *
  • NORSOF
Re:Counter-Lag Force needs assistance!
« Reply #10 on: 04 Mar 2004, 23:17:20 »
@Both of you guys

Didn't work... Now i got an error with the line (the same one for both your suggestions):

Quote
_utype createunit [_d1,_d2,_d3]|#|,_agroups select _c,"",_askill,"PRIVATE"]': Error Type number, expected String

Sorry this is taking so much of your time :-\
« Last Edit: 04 Mar 2004, 23:18:41 by Viking »
VIKING
Modeller/Skinner/Coder
NORFOR

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Counter-Lag Force needs assistance!
« Reply #11 on: 05 Mar 2004, 16:11:26 »
Code: [Select]
_utype createunit [[_d1,_d2,_d3],_agroups select _c,"",_askill,"PRIVATE"];

The first [ was missing i think.
« Last Edit: 05 Mar 2004, 16:11:54 by DrStrangelove »

Offline Viking

  • Members
  • *
  • NORSOF
Re:Counter-Lag Force needs assistance!
« Reply #12 on: 05 Mar 2004, 18:33:55 »
OK, by combining all of your suggestions THE MAIN SCRIPT worked!(the enemies spawned just like they should) ;D using this script:

Quote
_aUnit = _this select 0
_agroups = _this select 1
_apg = _this select 2
_utype = _this select 3
_askill = _this select 4
_aradius = _this select 5


_c = 0
#loop
  #gloop
      _rg = count units (_agroups select _c)
      ? _rg >= _apg : goto "misscreate"
      _rg = _apg - _rg
      #iloop
        _rnum = random ((_aradius * 2))
        _num = _rnum - (_rnum mod 1)
        _num = _num - _aradius
        _d1 = getpos _aunit select 0
        _d2 = getpos _aunit select 1
        _d3 = 0
        _qs = (_aradius * _aradius) - (_num * _num)
        _qs = sqrt _qs
        _num2 = random (2)
        _num2 = _num2 - (_num2 mod 1)
        ? _num2 == 0 : _qs = _qs - (2 * _qs)
        _num2 = random (2)
        _num2 = _num2 - (_num2 mod 1)


        ? _num2 == 0 : _d1 = _d1 + _num; _d2 = _d2 + _qs
        ? _num2 == 1 : _d1 = _d1 + _qs; _d2 = _d2 + _num
        _utype createunit [[_d1,_d2,_d3],_agroups select _c,"",_askill,"PRIVATE"];
        _agroups select _c move getpos _aunit
        "_x addeventhandler [{killed},{this exec {killdelete.sqs}}]" foreach units (_agroups select _c)
        leader (_agroups select _c) move getpos _aunit
        _rg = _rg - 1
        ? _rg == 0 : goto "misscreate"
      goto "iloop"
      #misscreate
      _c = _c + 1
      ? _c == count _agroups : _c = 0; goto "eloop"
  goto "gloop"
  #eloop
  ~5
goto "loop"

BUT!

I now get this (which is to do with M21mans "killdelete.sqs") when I kill an enemy soldier:

"_guy = _this select 0|#|': Error select: Type Bool, expected Array"
VIKING
Modeller/Skinner/Coder
NORFOR

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Counter-Lag Force needs assistance!
« Reply #13 on: 05 Mar 2004, 18:46:26 »
Try modifying the main script again :D like this:

"_x addeventhandler [{killed},{_this exec {killdelete.sqs}}]" foreach units (_agroups select _c)

The problem is that u need the _this when executing the eventHandler or the '_this select 0' in the killdelete does not return the needed info... (afaik)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Viking

  • Members
  • *
  • NORSOF
Re:Counter-Lag Force needs assistance!
« Reply #14 on: 05 Mar 2004, 19:07:42 »
SUCCESS!!! (or however it is spelt)

I would like to thank you very talented gentlemen for helping me out!

Also, thanks to angusjm who made the script!

Solved!
VIKING
Modeller/Skinner/Coder
NORFOR