Home   Help Search Login Register  

Author Topic: Detecting dist, and some more.  (Read 6476 times)

0 Members and 1 Guest are viewing this topic.

DoDgY

  • Guest
Detecting dist, and some more.
« on: 30 Jul 2005, 19:21:29 »
 Hello, this is my first post, and I've just got back into OFP. A few years ago, I left OFP because of some other games that were in no way as good, but I found them more accessible in the multiplayer department. However, I've recently had a blast on a 'Single Mission' in OFP and now have completed the original and RedHammer campaigns, as well as being about half way through the Resistance campaign. And guess what...now I want to make missions!

I did learn a few things about scripting in OFP before I left, but now I simply cannot remember a thing :( . I've searched the FAQ, posts and some other websites but found this is definitely the place for answers to my questions. I had a few dozen queries but found most of them with the search command :).

I doubt I refined my search correctly but I couldn't find anything specific enough for a few queries. So here goes...

1) How can I make some machine gunners ready to open fire on a nearby base actually detect all of the enemy soldiers below? I have them in definite firing range, but is there a command or anything I can put in their init field to increase their detecting distance?

2) I have a soldier who's walking into a base wearing an enemy's uniform (I guess the best way is to deletevehiclethis a grouped friendly soldier?) but there are a few problems.

Firstly, I don't want him to use the weapon he has slung on his back until a certain time. Should I do this by the simple 'careless' combat mode? I know about the 'setcaptive true' part.

Secondly, I want him to walk in and in very specific places, to drop a satchel charge/mine and walk around the base doing this. Is there a simple script I could adapt, as waypoints really don't work for this. In the official missions, I see people dropping mines and satchel charges and I don't know how to make the man walk to specific positions or drop the bombs.

3) Are there any voice commands I could use for the soldier after he has completed his mission? That's too vague so I'll go into more detail: I want the man to walk around the base dropping his bombs. I then want him to get in a UAZ and drive away down the dirt track. When he's done that, I want him to report to his friendly forces something along the lines of:

"The bombs have been dropped; proceed with mission." Are there any non-specific voice things that may have been used in an official mission, that I can use for that? Where do I find them? ([Un]official command reference?)

I don't know how to execute them either, though I should be able to find that in one of the references now I come to think of it.

4) I'd like, on another mission, all the soldiers to open fire over a longer distance, instead of about 200m I'd say 600, but with less precision, and for machine gunners about 900m. If possible, I'd like to have an option that doesn't involve installing an AI upgrade, I only want the increased firing range.

5) How can I make a machine gunner actually use 'support fire' My WIP improvisation for this is to use the JAM2 machine gunner with HD, so that he'll rarely hit what he is firing at and keep firing.
Is there a better way so that I can get the gunner to fire in long bursts of say 20 to 30 rounds then stop for a few seconds, then fire another burst. Even if he's not firing at a soldier, could he still just lay down a hail of rounds anywhere below, where the enemies are located?

6)I didn't search for this, but as I'm asking a load of questions here anyway, maybe I could get a specific answer to this :)

I would like to know how to "stack boxes" e.g. get the position of "box1" and tell "box2" to go to the position of "box1" but 0.5m higher. Also can I place a box or anything where I put it in the editor but, say,5m higher? So I don't have to setpos (as this takes ages).

Thanks very much for reading this and thanks a lot in advance.

DoDgY.

DoDgY

  • Guest
Re:Detecting dist, and some more.
« Reply #1 on: 30 Jul 2005, 19:35:03 »
http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=24824 I found this link that answered part of my second question, as to how to drop the satchel charges and mines, thoguh the specific movement is still a mystery for me.

Dane

  • Guest
Re:Detecting dist, and some more.
« Reply #2 on: 30 Jul 2005, 19:57:34 »
Well, off the top of my head i can answer the last question :P

box2 setPos [getPos box1 select 0, getPos box1 select 1, 0.5]

Edit.

5. I don't think that's possible without a fast loop script.
« Last Edit: 30 Jul 2005, 20:07:49 by Dane »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Detecting dist, and some more.
« Reply #3 on: 30 Jul 2005, 20:01:33 »
Or maybe even:

box2 setPos [getPos box1 select 0, getPos box1 select 1, (getPos box1 select 2)+0.5]

 ;D ;D

Planck
I know a little about a lot, and a lot about a little.

Dane

  • Guest
Re:Detecting dist, and some more.
« Reply #4 on: 30 Jul 2005, 20:07:05 »
Nop. box2 setPos [getPos box1 select 0, getPos box1 select 1, 0.5] will do ;)

Offline Pilot

  • Contributing Member
  • **
Re:Detecting dist, and some more.
« Reply #5 on: 30 Jul 2005, 20:24:11 »
Wonderful!  Another prodigal son has returned! ;D

Welcome back! :wave:

1: Try using the reveal command.
MGunner reveal ManInBase

Or, you could make an array of everyone in the base, put the following line in init.sqs:
BaseArray = [BaseMan1, BaseMan2, BaseMan3...]
just replace BaseMan1, ect with the names of the men in the base.  Then write the following in all of the machine gunners' init fields:
"this reveal _x" foreach BaseArray

2: Uhh, try something like this:

_man = _this select 0
_i=0

_MarkerArray = ["marker1", "marker2", "marker3"...]

#Loop
?_i=count _Markerarray: exit
man move getmarkerpos (_markerarray select _i)
@unitready _man
if (_man hasweapon "pipebomb") then {_man action ["Put", "Pipebomb"]}
_i=_i+1
~2
goto "Loop"

call the script like this: [NameOfSpy] exec "WP.sqs"
Of course, make sure you name the script WP.sqs ::)

I am assuming you are using markers for the waypoint position.  Put the markers where you want to man to go, and then type their names in the following line:
_MarkerArray = ["marker1", "marker2", "marker3"...]
Make sure to keep the quotes!

3: I don't know of any, but then, I haven't finished any of the official campaigns either.

4: Uh, for this you may want to play around with the reveal command as well

5: I don't know with this one

6: Everyone else already answered, so I won't bother to ;D

If nothing makes sense of what I wrote, don't worry, I have a knack for making things harder than they should be ::) ;D  

Just ask me to clarify anything that doesn't make sense.

Btw, Syntax not guarenteed for anything you have just read ::)

Good luck!

-Student Pilot

DoDgY

  • Guest
Re:Detecting dist, and some more.
« Reply #6 on: 30 Jul 2005, 21:12:03 »
Thanks very much for all your help :) I'll try it out tomorrow when I have time, and get back to you tomorrow as well.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Detecting dist, and some more.
« Reply #7 on: 30 Jul 2005, 23:00:06 »
2. Pilot has it, but i wold use game logics - its just my preference, dunno which is better (lag causing?)
you may also want to use domove because i believe you might get a radio response from the man if he's given a move command

3. I "borrowed" this sound from another gam of mine, Ghost Recon, and changed it to ogg format. its attached below. I can also give you the description.ext that i used for it

5: you could use an invisible target addon, with a combination of setcombatmodes and dofires,dotargets etc
just an idea, and i might not work %100 (probably won't)




Offline Pilot

  • Contributing Member
  • **
Re:Detecting dist, and some more.
« Reply #8 on: 30 Jul 2005, 23:19:37 »
Quote
but i wold use game logics - its just my preference, dunno which is better (lag causing?)
Yeah, I use markers just because that's the way I've always done it.  I guess it just matters what one's personal preference is ::)  I'm not sure how lag is affected

Quote
you may also want to use domove because i believe you might get a radio response from the man if he's given a move command
Yes, Triggerhappy is right, but maybe for a wrong reason :P.  Use move for groups, domove for individual men.  I'm not sure about the radio response, though.

-Student Pilot

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Detecting dist, and some more.
« Reply #9 on: 30 Jul 2005, 23:51:32 »
lol, true, i took you for granted that it would work ;D ::)

Dane

  • Guest
Re:Detecting dist, and some more.
« Reply #10 on: 31 Jul 2005, 00:13:23 »
Quote
I'm not sure how lag is affected

I do believe a marker is less resource demanding than a gamelogic because a gl is like an invisible object, can have waypoints and such.. i think so :P ::)

DoDgY

  • Guest
Re:Detecting dist, and some more.
« Reply #11 on: 02 Aug 2005, 21:52:35 »
OK, I finally got to try out your advice, and I'm sure it's great...but as I said before, I have little or no idea about scripting. I've totally forgotten everything. :o I was never any good, and only made very simple scripts. I read some tutorials and now have some idea, but I've got a problem that I expect any of you can answer:

Here it is:

I have in the init field of a unit [this] exec "reveal.sqs" and the mission is called 'Attack'.

In all the subfodlers etc, in the 'Attack' mission folder I have a script named 'reveal.sqs'

Code: [Select]
;to reveal units

gunner1 = _this select 0

[gunner1] reveal [soldier1,soldier2,soldier3,soldier4,soldier5,soldier6,soldier7,soldier8,soldier9]

exit

My script. I know it must be wrong, and it's so simple :(.

On top of that, I really don't get the public and private variable mumbo jumbo. I read SnYper's intro to code snippets but I cannot understand it all, though I will, when I have the time, go through it properly.

Again, thanks in advance!

P.S. Thought it better to not make another thread.

DoDgY

  • Guest
Re:Detecting dist, and some more.
« Reply #12 on: 03 Aug 2005, 13:47:40 »
Oops, forgot to mention a crucial thing that when I press 'preview' the mission doesn't start and I get an error message "Script "reveal.sqs" not found." I know it's in the right folder.

Dane

  • Guest
Re:Detecting dist, and some more.
« Reply #13 on: 03 Aug 2005, 15:30:02 »
Are you sure your calling the script right, because if you are and script is in mission directory you shouldn't get that message?

DoDgY

  • Guest
Re:Detecting dist, and some more.
« Reply #14 on: 03 Aug 2005, 19:02:21 »
[this] exec "reveal.sqs"  ???