Home   Help Search Login Register  

Author Topic: Createunit Trouble  (Read 2017 times)

0 Members and 1 Guest are viewing this topic.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Createunit Trouble
« Reply #15 on: 17 Apr 2003, 15:53:34 »
It's been a while since last post but I wanted to tell you guys that I got the problem sorted.. both of them.

here's a fraction of my script now.
Code: [Select]
~0.5
   ?(local server): "SoldierEMG" createunit [getmarkerpos "vernon2", vernongrp2, "e9 = this"]
~0.5
   ?(local server): "SoldierEMedic" createunit [getmarkerpos "vernon2", vernongrp2, "e10 = this"]

      [vernonofficer2] join grpnull
~2

   ?(local server): etank2 = "bmp" createVehicle getmarkerpos "vernon2"
~1
   ?(local server): "SoldierECrew" createunit [getmarkerpos "vernon2", vernongrp2, "et4 = this"]

   ?(local server): "SoldierECrew" createunit [getmarkerpos "vernon2", vernongrp2, "et5 = this"]

   ?(local server): "SoldierECrew" createunit [getmarkerpos "vernon2", vernongrp2, "et6 = this"]

et4 moveincommander etank2
et5 moveingunner etank2

the ?(local server) in front of every command makes sure that that particular command is executed only on the server.  server is just a gamelogic, as gamelogics are always local on the server machine.

If no-one has anything to add to this I'll hit the solve button in a day or two.
Not all is lost.

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Createunit Trouble
« Reply #16 on: 17 Apr 2003, 16:30:24 »
How about your lag ? If i remember correctly the game loads textures & stuff into memory when a special unit is created the first time.

So spawning 3 tanks of same type should only lag when the 1st tank is created and almost no lag for the other 2 spawns. Did you recognize this ?

If so, it helps to place the units you'll need for all spawns in the editor somewhere and then delete them with a script or with deletevehicle in the init string. When the mission is started everything is loaded into memory at once, so no spawns will cause any lag because the units are already in memory.

comments / ideas ?

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Createunit Trouble
« Reply #17 on: 17 Apr 2003, 21:17:34 »
 :o omg is that what it is?!  :D

I have noticed the lag caused by the create commands, but I really hadn't gotten my finger on it.

I'm creating about 15 tanks and 100 soldiers in my mission with a script. They are pretty much the same types after the first few have been spawned. So after that it won't cause that annoying lag that it does when spawning the first ones.
I used a short time delay to 'smoothen' the lag. If I created 10 units I would put a short delay between all commands.

Now I know how to get rid of the bugger.

Great little tip DrStrangelove. Thanks  ;) :thumbsup:
Not all is lost.

asmodeus

  • Guest
Re:Createunit Trouble
« Reply #18 on: 18 Apr 2003, 00:59:00 »
Cool!   8)

Thanks!  This is very cool info to have!

Thanks Artak for posting your solution and thanks DrStrangeLove for that tip!

*Goes off to fix his mission using createunit tricks*

 8)

Asmo