Home   Help Search Login Register  

Author Topic: Distance checker won't work?  (Read 758 times)

0 Members and 1 Guest are viewing this topic.

Drozdov

  • Guest
Distance checker won't work?
« on: 31 Aug 2003, 19:56:55 »
I can't get the game to check the distance between two objects. I've tried putting this in the condition field of a trigger: (unit1 distance unit2 > 70) but upon testing the mission it came up with an 'unkown operator distance'. Now as far as I can see the syntax is right (it's exactly as it is in Lusty's command ref thing). I also wrote this script to produce the same effect (with an extra bit added that isn't that relevant with this problem) but it comes up with the same error. Here's my script...

Quote
_player = _this select 0
_unit = _this select 1

#check

?(_player distance _unit > 80): cuttext ["Where are you going? Get back here!", "PLAIN DOWN", 1]; goto "poschange"

~5

goto "check"

#poschange

~2

cuttext ["Returning to formation...", "BLACK OUT", 2]

~2.5

_player setpos [(getpos _unit select 0)+2, (getpos _unit select 1)-1, getpos _unit select 2]

cuttext ["", "BLACK IN", 2]

goto "check"


Why the hell isn't this working?  >:(

Knut Erik

  • Guest
Re:Distance checker won't work?
« Reply #1 on: 31 Aug 2003, 20:02:55 »
Try to remove the ()

?(_player distance _unit > 80): cuttext ["Where are you going? Get back here!", "PLAIN DOWN", 1]; goto "poschange"

Try this ::

?_player distance _unit > 80: cuttext ["Where are you going? Get back here!", "PLAIN DOWN", 1]; goto "poschange"

Drozdov

  • Guest
Re:Distance checker won't work?
« Reply #2 on: 31 Aug 2003, 20:05:46 »
Nope, that didn't work.  :help:

deaddog

  • Guest
Re:Distance checker won't work?
« Reply #3 on: 31 Aug 2003, 20:18:35 »
I just tried your script and it worked great.  That means you are probably calling it incorrectly.  Show us how you call the script.   :)

Drozdov

  • Guest
Re:Distance checker won't work?
« Reply #4 on: 31 Aug 2003, 20:37:11 »
I'm calling it like this...

[mv, rescom] exec "awayscript.sqs"

MV is the name of the player and rescom is the name of his groupleader. I have also tried it using the identities I gave them (using setidentity) but this didn't work.

deaddog

  • Guest
Re:Distance checker won't work?
« Reply #5 on: 31 Aug 2003, 20:52:10 »
That's weird.  I'm doing the same thing you are and it works.

Here is my example mission on desert island.


Drozdov

  • Guest
Re:Distance checker won't work?
« Reply #6 on: 31 Aug 2003, 21:32:10 »
Could it have something to do with the fact that both the units are in a group array? I don't see why, but there's nothing else I can see...

Edit: Well, it isn't the group array, because I removed it and still nothing. However, the example mission you gave me works fine... What the hell's going on?  >:(
« Last Edit: 31 Aug 2003, 21:41:01 by Drozdov »

Drozdov

  • Guest
Re:Distance checker won't work?
« Reply #7 on: 31 Aug 2003, 21:44:43 »
Here's the mission file... see if you can work anything out...

deaddog

  • Guest
Re:Distance checker won't work?
« Reply #8 on: 31 Aug 2003, 23:45:26 »
So far I'm getting the same error as you.  I haven't figured out what is going on.  I'll keep checking though.

BTW, an easy way to remove all weapons from a unit is:

removeallweapons this

See, that was easy :)  No need to use the individual removeweapons and removemagazines.

Offline Welshmanizer

  • Members
  • *
Re:Distance checker won't work?
« Reply #9 on: 01 Sep 2003, 02:51:21 »
hehe Got it :D.

The error message appears because the trigger you are using to execute the script "awayscript.sqs" is named "distance". Change ithe trigger's name to "distancecheck" or something like that. You can't give it the name of a command.

 8)

deaddog

  • Guest
Re:Distance checker won't work?
« Reply #10 on: 01 Sep 2003, 05:23:33 »
Awesome find !!   8)

My version worked because I didn't name the trigger anything.  

Good job.

Drozdov

  • Guest
Re:Distance checker won't work?
« Reply #11 on: 01 Sep 2003, 20:28:02 »
Woohoo that worked! Thanks Welshman  8). Thanks to deaddog for trying as well... Although I do actually use the removeallweapons this command. That doesn't get rid of handgrenades though. Nor the magazines.