OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Chrispy on 15 Aug 2007, 07:33:07

Title: Any idea
Post by: Chrispy on 15 Aug 2007, 07:33:07
Okay, I've got a little idea. But I'll need some help with it. It's regarding .sqs files and setpos.

Okay, so just to get this over and done with. If I put in a mission editor script in an .sqs file, and execute it in-game, will it work properly? Is there any hotkey to activate the script? So rather than entering a trigger that executes the .sqs, you could press a key like = or whatever. I could do this in the editor without an .sqs but I'm working on a secret project... lol.

Also, what if in my .sqs I had something like John moveindriver Jeep? Is there some way the game can detect the player's mission editor name and add that in instead of John? Thanks.

Chris :)
Title: Re: Any idea
Post by: Mandoble on 15 Aug 2007, 12:19:45
You may use addAction (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=a#addAction) command to attach actions for any unit, vehicle or object.
For example, in the init field of the player:
Code: [Select]
this addAction ["My script", "myscript.sqs"]
and then, for myscript.sqs
Code: [Select]
hint format["My name is %1", name player]

You may use also radio triggers to execute action, just set the trigger activation to radio Alpha, Bravo ... put the exec of your script into its activation field. Dont forget to mark the trigger as "continuos" checks, so your dont lose your radio action after the first use.
Title: Re: Any idea
Post by: Tyger on 16 Aug 2007, 16:38:09
Quote
Also, what if in my .sqs I had something like John moveindriver Jeep? Is there some way the game can detect the player's mission editor name and add that in instead of John? Thanks.

How about
Code: [Select]
player moveInDriver jeep?
Title: Re: Any idea
Post by: Chrispy on 18 Aug 2007, 00:24:07
Okay, before I commence my object, would this work for the .sqs?:
this setpos [(getpos this select 0),(getpos this select 1),1]

So basically when I get the .sqs executed, it'll make the player go about half a metre or so in the air.

If yes, I'll start on the project. Also, how would I make the action continuous? Very sorry for the questions - I'm not exactly the best at mapping for OFP.

Thanks very much guys. :D

* Edit:
Woot! It worked! Thanks guys!

Chris :)