OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mr.BoDean on 17 Oct 2003, 11:12:30
-
Hi All,
I'm not real clear on how this is done, so here goes:
I have a lil' ol' Cycling-WP-simulation script using GameLogics. The chopper will be doing some multiple paradrops so the loop needs to be continuous until a certain number of drops are made ...say 4. Then, I want the heli to go off somewhere and hold in a safe area until at least one of those groups is dead. Then, it should resume its cycle again , dropping another group and going to the safe zone until another group is dead.
I've worked out the holding issues with the paradrop script, but need to figure out a way to communicate its counter Number and group status to the HeliMove script. I set up the variable _Hold = false and tried to insert _Hold = true into the other script, but nothing happened. I don't think I can combine the HeliMove script into the other one . :-\ So how is this done? :P
;;Heli cycling script by Mr.BoDean
_Hold = false
#Moveloop
? _Hold : goto "Holdpat"
Mi17 move getpos helimove1
~15
Mi17 move getpos helimove2
~15
? _Hold : goto "Holdpat"
Mi17 move getpos helimove3
~15
Mi177 move getpos helimove4
~25
goto "Moveloop"
#Holdpat
Mi17 move getpos helimove5
@ !_Hold : goto "Moveloop"
-
The details are beyond my limited scripting powers. However, the principle is not.
Variables starting with an underscore like _this are local to the script in which they are defined. So you can have multiple scripts running at the same time all using the variable _hold and they won't interfere with each other.
However, other variables are global. So if you put
hold=false
in one script then it will be false in any other scripts you have running at the time (or subsequently).
In other words, I suspect if you use hold rather than _hold it will work.
-
Woohoo ... Right on, Macdaddy, that did the trick. Excellent! ;D Thanx,man. I knew it must be something simple. ;)
Now my question is: if I wanted to use this in a MP scenario, am I gonna need to mess with the publicvariable command for this, as well?
I will place a
?!(local server) : exit
at top of script, but hmmm .... :-\ ???
-
snYpir wrote a good tute on handling variables in MP, I think. Beyond my scope anyway.
Glad to be of help. :)
-
snYpir wrote a good tute on handling variables in MP, I think. Beyond my scope anyway.
Glad to be of help. :)
Ya, I've read it a couple times, plus sought help from some client/server gurus, but it's still beyond MY scope of knowledge. :P ;D
-
I have a lil' ol' Cycling-WP-simulation script using GameLogics.
;;Heli cycling script by Mr.BoDean
Mi17 move getpos helimove1
This ties in rather neatly with a gamelogic waypoint system I was working on a while back, but I've never got it to work. But I've been using "domove" rather than simply "move" as you use. Does "move" work better?
-
Mr.BoDean
Greetings!
This is my limited take on MP variable scripting, mostly taken from dissecting other peoples scripts:
There are three types of variables:
"_var1" is script local - it only applies to within the script.
"var2" is machine global - it will apply to all scripts/triggers etc. However, in MP it will only apply to scripts executed on that computer, not over the whole network.
"publicvariable var2" is network global - it makes "var2" into a variable accross the network (i.e. on all computers in that game). So
var2=true; publicvariable var2would set var2 as true accross the whole network.
Now I could be wrong here, so feel free to correct me. ::)
-Supr. Cmdr. PsyWarrior
-Psychic Productions
-
doMove is a command for an individual loon.
move is a command for a group - I think it effectively creates a waypoint at the indicated place.
-
Ah right, cheers.
-
doMove is a command for an individual loon.
move is a command for a group - I think it effectively creates a waypoint at the indicated place.
Ya, I remembered seeing a post about this long ago, but forgot the details. So when I first tried it, I used domove helimove1 but got an error. Using Heliname move getpos helimove1 works fine, though. I also tried using the distance command to detect when the chopper got close to the logic , then move it to the next. But for some reason, it just circled at the first logic WP. So I opted for the time delay between each. Added to a wider placement area of each logic position, the delay works great to randomize the patrol pattern. :)
@PsyWarrior: thanks for clearing that up ... that sounds about right. My fuzzy area still involves what things HAVE to be run on server and HAVE to be run on all ... i.e. when to use publicvariables . :P