Home   Help Search Login Register  

Author Topic: Plzzzzzzzzz help with creating limited groups!!  (Read 3162 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

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #15 on: 15 Jan 2003, 11:29:32 »
Hi,

The question I had was how to set the initial skill of the unit in the first place? What line do I need to add to the script to change the skill level?

Thanks


chills

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #16 on: 15 Jan 2003, 12:46:04 »
How can you make it to make the group respawn after the group is eliminated?
Ottie change the number from 1 in the script to .1 . That makes them less experienced.
« Last Edit: 15 Jan 2003, 12:48:39 by chills »

Offline Ottie

  • Members
  • *
  • And you think this is personal
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #17 on: 15 Jan 2003, 13:46:32 »
CptBravo, and Chills

I don't know which script you are using but  I changed the following script;

It has lesser skills and respawn when al units have died

_pos = _this select 0
_grp = _this select 1

#Begin
"OfficerE" createunit [getpos _pos,_grp,"",0.5,"LIEUTENANT"]
"SoldierEMG" createunit [getpos _pos,_grp,"",0.5,"SERGEANT"]
"SoldierEG" createunit [getpos _pos,_grp,"",0.5,"CORPORAL"]
"SoldierEB" createunit [getpos _pos,_grp,"",0.5,"CORPORAL"]
"SoldierEB" createunit [getpos _pos,_grp,"",0.5,"PRIVATE"]
"SoldierEMedic" createunit [getpos _pos,_grp,"",0.5,"PRIVATE"]
~1
_units = units _grp
_grp setformation "LINE"
"_x allowfleeing 0" foreach _units

#loop
?(("Alive _x" count _units) == 0): "deletevehicle _x" foreach _units; goto "Begin"
~random(10) + 10
goto "loop"
If you can't beat them, buy them

Offline uiox

  • Contributing Member
  • **
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #18 on: 15 Jan 2003, 15:51:21 »
Quote
How can you make it to make the group respawn after the group is eliminated?

If you respawning units of a group and avoid complete destruction use Ottie's scripts before the complete destruction.




CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #19 on: 15 Jan 2003, 22:27:32 »
Thanks Ottie! That is exactly what I was looking for. I always wonderd what that '1" stood for!! :)

Hey Chills, I'm using CrashnBurn respawn script.Great script for keeping the enemy coming for more!! :)

You can download it from this site. If you can't find it let me know and I'll attach it.

Thanks  

chills

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #20 on: 15 Jan 2003, 23:46:30 »
I cant seem to find it. Do you get the lag when they respawn? And did you notice in multiplayer that after a while it stops respawning?

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #21 on: 16 Jan 2003, 00:07:58 »
here you go, the CrashnBurn script to respawn AI and delete them after death.

I have not had any lag with this script and I respawned over 400 enemy units in my mission! And that was a MP mission and it seemed to work as it is supposed to.

Thanks

chills

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #22 on: 16 Jan 2003, 00:46:15 »
Thank you! This is great! Is there a script like this for Vehicles? I need it for my Dynamic Battles!

CptBravo

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #23 on: 16 Jan 2003, 03:26:18 »
I think you can use the same script for vehicles. Just change the soldiers with whatever unit you need. I have not tried it but I think it would work.

CrashnBurn

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #24 on: 16 Jan 2003, 04:49:26 »
You can call the scripts without using gamelogics as a spawn position if you want. Just use the trigger that you are calling the script with by giving it a name in its name box, and use that as the position for spawning the units. Remember the centermost point of the trigger is where the units will spawn so place the trigger carefully. It just lets you skip having to place gamelogics around the map. The less things you place in the editor, the quicker the mission loads. example-

[triggername, groupname] exec "create.sqs"

You can use a script like this for vehicles and create new ones when they can no longer fire or move depending on what kind of vehicle it is.

example- assumes group name is east1, and triggername is used as spawn location.

[trigger1, east1] exec "createvehicle.sqs"

;-----------------------------------------------------------------------
#start

_pos = _this select 0
_grp = _this select 1

_crew = units _grp
"_x allowfleeing 0" foreach _crew

#loop

?(("Alive _x" count _crew) < 3): goto "create"
? NOT(canfire _tank): goto "create"
? NOT(canmove _tank): goto "create"
~random(5)
goto "loop"

#create

? NOT(alive player): exit
_tank setdammage 1
~1
"deletevehicle _x" foreach _crew
;wait 75 seconds for smoke to stop
~75
deletevehicle  _tank
~random(10)
_tank = "T80" createvehicle getpos _pos
~1
"SoldierECrew" createunit [getpos _pos, _grp, "c1 = this", 1, "SERGEANT"]
"SoldierECrew" createunit [getpos _pos, _grp, "c2 = this", 1, "CORPORAL"]
"SoldierECrew" createunit [getpos _pos, _grp, "c3 = this", 1, "PRIVATE"]
~1
c1 moveincommander _tank
c2 moveingunner _tank
c3 moveindriver _tank
goto "start"

;-----------------------------------------------------------------------

chills

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #25 on: 16 Jan 2003, 09:27:26 »
Thank you! Im off to try it!

chills

  • Guest
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #26 on: 17 Jan 2003, 07:24:55 »
It works! Great one!
« Last Edit: 17 Jan 2003, 07:34:05 by chills »

Offline uiox

  • Contributing Member
  • **
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #27 on: 17 Jan 2003, 14:07:03 »
A tip for really creates new groupS.

If a group is destroy you need a predefined group for creates it.
Something like that :

"logic" createUnit [ PosUwant ,PreCreateGroup ,"NewUnit = this"]

After U join NewUnit to a group null

[NewUnit] join grpNull

And create a new group

_NewGroup = group NewUnit

After You can do that for build the new group

"logic" createUnit [ PosUwant ,_NewGroup  ,"NewUnit = this"]


Note: I'm working on scripts for "restart" system:
Part 1 : infantry
Transition : delete infantry, create armored
Part 2 : armored

With this I can design a mini campaign in a mission.
« Last Edit: 17 Jan 2003, 14:16:29 by uiox »

Offline Ottie

  • Members
  • *
  • And you think this is personal
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #28 on: 17 Jan 2003, 14:21:56 »
uiox,

maybe this is a better solution, (I haven't tried it)

"logic" createUnit [ PosUwant , grpNull ,"NewUnit = this"]
If you can't beat them, buy them

Offline uiox

  • Contributing Member
  • **
Re:Plzzzzzzzzz help with creating limited groups!!
« Reply #29 on: 17 Jan 2003, 17:57:16 »
Not work, I have test different solutions during 4 hours. It's one of the first I have try.
But sometime you don't do the good sequence.
It's hard to test cause OFP when you are wrong it does nothing (no error ans no unit creates).
Maybe a solution with grpnull...
« Last Edit: 17 Jan 2003, 18:02:43 by uiox »