I'm so glad this forum was made a sticky, albiet a temporary. Tyring to find this info over last 2 years has been a nightmare! Try not knowing this stuff when making a CTI...without 2 computers to trial it on!!
e.g. 1) make script
2) replicate as needed
3) found out command has MP issues
4) edit all 10 scripts to source out to a script that is only executed on server/client
Nice work on getting this topic started and maintained General Barron! Now if we can convince someone to make the tutorial or even better get HAMMY to include this info in his executable Command Reference 1.91 that would be great.
----------------------
I've taught myself OFP scripting from the ground-up (i.e. I know no other programming type language
what better way to learn than OFP) and I've been making a CTI for the last 2 years based on the MFCTI core.
CTI maps use a lot of arrays, so my question is:
How are arrays effected by locality in a MP setting with a dedicated server?e.g.
If I have an array defined at the start of a map in a script run on all machines (for CTI scripters this would be "Main\initserver.sqs") but I dynamically edit (contents not size for now) that array with different objects and sub-arrays, how is this handled in a MP setting?
1) global script = defines array
2) local to player script edits array = array contents edited/updated on all computers?
3) local to server script edits array = array edited/updated on all computers?
Now I've learnt the difference between variables, arrays, functions, commands, scripts etc. through various sources but here's the problem I have:
1) 'arrays' can hold 'objects' which can be defined as a 'variable'
e.g. Var1 = vehicle1;subArray = [Var1];mainArray = [subArray]
i.e. mainArray = [[vehicle1]]
2) Now if Var1 changes to vehicle2 via a local to player script, does the contents of Array1 change?
e.g. local: Var1 = vehicle2
server: subArray = [Var1]
mainArray = [[?]]
I know it might seem off-topic in relation to the thread, but in relation to the 'PublicVariable' command, does this have to be done OR can be used (sorry for my lack of understanding in this department) with arrays?
Therefore, is it better to use arrays with multiple contents or mutliple variables that are broadcasted via the 'PublicVariable' command?
I'm of the mind that the former is better than the latter as I've read somewhere that arrays hold the information better whereas using variables can be erroneous in a MP setting?
---------------
Sorry if this is off-topic, but it was in a way in relation to the 'PublicVariable' command so it seemed fitting. Feel free to move this as a serperate topic.