OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mike on 09 Sep 2002, 06:38:02

Title: Getpos, setpos for alive units only?
Post by: Mike on 09 Sep 2002, 06:38:02
Ok what I need is a script to simply move my 6 playable units to another location when the script is activated.

Basically my group has run into a roadblock and gets arrested, I want the screen to fade to black for a few seconds then fade in again when the units are in the "prison"

I kinda suck at sripting currently.  ;) Which is why im here..

So if someone can do this it would be verry awsome!  :cheers:

I need my 6 players, named R1, R2, R3, R4, R5, R6  to move to a gamelogic object named prison.

I dont think its too hard.. just need a fade to black, then a setpos for the 6 men, then a fade in.. but I dont know how to put it together properly..
Title: Re:I need a script
Post by: Cedaie on 09 Sep 2002, 14:34:51
hrrm, firstly, don't use game logics for teleportation, which is what your trying to acheive, game logics are huge in there Icon size, and, they kinda look shabby, use triggers instead, and just name them, buut, anywayz:

this is the script you'd want:


~3
titlecut ["","black out"5]
~6
;is the leaders name R1?
"_x setpos getpos triggername" foreach units group player
~2

titlecut ["","black in"5]
~5
exit
Title: Re:I need a script
Post by: Mike on 09 Sep 2002, 19:42:13
the leaders name is R1 so would it be:


~3

titlecut ["","black out"5]
~6

"_x setpos getpos prison" foreach units group R1
~2

titlecut ["","black in"5]
~5

exit


Or does the R1 have to be the Groups name??
Title: Re:I need a script
Post by: Mike on 09 Sep 2002, 21:49:59
Ok well, Ive tried it how it is above and it warps the players fine, but the fade out and in doesn't work, it comes up with an error message at the top of the screen..?

what does the    thing do?
Title: Re:I need a script
Post by: KTottE on 09 Sep 2002, 22:39:10
There is no command named , they are just using that to explain that it is not the entire script shown.

 in this case would mean all the code you had before this particular part.

Just delete that line and you should recieve no more errors.

Cedaie: Please don't use words that can be mistaken for commands, it's just hard on everybody.
Instead, use the (code) (/code) feature instead and incapsulate the script with that.
It will make stuff appear in neat windows, like this:

Code: [Select]
~3
titlecut ["","black out"5]
~6
;is the leaders name R1?
"_x setpos getpos triggername" foreach units group player
~2

titlecut ["","black in"5]
~5
exit

Oh, and (code) (/code) isn't how it should look. The ) should be replaced with ] and the ( with [
So
) = ]
( = [

After that it'll work.
I had to use ( and ) instead, otherwise it would have turned into BBC code ;D

Cheers, KTottE
Title: Re:I need a script
Post by: Mike on 10 Sep 2002, 03:03:03
I copied that exactly and changed names to the following:


~3
titlecut ["","black out"5]
~6
;is the leaders name R1?
"_x setpos getpos prison" foreach units group R1
~2

titlecut ["","black in"5]
~5
exit


and it still wont use titlecut.. Gives me a message at the top of the screen?..

and the name of the script is "prison.sqs"

I exec it with

[] exec "prison.sqs"

Is that right?
Title: Re:I need a script
Post by: Mike on 10 Sep 2002, 05:20:34
Well I found the problem myself and thought I should share ;)

Wrong:

titlecut ["","black out"5]

Right:

titlecut ["","black out",5]