Home   Help Search Login Register  

Author Topic: CreateUnit a whole squad  (Read 494 times)

0 Members and 1 Guest are viewing this topic.

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
CreateUnit a whole squad
« on: 24 Feb 2004, 01:15:12 »
The mission I'm planning is to have large numbers of enemy attacking the players position.  Due to the large forces planned, I dont want to create every enemy group in the editor, and then have them slowly attack the players over time.

So I decided that I'd use createunit to create squads of enemy troops, and have them move to the attack.

I made a very simple script that created some units, and attached them to a lone man, who is a group already by himself.

Unfortunately, when my script runs, the whole game slows down to a stutter as it creates 7 units to fill out the group.  This is obviously unacceptable in a mission.  So Im wondering if there is a better way of creating groups, without massive slowdown.

For referance, the script I'm using is;


"BAS_GovernmentSoldier" createUnit [getpos enemystart, enemygroup, "", 0.6, "private"]
"BAS_GovernmentSoldier3" createUnit [getpos enemystart, enemygroup, "", 0.6, "private"]
"BAS_GovernmentSoldier4" createUnit [getpos enemystart, enemygroup, "", 0.6, "private"]
"BAS_GovernmentMGunner" createUnit [getpos enemystart3, enemygroup, "", 0.6, "private"]
"BAS_GovernmentRPGAPSoldier" createUnit [getpos enemystart4, enemygroup, "", 0.6, "private"]
"BAS_GovernmentMedic" createUnit [getpos enemystart, enemygroup, "", 0.6, "private"]
"BAS_GovernmentSoldier" createUnit [getpos enemystart, enemygroup, "", 0.6, "private"]

exit
[/size]
« Last Edit: 24 Feb 2004, 01:15:51 by [icarus_uk] »

Offline Spinor

  • Members
  • *
  • I'm a llama!
    • The chain of command
Re:CreateUnit a whole squad
« Reply #1 on: 24 Feb 2004, 02:32:38 »
IÂ'm not sure but I guess the stutter is caused loading all the models and textures of the different units at the same time. My only advice is to use as few different units as possible and to insert some delays between the spawns, e.g.
Code: [Select]
"BAS_GovernmentSoldier" createUnit [getpos enemystart, enemygroup, "", 0.6, "private"]
~1
"BAS_GovernmentSoldier3" createUnit [getpos enemystart, enemygroup, "", 0.6, "private"]
This will stretch the workload a little.

m21man

  • Guest
Re:CreateUnit a whole squad
« Reply #2 on: 24 Feb 2004, 02:47:19 »
I would suggest not using multiple types of one soldier (You're using soldier, soldier3, and soldier4). Instead, make one type of soldier and change the weapons around :) .

Tubal

  • Guest
Re:CreateUnit a whole squad
« Reply #3 on: 24 Feb 2004, 15:00:42 »
put one of every soldier you need in the ocean so they die at the start of the game, then when you create new soldiers later the game already has them in the memory.