OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Shove It on 18 Jul 2004, 20:37:32

Title: Massive ship attack
Post by: Shove It on 18 Jul 2004, 20:37:32
I can't get any decent addons so for my next mission I need to get one of those LSTs moving but they never do, how could I make it work?
Title: Re:Massive ship attack
Post by: ponq on 18 Jul 2004, 22:12:35
write a script to make it move with
-getpos
-setpos

look these commands up at the editors depot online references.
Title: Re:Massive ship attack
Post by: Artak on 18 Jul 2004, 22:28:57
Rather use the setvelocity command.

Quote
vehicle setVelocity [x, z, y]
Operand types:
    vehicle: Object
    [x, z, y]: Array
Compatibility:
    Version 1.8 required.
Type of returned value:
    Nothing
Description:
    Set velocity (speed vector) of vehicle.

You should be able to have the ship running smoothly with that.
Title: Re:Massive ship attack
Post by: GrimMonkey on 19 Jul 2004, 06:29:33
Yes, do what Arty said.

I would just like to say that the LSTs will not move when given the 'Move' waypoint, they're just stubborn that way.


Beware the GrimMonkey
Title: Re:Massive ship attack
Post by: Shove It on 19 Jul 2004, 10:26:25
See, I'm still an amateur at this game so I don't know what I put in the places x, y, z. I knew that the setvelocity command would work I just don't know how to use it.
Title: Re:Massive ship attack
Post by: macguba on 19 Jul 2004, 10:57:36
The LSD is not a vehicle, it is an object.   Giving it a waypoint is like giving a waypoint to a tent.

x, y and z are the components of the movement you want.    x is east-west, z is north-south and y is up-down.   (At least I think its that way around)

If you wanted something to move due north you'd use

ship1 setVelocity (0,20,0)

If you are really picky about the direction and speed you want you'll probably need some trigonometry (see the trig guide in the Ed Depot or the end of the Unofficial comref) but if you're not that fussy then I'd just experiment till you get what you want.    If you want it to move a long way you'll need to reissue the command to keep it moving.
Title: Re:Massive ship attack
Post by: Shove It on 19 Jul 2004, 13:23:06
Yeah I just realised it about the xyz. Thanks anyway.

I don't really trust trigonometry though. I hate trigonometry!
Title: Re:Massive ship attack
Post by: Shove It on 21 Jul 2004, 20:35:24
Thanks, it works completely but the ship stops after some time and  I want it to move for the rest of its existence without having to use more than one trigger or using the repeatedly option of a trigger. Anyone know the solution?
Title: Re:Massive ship attack
Post by: Artak on 21 Jul 2004, 21:02:33
Quote
x is east-west, z is north-south and y is up-down.  (At least I think its that way around)

If you wanted something to move due north you'd use

ship1 setVelocity (0,20,0)
 :hmm:
...
Want to check that statement in Mr. Spocks logic test?  ;D

Shove It, you can put your setvelocity commands in a script which is executed from the trigger that you're now using to give her the velocity once.

old on activation: ship1 setvelocity [100,100,0]
new on activation: [ship1] exec "velocity.sqs"

in velocity.sqs:
_unit = _this select 0
#velloop
~1
_unit setvelocity [100,100,0]
goto "velloop"

Doing so will give ship1 the desired velocity every second for the rest of the mission. Good thing about this scripting or whatever it's called, is that you can execute the same script for ship2 or what ever unit you want to. Just change the [ship1] to [ship2] or whatever unitname.  ;)
Title: Re:Massive ship attack
Post by: Shove It on 21 Jul 2004, 21:57:05
Thanks
Title: Re:Massive ship attack
Post by: Shove It on 21 Jul 2004, 21:57:10
Thanks