Home   Help Search Login Register  

Author Topic: Little Help, Stupid but it'll help me out alot.  (Read 822 times)

0 Members and 1 Guest are viewing this topic.

barry_the_baldy

  • Guest
Little Help, Stupid but it'll help me out alot.
« on: 04 Nov 2003, 04:26:41 »
I dont want anybody to write me a script, its not even for a mission, its just me experimenting and pushing the learning process along..

Ive scripted a helicopter to fly to players position and land.

All is well and good but the chopper doesnt land, its not my script because when i add a time of ~10 (the time it takes for the chopper to get o the player) it works fine. What i need is for the chopper to detect that it has arrived at the players position before it executes the "landing".

Heres a little example of what i mean
----------------------------------------------
chopper1 domove position man1

-Here is where i need the chopper to detect whether or not it is at "man1"s position

chopper1 land "land"

exit
------------------------------------------------
etc etc.

Anybody know how i can ask the chopper to detect whether or not it is hovering above man1s position before it lands?

Also is it possible to make the chopper land 10m or so away from the player?

Thanks.
« Last Edit: 04 Nov 2003, 04:28:21 by barry_the_baldy »

Kaliyuga

  • Guest
Re:Little Help, Stupid but it'll help me out alot.
« Reply #1 on: 04 Nov 2003, 04:29:25 »
 you can try making a condition for a trigger using the distance command

Condition:  heli distance man < x

On Activation: heli land "land"




barry_the_baldy

  • Guest
Re:Little Help, Stupid but it'll help me out alot.
« Reply #2 on: 04 Nov 2003, 05:42:46 »
Is there a way to incorporate that into the actual script?

Like I said, its just a learning process that helps me alot.

barry_the_baldy

  • Guest
Re:Little Help, Stupid but it'll help me out alot.
« Reply #3 on: 04 Nov 2003, 06:09:41 »
Ahhh got it, of course my script is a bit more complicated than this :) but using the other example

___________________________
chopper1 domove position man1

? chopper1 distance man1 < 20

chopper1 land "land"

exit
___________________________

I figure the "?" is the same as using the condition field on a trigger.

m21man

  • Guest
Re:Little Help, Stupid but it'll help me out alot.
« Reply #4 on: 04 Nov 2003, 14:14:11 »
Quote
I figure the "?" is the same as using the condition field on a trigger.
No, the @ symbol does the same as the condition field. So, you'd have:
@(chopper1 distance man1 < 20)

The ? symbol is used in if-then statements:
?(chopper1 distance man1 < 20): goto "land"

Edit - The : symbol is the beginning of the then segment.
« Last Edit: 04 Nov 2003, 14:14:42 by m21man »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Little Help, Stupid but it'll help me out alot.
« Reply #5 on: 04 Nov 2003, 14:47:26 »
There's a handy little section inthe official command reference ... Scripting Topics I think.   Well worth a read.
Plenty of reviewed ArmA missions for you to play

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Little Help, Stupid but it'll help me out alot.
« Reply #6 on: 04 Nov 2003, 15:09:42 »
Just one thing i'd like to add here:

The distance from the chopper to the guy on the ground
also includes the height difference.

So if the chopper is flying in a height of 30 meters, the
distance 20 will never be reached.

Solution:

use an object (best use a gamelogic).

gamelogic setpos [(getpos man1 select 0),(getpos man1 select 1),(getpos chopper select 2)]

Now as the chopper will probably (or better say for sure) not
keep his flying height on a constant level, you need to do this
as a loop.

#loop
~1
gamelogic setpos [(getpos man1 select 0),(getpos man1 select 1),(getpos chopper select 2)]
?(chopper distance gamelogic > 20): goto "loop"

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

barry_the_baldy

  • Guest
Re:Little Help, Stupid but it'll help me out alot.
« Reply #7 on: 06 Nov 2003, 23:04:43 »
Ah very nice.

Got it all in and working now, this will springboard me onto bigger things, it's already helped me create my own script to attatch a camera to a vehicle.

Thanks again guys.

Just 2 more questions (sorry guys), how do I set a timer up in my script?
Say for example you have a

_timer = _this select 0

then say

_timer < 100

how do I make it actually count down, so that when the timer is less than 100 it will move on?

And finally
Is there a way to make the chopper check if it has X amount of men in the cargo position before it takes off again?

Sorry for the bombardment of questions guys.

Thanks
« Last Edit: 07 Nov 2003, 00:05:04 by barry_the_baldy »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Little Help, Stupid but it'll help me out alot.
« Reply #8 on: 07 Nov 2003, 00:05:54 »
#start
_timer = 192

#loop
_timer = _timer-1
? timer <= 100: exit
blah blah blah
goto "loop"
Plenty of reviewed ArmA missions for you to play

barry_the_baldy

  • Guest
Re:Little Help, Stupid but it'll help me out alot.
« Reply #9 on: 07 Nov 2003, 00:19:44 »
Ahhh of course, I cant belive I didnt think of that :P

Thanks a million