OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Zombie on 05 Jul 2003, 18:44:55
-
whenever I use this script, there is a noticeable, and quite annoying pause while the units are created. Is there anyway to fix this?
;create script by -CrashnBurn- dwaters59@msn.com
; modified by zombie
;-----------------------------------------------------------
#start
_units2 = units west2
#loop
?(("Alive _x" count _units2) == 1): goto "create"
goto "loop"
#create
"OfficerW" createunit [getpos g2, west2, "w11 = this"]
"SoldierWG" createunit [getpos g2, west2, "w12 = this"]
"SoldierWLAW" createunit [getpos g2, west2, "w13 = this"]
"SoldierWAA" createunit [getpos g2, west2, "w14 = this"]
"SoldierWMedic" createunit [getpos g2, west2, "w15 = this"]
"SoldierWMG" createunit [getpos g2, west2, "w16 = this"]
exit
I figure by using this, I can cut down on lag by creating units when needed, but the pause everytime this or a similar executes just won't work
-
is g2 a gamelogic? also, does it pause before it creates the dudes, or in the middle somewhere?
edit:
try this
#start
_units2 = units west2
#loop
?(("Alive _x" count _units2) == 1): goto "create"
~0.1
goto "loop"
#create
"OfficerW" createunit [getpos g2, west2, "w11 = this"]
"SoldierWG" createunit [getpos g2, west2, "w12 = this"]
"SoldierWLAW" createunit [getpos g2, west2, "w13 = this"]
"SoldierWAA" createunit [getpos g2, west2, "w14 = this"]
"SoldierWMedic" createunit [getpos g2, west2, "w15 = this"]
"SoldierWMG" createunit [getpos g2, west2, "w16 = this"]
exit
i put a ~0.1 inside the loop cause if u dont, it will slow down yur comp.
-
yes g2 is a gamelogic
it pauses as soon as #create starts, before the units are seen
interestingly enough, I tried this with creating 2 west groups and no matter which one is exec'd first, only the 1st one causes the pause
-
hmmmm thats wierd, i dont see anything that would cause it to pause, unless i keep on skipping some code in the script that will cause it to pause
-
ok, here is the thing I am working on, never mind some of the other stuff going on, I am trying to learn some new techniques! But you will see the pause I am talking about
could it be because it's trying to create those units on top of eachother?
-
no, i dont think thats it... cause u said it pauses as soon as #create starts.
-
OFP alwayz pauses wen u create units - no way 2 evade it (on stronger cpomps it pauses less - nd somtimes its unnoticable wen u creat lil amound of units)
dats cuz it loads new units 2 memory nd starts keepin track of em
LCD OUT
-
argggh, OK, maybe I can hide the pause with a cleverly timed cutscene. Will creating units this way help reduce lag tho? The cpu doesn't have to keep track of the units until they are needed.
-
Will creating units this way help reduce lag tho?
yes it is - all da best big sized misions around wil have da thing - it reduce da lag a lot ;D - check dis TUT (http://www.ofpec.com/editors/resource_view.php?id=512)
LCD OUT
-
I think I found a solution. If I create 1 group that has all the different soldiers I want at mission start, then the createunit script doesn't pause things when I create the other groups. A little strange but it works and I only have a few extra units running around in the beginning. Probably caused by the computer don't have to run the vectors for the units when the are created because the vectors are already loaded at mission start.