Home   Help Search Login Register  

Author Topic: Plzzzzzzzzz help with creating limited groups!!  (Read 2760 times)

0 Members and 1 Guest are viewing this topic.

CptBravo

  • Guest
Plzzzzzzzzz help with creating limited groups!!
« on: 05 Jan 2003, 02:39:48 »
Hi everyone,

I checked for scripts for creating(respawning) groups and they work perfectly except for ..

I need one with:
a) a limited number of respawns (say will respawn only 5 times)
and
b)leave the dead bodies on the field instead of deleting them!

Now I know I could take those scripts and modify them, if I was a script guru that is which I am NOT!!!

So please any script gurus shed some light on how to limit number of respawns and leave the dead on the ground!!

Your help is greatly appreciated!! :)

CrashnBurn

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #1 on: 05 Jan 2003, 11:04:05 »
try this script instead. You can use this single script to create soldiers for different groupnames and call it with triggers as many or as few times as you want. It won't delete dead bodies either. If you want it to run 5 times, simply trigger it 5 times.

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #2 on: 06 Jan 2003, 03:35:39 »
Hi Crash,

At the risk of sounding not so bright, I had little sucess! lol

I did as you said but it kept me giving error msg "0 elements prodided 3 expected"

I am sure its something very stupid I have left out I just can't think what it is!

I have attached the mission if you should have time to look at it and tell me where I have gone I'd be super appreciative.

Thanks in advance :)

CrashnBurn

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #3 on: 07 Jan 2003, 06:59:53 »
You gave the gamelogic a name gamelogic1, but in the trigger, you used the name logic1. It has to be the same. Also, you used an editor update I dont have so I just opened the sqm file with wordpad to find your error. You need to inform me of addons you are using so I can help you without getting errors when I try to open your mission. NP, easily solved...cheers.

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #4 on: 07 Jan 2003, 09:05:04 »
hey Crash,

I feel like a fool!  lol
It worked fine after I fixed my name mistake!

The only thing I need to ask iswhat is the best way to set the triggers ?
- Should I use 5 different logic names? use same one?
- Any simple way of say group 2 respawning ONLY after group one is all dead? As you see in the mission they respawned almost same time as 1.

I have included the mission this time with no addons.

Thank you very much for your help. I am in your debt :)

CrashnBurn

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #5 on: 07 Jan 2003, 14:48:53 »
It depends on what you're trying to accomplish. I need to know more about the mission in order to figure the best way to set things up. You can create the same group over 5 times and forget the other groups if you want. Let me know what you have in mind.

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #6 on: 07 Jan 2003, 18:02:52 »
Hey Crash,

what I am attempting to do with this script is reduce the lag. I wanted to have the west side defend a city against a huge attacking force of approx 500 men. As you can imagin the lag without using an AI respawn script.

The enemy will attack in waves. Say 5 groups a time.and when a group gets killed they are replaced with a new group and when the new group gets killed they get replaced with another one till all men are used.

The other quick question was, I saw how you added the group in the script. Now how do you add another group so you can have 2 different groups respawning Say AT group and infantry one? Do you use two seperate scripts for each group?

Thank you very much for you help.

Offline uiox

  • Contributing Member
  • **
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #7 on: 07 Jan 2003, 20:22:04 »
I use this script for respawn AI ennemy units.

Code: [Select]
;[[E1,E2,E3,E4],100,2,10] exec "Respawn\RespawnUnits.sqs"
; [[array of your groups to respawn], number of total respawn, number mini of the group for start respawn, max number of the squad]

_ArrayGroup = _This select 0
? count _ArrayGroup  ==0 : exit

_MaxOfRespawn = _This select 1
? _MaxOfRespawn == 0 : exit

_MiniNumberForRespawn = _This select 2
?_MiniNumberForRespawn > 12 : exit

_SquadDimension = _This select 3
? ((_SquadDimension > 12) or (_SquadDimension == 0)) : exit

_CurrentNumberOfRespawn = 0

#LoopOfRespawn

_i =0
#Ingroup
~.2
_NumberOfCreate = 1
      #RespawnUnit
      ? count units ( _ArrayGroup select _i)  >= _SquadDimension : goto "SkipRespawn"
      _pos = getPos leader ( _ArrayGroup select _i)
      _dir = getDir  leader ( _ArrayGroup select _i)
      ~.5
      _dist = -30
      _x = (_pos select 0) + _dist * sin _dir
      _y = (_pos select 1) + _dist * cos _dir
;nobody globalchat format ["%1, %2,%3",_CurrentNumberOfRespawn,_ArrayGroup select _i, count units ( _ArrayGroup select _i) ]
      ? _NumberOfCreate ==1 : "SoldierEMG" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"]
      ? _NumberOfCreate ==2 : "SoldierELAW" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"]
      ? _NumberOfCreate ==3 : "SoldierEMedic" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"]
      ? _NumberOfCreate ==4 : "SoldierEG" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"]
      ? _NumberOfCreate > 4 : "SoldierEB" createUnit [[_x,_y ], _ArrayGroup select _i,"NouvelleUnité = this"]
      NouvelleUnité addEventHandler ["Killed", "[_this select 0] exec ""Respawn\RemoveKill.sqs"""]
      _CurrentNumberOfRespawn = _CurrentNumberOfRespawn +1

      ? _CurrentNumberOfRespawn >_MaxOfRespawn : exit
      _NumberOfCreate = _NumberOfCreate +1

      ? count units ( _ArrayGroup select _i) < _SquadDimension : goto "RespawnUnit"
      #SkipRespawn
      _i = _i + 1
      ? _i < count _ArrayGroup : goto "Ingroup"

? _CurrentNumberOfRespawn <_MaxOfRespawn : goto "LoopOfRespawn"

CrashnBurn

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #8 on: 07 Jan 2003, 21:20:51 »
I don't think you can do that many units without deleting dead bodies. If the attacking force is going to be 500, then the defending force will have to be a very large number also. After a hundred dead units are littering the city, lag is going to grind the mission to a halt. Regardless of how you setup the creation of the units, you're going to have to delete dead bodies. Maybe you should use something like my original tutorial, and just set the mission to run a certain length of time ?

Offline uiox

  • Contributing Member
  • **
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #9 on: 08 Jan 2003, 15:14:56 »

 NouvelleUnité addEventHandler ["Killed", "[_this select 0] exec ""RemoveKill.sqs"""]

Script removeKill.sqs

_Remove = _this select 0

_Remove removeAllEventHandlers "Killed"
@ RemoveKill
deleteVehicle _Remove

For the global variable removeKill you can manage with time or number of unit

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #10 on: 08 Jan 2003, 17:47:58 »
Hey Crash,

You're  right! The game does start laaaaaging after 200-300 dead units depending on size of map. So I guess I'll have to use the delete.

Two questions regading delete:
a) Can I use the delete with the limited respawn I have now. For example like the script I have now, respawn the squad once but have them deleted when dead.
b) Can you use it, say with 200 units? Have two scripts, the one without the delete for the 1st 200 then the delete one for over 200?
c) finally, how do you respawn different groups? Such as AT squad, infantry or AA squad?

Thank you for your great help.

Hi uiox, I didn't get a chance to test your script. I'll do it tonight.
Thank you very much.


CrashnBurn

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #11 on: 09 Jan 2003, 00:45:35 »
Here's a couple different scripts that create different groups and deletes the bodies when all are dead. Call the scripts same as before using [gamelogicname, groupname] exec "scriptname.sqs". Try these and let me know if you need anything else.

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #12 on: 12 Jan 2003, 22:58:44 »
Hey Crash,

I have got it!! :)
I have finsihed my mission and it works PERFECTLY!!
I have used both of your scripts, the one without delete at first for the first 100 units or so for realism then I switched to the one with the delete to reduce lag. So now I have my huge battle with enough dead bodies, lots of soldiers and fire power to put to shame all of the Rambo movies!! :)

So thank you for your help!

Just a quick question, is there any way to umm .. make the enemy soldiers less skilled? It seems the one respawned are too good at taking me out from 400-500 meters distance!!

In the editor you usually can play with the skill slider. Is there any line to add to the script to control how good of a shot the enemy will be?

Again thanks!


« Last Edit: 12 Jan 2003, 23:03:53 by CptBravo »

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #13 on: 12 Jan 2003, 23:01:27 »
Hey uiox,

Your script seems impressive but honestly as you can tell, I am no scripting guru :(

I have tried to use it but was not sure how or what is does exactly.

Maybe an example mission might good :)

Thanks.

Offline Ottie

  • Members
  • *
  • And you think this is personal
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #14 on: 13 Jan 2003, 10:27:43 »
When you are creating a unit with the createUnit command you can set the initial skill of the unit, so you can create units with lesser skills
If you can't beat them, buy them