EDIT :
I found that setposing a gamelogic is smoother than using sqrt.
(The difference in frame in these two is about 20fps)
SQRT + array select random count array - 0.5Tested with the laptop,frame drops from 230 fps to 130 at first ten secs.
Then to 15 after the second 10 secs.
GameLogic setposing + array select random count array - 0.5Drops to 150 at first 10 secs.Then to 80.
And remains around 40.And rises up to 50/60 after all scripts were finished.
This will be version 0.8
Changelog (older version's changelog will be posted soon!)
-v0.8
-changed : array selection method.
-changed : position selection method.
-changed : debugging mode
-improved : now you can add unlimited elements to the array
-NEW : array of objects that you can put in the arguments.
-NEW : New Example Mission with objectives.(rescue the pilots lost in the forest and extract.)
Here is the wide explanation of what's new :
NEW ARGUMENT
;************************************
; OBJECTS) -
; NOTE : Nested Array! ( [[insidearray],outsidearray]
; Put your desired collision objects to check with the instance that you are executing
;Usage
; format : [[objects to check],distance]
; Example :
; [other args,[[car1,man1,tent1],20],other args] exec "roc\roc.sqs"
; (again,keep in mind that it's a nested array,don't forget to put '[' and ']' as necessary.
; Suppose the above instance is used to create a dense forest ,
; I.E : Type array includes just trees,bushes,grasses and any forest related objects.
; The created object will be place at least the defined distance (second element of collision distance)
; from the objects put in the objects array.
; which means,you can safely place car1,man1 and tent1 in the dense forest
; without worrying about overlapping.
; Time for a picnic,right?
; Hope ya understand.
; This will be useful to create military bases or camps in dense forests,etc.
;Note
; Type [[],0]
; if you don't want to use it and WANT to set the object's direction.(Which is behind this argument!)
; Example : [other args,[[],0],180] ,direction will be 180.
NEW EXAMPLE MISSION :
You are a lonely BlackOp trasported to Desert Island by a Mark II PBR,with the objectives to rescue two downed pilots who are expected to be captured by resistance forces on Desert Island.
Kill ALL the resistance guys and rescue the pilots.
Mission Credits : haroon1992,Rujik for his birds script,Hostages script found on OFPEC(author name unknown)
(Mission is not that perfect!)
OLD :
No more element limits!!!!
Though you've mentioned an even better idea!
array select random count array - 0.5I'm gonna use that.Done!
Lag is even more reduced in my latest version (which is not yet available,I'll upload it tomorrow,and on the FIRST post
)
How I reduced lag?As the script don't need to call the array_select_random_element.sqf Function each 0.01 times, it is obvious that lag will be reduced.
And as you've said, i just create One logic and setposed it.
Now,almost no lag occurs...but I am going to use the NEW array method and NEW distance method to minimize the lag! Done!
Thank You very much for your invaluable efforts.
And if you are willing to help me more, please explain me the maths required to use the destribution method
(as i mentioned.User defines his desired elements,and the script calculate the distribution of the rest)
Regards,
haroon1992