OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Hauk on 17 Apr 2004, 15:01:30

Title: functions
Post by: Hauk on 17 Apr 2004, 15:01:30

I've recently been learning functions thanks to snYpirs tutorial, but have come across a problem.
As you said (snYpir) , i tried to  write the function myself which was obviously wrong, so I went to the link in the functions library and copy-and-pasted the written function there. there's the problem.
When I copy and pasted the function and saved it and alt-tabbed back into flashpoint i radio'ed him to get out but all I got was a problem  with the "if" part of the If-Then-Else. It reads like this:

// is the unit in a vehicle?
 If (jeep _soldier != _soldier) then
 {

"jeep" is my vehicle and "soldier" is my unit but flashpoint returns an error unknown operator with the _soldier that comes after jeep. I did copy-and-paste it so I'm guessing that others might have had the same problem.
Any help would be appreciated.

Thnx,

Hauk
Title: Re:functions
Post by: Planck on 17 Apr 2004, 15:08:56
I'm not sure about if that works.

I always thought it was:

if (vehicle unit != unit) then

I'm not sure if it works with a vehicle that has been named.

Just try:

if (vehicle _soldier != _soldier) then


Planck
Title: Re:functions
Post by: h- on 17 Apr 2004, 16:13:44
The vehicle is an OFP command...
Not meaning that 'substitute this with the name of your vehicle'...

So use vehicle, not the name of the vehicle in question...
Title: Re:functions
Post by: Hauk on 17 Apr 2004, 16:22:14
I'll give it a shot and get back to you.

Thnx,

Hauk
Title: Re:functions
Post by: Hauk on 17 Apr 2004, 16:31:52
Got it workin'

thnx for the tip

Hauk