OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: McHale on 19 Jan 2003, 00:11:57
-
Is it possible? I want to make a spotter for a machine gun nest. Also, would it be possible to force the guy to use binocular? Please help. :-*
-
I found out how to make AI do binoculars, but getting them to scan horizon eludes me :(
Surely one of you freaking geniuses know how to do it? : ???
-
aP DoWatch "Everyone"?
hehehe
You could make a script, now that I think about it...
Make 4 game logics, named "North1", "South1", "East1", and "West1"
Then...in your script, make a loop...
#loop
<nameofunit> DoWatch (getpos North1)
~10
<nameofunit> DoWatch (getpos East1)
~10
<nameofunit> DoWatch (getpos South1)
~10
<nameofunit> DoWatch (getpos West1)
? (StopWatchin) : exit
goto "loop"
This will make your unit spin about in the space of 40 seconds. Combine this with your binocular command, and he'll scan the horizon in a clockwise manner. Alternatively, if you wanted to just have him watch a certain "cone" of the horizon, just make two game logics and place them where the edge of the cone lies. He'll look between the two points, going back and forth. Try messing around with the delay I put there ("~10") until it suits your needs.
Also, I put that IF statement there at the bottom of the script so if you wanted him to stop looking around (such as when he sees an enemy), just set StopWatchin to true.
-
I found an easier way:
heading = random 360;
soldier_guy setFormDir heading;
Just need to put that on a trigger that cycles every 5 seconds. Thanks.
-
I found out how to make AI do binoculars, but getting them to scan horizon eludes me :(
Heh well finding out how to make AI do binoculars eludes me, so do you think you could help me out?
Surely one of you freaking geniuses know how to do it? : ???
-
Would someone like to post here an *.sqm script so everyone knows how you guys did this. As a newbie I have had difficulty working it out the way it was explained here. Would appreciate any help on this. thanks
-
General Goober, just keep working your way through the Ed Depot tutorials in Getting Started and References :) If you see a command you don't understand, look it up in both the official and unofficial command references. If you haven't already done it, you must read snYpir's excellent "OFPEC Guide: Mission Editing" and follow the advice it contains. ;)
-
Thanks for that I spent a great deal of time today going through everything I could get my hands on. Script I found sorted everything out for me.
-
McHale,
how do you get those binos to work? If you also now know how to constantly cycle scanning the horizon. I would also appreciate it. thanks
-
teeBore: yeah I figured it out myself after I asked the question
I don't think the binoculars increase the AI's line of sight, so there's no point working out how to script it. Although you'd use "playmode"? if that helps.
Anyway the SQS file should go like this:
#start
nameOfGuy setFormDir random 360;
~6
goto "start"
Save that as an SQS file(in the mission's folder). and put the following string into the initialization field of one of your objects in the editor
[]exec "nameOfFile.sqs"
Thats how i did it anyway
-
Without looking at this yet. Does the unit keep looking through the binos. I only seem to get him to look once and put them away.
For example, I used at waypoints. (only way I could get it to work)
man1 switchmove "binoctocombat"
others I used were "standtobinocstand"
Can you put some time limit on it?
-
teeBore: yeah I figured it out myself after I asked the question
I don't think the binoculars increase the AI's line of sight, so there's no point working out how to script it. Although you'd use "playmode"? if that helps.
Anyway the SQS file should go like this:
#start
nameOfGuy setFormDir random 360;
~6
goto "start"
Save that as an SQS file(in the mission's folder). and put the following string into the initialization field of one of your objects in the editor
[]exec "nameOfFile.sqs"
Thats how i did it anyway
Im not sure you quite understand what I mean, (no offense), I basically was asking what General Goober was asking in the post just before this one.