OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Zombie on 23 Aug 2004, 15:36:08
-
as you can see in the script below, I have tried 3 different ways to define _aaa,_bbb and _ccc, but the sidechat alsways returns "a is scalar,B is scalar, c is scalar"
What does this mean? How can I get a NUMBER to be displayed?
_f1=getpos fortress1 select 0
_f2=getpos fortress1 select 1
#start
_aaa=_f1 - getpos player select 0
_bbb=getpos player select 1 - _f2
_ccc=((getpos player select 2) - (getpos fortress1 select 2))
player sidechat format ["a is %1, b is %2, c is %3",abs _aaa,abs _bbb,abs _ccc]
~1
goto "start"
-
A Scalar is a number. The alternative is a Vector that has both size and direction. It looks like _aaa, _bbb and _ccc are not defined
There is nothing wrong that I can see with the sidechat instruction. Is fortress1 defined?
Try displaying _f1 and _f2 and see what you get.
-
What happens if you lose all the getpos stuff and set _aaa to a value? (Just for testing purposes.) What do you get if you lose the abs commands?
-
I tried that and it worked. The abs command does not seem to be the problem
-
What does GetPos fortress1 return?
It's a wild guess, but try renaming fortress1 to something that isn't an object class name.
-
Actually all of you contributed to the solution! Thanks a bunch, here is the new code:
_f1=getpos ftrs select 0
_f2=getpos ftrs select 1
_f3=getpos ftrs select 2
#start
player sidechat format ["fortress location is %1,%2 and %3",_f1,_f2,_f3]
~1
_aaa=(_f1) - (getpos player select 0)
_bbb=(getpos player select 1) - (_f2)
_ccc=((getpos player select 2) - (getpos ftrs select 2))
player globalchat format ["a is %1, b is %2, c is %3",abs _aaa,abs _bbb,abs _ccc]
~1
goto "start" I think the main key was naming fortress1, since it returned scalar bool array blah blah blah without a name.
I would have liked to use the distance command, but as I understand it, it would give me the slant range of 2 objects at different heights and locations and what I really needed to build this script for is to get the ALTITUDE ONLY (select2) difference. Now I can continue with the rest of the script, thanks to everyone for your help ;D