Home   Help Search Login Register  

Author Topic: I have to create a plane...  (Read 891 times)

0 Members and 1 Guest are viewing this topic.

Serial Killer

  • Guest
I have to create a plane...
« on: 08 Mar 2005, 21:05:04 »
I have to create a Su25 in the middle of game, and it must fly. How?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:I have to create a plane...
« Reply #1 on: 08 Mar 2005, 21:16:45 »
first thing which springs to mind -

have it flying somewhere distant from where the player will be. create a move/cycle waypoint combo on one extreme edge of the map to keep it going back and forth, with a few other waypoints round about the area where it's going to appear.

when you want to have it appear, setpos it into position, and use a switch trigger to change to the next set of waypoints.

Offline Pilot

  • Contributing Member
  • **
Re:I have to create a plane...
« Reply #2 on: 08 Mar 2005, 21:51:46 »
Your post encouraged me to make a script for this, so here it is.

Call this script like this:
[NameOfDriver, "MarkerName", Direction, Height, Speed] exec "MoveInDriver.sqs"

NameofDriver is the name of the man you want to be the pilot
"MarkerName" is the name of the marker you want the plane created over, Keep the Quotes!
Direction is the direction you want the plane to fly in
Height is the hight at which you want the plane to be created at
Speed is the speed you want the plane to be created at.

I hope this helps!

EDIT:
While the speed variable does affect the speed of the airplane, the number you put in will most likely not be the speed the plane is created at.  By raising the number, you can raise the speed, and by lowering the number you can lower the speed.  But don't expect the plane to be created at 200 knots even though you put 200 as the variable.  Unfortunately, I am not sure how to fix this.
« Last Edit: 08 Mar 2005, 22:19:58 by Student Pilot »

Serial Killer

  • Guest
Re:I have to create a plane...
« Reply #3 on: 09 Mar 2005, 09:58:46 »
I'm just checking.. Do you think that this works perfectly?

Code: [Select]
_man = _this select 0
_position = _this select 1
_dir = _this select 2
_height = _this select 3
_speed = _this select 4

;Create the plane
_plane = "Su25" createVehicle getmarkerpos _suicide

;Set the plane's height
_plane setpos [(getpos _plane select 0), (getpos _plane select 1), _85]

;Set the plane's direction
_plane setDir _90

;Set the plane's speed
_plane setvelocity [(sin getdir _plane)*(_100*.5), (cos getdir _plane) * (_100*.5), 0]

;Move the man in as driver
_man moveindriver _plane
exit

Do you think that I made something wrong?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:I have to create a plane...
« Reply #4 on: 09 Mar 2005, 10:13:35 »
you tell us - have you not tested it? best way to find out if it works or not.

as an aside, you might want to add

Code: [Select]
_man assignasdriver _plane
before the exit. this means the pilot will know he's supposed to be flying the plane rather than simply keeping the seat warm.

one other puzzling thing - the direction, speed and height are all passed to the script when you call it - hence all the [pilot,whereto,direction,etc...] exec "script.sqs" - but then you don't use any of the variables.

and i'm still not convinced that simply camcreating a plane out of thin air will do anything other than crash a perfectly good plane, as the pilot probably won't have time to realise he should switch the engines on.

but looking at the "suicide" marker - which btw should read

Code: [Select]
_plane = "Su25" createVehicle getmarkerpos "suicide"
maybe a crashing plane is the effect you're after.

test it, then tell us how it went :)

Serial Killer

  • Guest
Re:I have to create a plane...
« Reply #5 on: 09 Mar 2005, 10:42:44 »
Great, it works perfectly! :) Next question... How can I create a waypoint for him?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:I have to create a plane...
« Reply #6 on: 09 Mar 2005, 11:16:33 »
and there's your problem right there. you can't. it's been magicked out of thin air, and so has no waypoints. and unlike planes, waypoints can't be created outwith the editor.

if the pilot exists before the plane, give him waypoints. when he's moved into the driving seat he'll follow his waypoints in the plane, so long as he's assigned as the driver. be sure to make him 'hold' on his first waypoint, and then use a switch trigger to set him moving once inside the plane, otherwise he'll set off on foot.

still don't understand why you're doing it this way, but meh... whatever tickles yer pickle ;)

Serial Killer

  • Guest
Re:I have to create a plane...
« Reply #7 on: 09 Mar 2005, 14:50:47 »
I'll try it, thanks!

EDIT: I hope that this is the last question.. I have a script and it  name is Su25.sqs. I have to stop that script in the middle of game. How?
« Last Edit: 09 Mar 2005, 15:04:35 by Serial Killer »

Homefry31464

  • Guest
Re:I have to create a plane...
« Reply #8 on: 09 Mar 2005, 15:41:35 »
With a global variable.  Create a check in the middle of a loop, if the variable becomes false, then have it end the script.

Serial Killer

  • Guest
Re:I have to create a plane...
« Reply #9 on: 09 Mar 2005, 15:59:49 »
Uhm.. I don't understand :-\ I put that script here, if it helps you..

_camera = "camera" camCreate [0,0,0]
_camera cameraeffect ["internal", "back"]
#loop
_camera camSetTarget su25
_camera camSetFOV 0.7
_camera camSetRelPos [-0.41, 3.6, 0.18]
_camera camCommit 0
@camCommitted _camera
?(proceed):goto "proceed"
goto "loop"
#proceed

One of my friends helped me with that script..
« Last Edit: 09 Mar 2005, 16:00:47 by Serial Killer »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:I have to create a plane...
« Reply #10 on: 09 Mar 2005, 16:17:51 »
create a global variable in your init.sqs file like this:

Code: [Select]
stop_my_script = false
then in your loop:

Code: [Select]
_camera = "camera" camCreate [0,0,0]
_camera cameraeffect ["internal", "back"]

#loop

?(stop_my_script):exit

_camera camSetTarget su25
_camera camSetFOV 0.7
_camera camSetRelPos [-0.41, 3.6, 0.18]
_camera camCommit 0
@camCommitted _camera

?(proceed):goto "proceed"

goto "loop"

#proceed
...

then, when you want the script to end, use a trigger or some other script to set stop_my_script to true. that'll do it.
« Last Edit: 09 Mar 2005, 16:18:41 by bedges »

Serial Killer

  • Guest
Re:I have to create a plane...
« Reply #11 on: 09 Mar 2005, 16:32:34 »
Thank you! 8)