OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: RolsRois on 19 Oct 2005, 12:02:27

Title: TaXI Script
Post by: RolsRois on 19 Oct 2005, 12:02:27
ok, so, i know there is a script like that, but i didn't find it...
so can someone make me a script, let's say u enter a car, then u click on the map and the certain car will drive over there.
if u r not in the car u can't click on the map and the car will drive to there.
and the dude under me, your script isn't working
Title: Re:TaXI Script
Post by: Triggerhappy on 19 Oct 2005, 22:26:17
carname exec "taxi.sqs"

Code: [Select]
_taxi = _this
#loop
@player in _taxi
onmapsingleclick {_taxi domove _pos}
@!(player in _taxi)
onmapsingleclick {}
goto "loop"

not garuneteed, and a very basic idea, but if this is what you want(and it works ::) ) i could spruce it up a bit for ya
Title: Re:TaXI Script
Post by: Planck on 20 Oct 2005, 18:19:36
RolsRois,

You have been taken to task previously about consecutive posting.
Please use the Modify button to edit your previous post rather than post again.


Planck
Title: Re:TaXI Script
Post by: Triggerhappy on 21 Oct 2005, 02:23:33
and the dude under me, your script isn't working

i wonder if you realize just how useless that is to me...

whats happens? do you get an error message? describe how you set everything up. give me something to work with, plz.

oh, and another thing, i like being called by name, ty
Title: Re:TaXI Script
Post by: RolsRois on 21 Oct 2005, 12:33:56
Sorry, Triggerhappy.
look, The script is fine, but it does nothing, there is not an error messege or something.
i meen im in the car, im pressing on the map and it does nothing.
really, so, can u fix the script and plz try it 1st?

Title: Re:TaXI Script
Post by: Tyger on 15 Nov 2005, 01:38:42
okay, a shot in the dark.

for every car you want to be a taxi, add this in their init line:
Code: [Select]
this addEventHandler ["init",{(_this select 0) exec "taxi.sqs"}]
and use triggerhappy's script.

I don't know why it doesn't work for you though.

try this. It's a longer version, but it might make it work:

Code: [Select]
;named taxi.sqs
_taxi = _this
#loop
? (player in _taxi) : goto "InTaxi"
? !(alive _taxi) : exit
goto "loop"

#InTaxi
onMapSingleClick {_taxi domove _pos}
~1
onMapSingleClick {}
goto "loop"
that might do it.

[EDIT]: Script is untested. If that doesn't work, please let me know what happened etc.
Title: Re:TaXI Script
Post by: Tyger on 15 Nov 2005, 01:48:26
An improved script, so I posted it seperate...
Code: [Select]
;named taxi.sqs
_taxi = _this
_taxiOnMove = false

#loop
? (player in _taxi) : goto "InTaxi"
? !(alive _taxi) : exit
? (unitReady _taxi) : _taxiOnMove = false
~1
goto "loop"

#InTaxi
? (_taxiOnMove): goto "loop"
onMapSingleClick {_taxi domove _pos}
~1
onMapSingleClick {}
_taxiOnMove = true
goto "loop"
Syntax not guareteed. All I did was add a check to see if the taxi was at the new place so that the player did not constantly get onMapSingleClick prompts and inadvertently use one. Also added a delay on the loop so that it doesn't absorb memory like no other.  ;D The '@' condition doesn't allow for multiple values to be tested simultaneously.
Title: Re:TaXI Script
Post by: RolsRois on 15 Nov 2005, 12:41:18
THANKS ALOT!
Title: Re:TaXI Script
Post by: Tyger on 15 Nov 2005, 13:58:18
Does it work?
Title: Re:TaXI Script
Post by: RolsRois on 15 Nov 2005, 19:45:27
o well o well o wello...
just tested it, it doesnt work... maybe im using it all wrong,
can u make an exmaple mission or something? and fix the script? thanks
Title: Re:TaXI Script
Post by: Tyger on 15 Nov 2005, 23:07:17
Yeah, I'm working on it. I'm on a breakthrough, but it can only be used once so far. I'll post it later if I fix it.
Title: Re:TaXI Script
Post by: Tyger on 18 Nov 2005, 19:41:13
Put this in every car's init:
Code: [Select]
this addEventHandler ["get in",{[(_this select 0)] exec "taxi.sqs"}]

And for taxi.sqs.
Code: [Select]
;named taxi.sqs
_taxi = _this
onMapSingleClick {_taxi doMove _pos; onMapSingleClick {}}

That should do it. I realized it didn't need to  be that fancy...
Title: Re:TaXI Script
Post by: RolsRois on 19 Nov 2005, 18:50:52
thanks ill try it out