Home   Help Search Login Register  

Author Topic: getdir??  (Read 661 times)

0 Members and 1 Guest are viewing this topic.

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
getdir??
« on: 18 Mar 2004, 13:40:20 »
ok just a quick question to save me time well i hope it dose
how do i get this code to detect if the number is between 90/180

so the range
91,92,93,94,95,96,97,98 and so on up to 180

_unit = _this select 0
#top
_dir = Direction _unit

?(_unit < 180):hint "He can see us!!!!";goto "run"

goto "top"
#run
hint "RUN"


Unnamed

  • Guest
Re:getdir??
« Reply #1 on: 18 Mar 2004, 13:49:00 »
Try this function in the Editors Depot:

http://www.ofpec.com/editors/funcref.php?filter_func=10

Or at least look at how it works if it does not fit exactly what your after.

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:getdir??
« Reply #2 on: 18 Mar 2004, 13:55:26 »
ok let me start again what i would like is if the unit useing the script when it turns between south and east ie 90 - 180 it will activate but only when its between 90  - 180 the funchtion by toadlife is the same a useing _dir = Direction _unit

thanks tho but help still needed

the exsample i gave you at tom works but only with its under 180 this includes 0,1,2,3,4,5,6,7,8,9,10,11 and so on

sa8gecko

  • Guest
Re:getdir??
« Reply #3 on: 18 Mar 2004, 13:57:50 »
This would solve only a part of the problem.
Then you must check the facing direction of the unit.
The problem is that atan2 return a number between -180/+180,
so if the unit is facing north you could get the wrong result.
I solved somehow, Wizziwig, ask Raptorsaurus,  I gave him a terrain
following code some time ago. The solution should be there,
if it's not, for Raptorsaurus would be very easy to find out.

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:getdir??
« Reply #4 on: 18 Mar 2004, 14:01:28 »
im workign with him on the tomahawk now but he is asleep till about 2pm what this script is for is finding the direction of the tomahawk and setting a marker for that dir i know how to set dir but othere then that im stupid all i need it to do is

exsample 2

_unit = _this select 0
#top
_dir = Direction _unit
?(_dir >= 360):player sidechat "face north"
?(_dir >= 90):player sidechat "East"
?(_dir >= 180):player sidechat "South"
?(_dir >= 270):player sidechat "West"
~1
goto "top"

sa8gecko

  • Guest
Re:getdir??
« Reply #5 on: 18 Mar 2004, 14:11:32 »
the problem lies in the fact that dir or direction returns a number
between 0 and 360. So the line
Code: [Select]
?(_dir >= 360):player sidechat "face north"has little meaning
Face north: 315-360 and 0-45
face east  45-135
face south 135-225
face west  225-315

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:getdir??
« Reply #6 on: 18 Mar 2004, 14:39:52 »
i just tryed this with no joy it is returning 3 dirs north,east,south but never west
 
_unit = _this select 0
#top
_dir = Direction _unit
?(_dir < 315),(_dir >= 45  ):player sidechat "face north"; "marker" setmarkertype "TomN"
~1
?(_dir < 45),(_dir >= 135  ):player sidechat "face EAST";"marker" setmarkertype "TomE"
~1
?(_dir < 135),(_dir >= 225  ):player sidechat "face South";"marker" setmarkertype "TomS"
~1
?(_dir < 225),(_dir >= 315  ):player sidechat "face West";"marker" setmarkertype "TomW"
~1
goto "top"

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:getdir??
« Reply #7 on: 18 Mar 2004, 14:45:20 »
is there not a way to detect the exsact number
_unit = 180
?(_unit = 180) then hint "180"
« Last Edit: 18 Mar 2004, 14:47:54 by WizzyWig »

Offline Spinor

  • Members
  • *
  • I'm a llama!
    • The chain of command
Re:getdir??
« Reply #8 on: 18 Mar 2004, 15:29:18 »
Code: [Select]
?(_dir < 315),(_dir >= 45  ):player sidechat "face north"; "marker" setmarkertype "TomN"The syntax is not correct (I think the placement of the '>', '<' is also faulty):
Code: [Select]
_unit = _this select 0
#top
_dir = Direction _unit
?_dir > 315 AND _dir <= 45: player sidechat "face north"; "marker" setmarkertype "TomN"
~1
?_dir > 45 AND _dir <= 135: player sidechat "face EAST";"marker" setmarkertype "TomE"
~1
?_dir > 135 AND _dir <= 225: player sidechat "face South";"marker" setmarkertype "TomS"
~1
?_dir > 225 AND _dir <= 315: player sidechat "face West";"marker" setmarkertype "TomW"
~1
goto "top"

Code: [Select]
is there not a way to detect the exsact number
_unit = 180
?(_unit = 180) then hint "180"
equality is checked by '==':
Code: [Select]
?(_unit == 180) then hint "180"

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:getdir??
« Reply #9 on: 18 Mar 2004, 15:41:09 »
ok i tryed that but with no joy it dont do anything please can you make a quick exsample

thanks

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:getdir??
« Reply #10 on: 18 Mar 2004, 16:02:41 »
ok tryed it again and South, east, west, works but no north?

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:getdir??
« Reply #11 on: 18 Mar 2004, 16:21:12 »
ok got it working thatnks