OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: dmakatra on 29 Apr 2004, 19:16:30
-
Hi! I have a GL which I want to move. But I don't know where, 'cause the player decide it by the onmapsingleclick command. And I do not want to move it like KA-BAM fast like GLs normally do but about 2 meters each time then a delay on one sec or maybe something like that. Any ideas how I should do this? Cheers!
:beat: *Gets GLed* :beat:
-
For the not moving too fast
If you use the command to stop them, with a delay of a few seconds, then let them move for another 2 seconds, that should work
- Ben
-
GL's moves FAST. Really FAST. If you put a WP they will be there before you can say the shortest word in the dictonary. ;)
:beat: *Gets Shot* :beat:
-
Make a script that plots multiple points between the GL's present postition and the new postition, then have the script move the GL incrementally from point to point with a delay between moves until it reaches the final point.
-
I had used a GL to create a conversation of sorts using waypoints to activate the sidechat command and having the waypoints pause by the countdown option. I believe that you should be able to slow the pace down with this method.
Wadmann
-
The problem is that I do not know how many points/WPs that I need since I not know the location. If the player clicks right next to the GL it would take as much time to get there as clicking 50 km away from the GL.
:beat: *Gets Shot* :beat:
-
OK, with a lot of frustrating experimenting, digging in others scripts, comref reading I finally got a script here:
_GL = _this select 0
_target = _this select 1
_speed = _this select 2
#loop
_dir=[_GL,_target] call DirToObj
_1x= getpos _GL select 0
_1y= getpos _GL select 1
_2x=_1x+(_speed * (sin(_dir)))
_2y=_1y+(_speed * (cos(_dir)))
_GL setpos [_2x, _2y, 0]
~2
goto "loop"
exit
Basicly, it was the two lines with sin and cos that got me. I had to dig in other scripts that I could find and stuff like that to find out wtf they were doing. Anyway, it now works fine. With one exception. An error message. The script works as it should but it doesn't look too good with an error message showing all the time. :P
'_GL setpos [_2x, _2y, 0]|#|': Error Type Any, expected Number
How do I get rid of it? Cheers!
:beat: *Gets Shot* :beat:
-
With GL u mean the mercedes GL? Where did u download it? ;D
-
...
Why dig up this ol' thread? ???
...
Anyway, I still got the error msg problem so any help would be appriciated.
:beat: *Gets Shot* :beat:
-
lo Armsty,
_2x=_1x+(_speed * (sin(_dir)))
_2y=_1y+(_speed * (cos(_dir)))
I just noticed that you didn't initialize _2x and _2y.
Therefore the two operations in the quote above don't work.
_2x = 0
_2y = 0
somewhere at the start would fix that prob.
P.S: not sure if it will fix your main problem, as i haven't had a
look onto anything else yet - will do so after this reply ;)
:edit - just to make clear what i meant above:
you cannot add values to a variable, which is actually not defined/initialized as such.
_a = 0
_b = 1
_c = 2
_a = _b + _c
works
_b = 1
_c = 2
_a = _b + _c
doesn't work because _a was not initialized as a numeric variable (= it doesn't exist that way), therefore you can't add anything to it.
~S~ CD
-
OK, cheers Chris, will check that out.
:beat: *Gets Shot* :beat:
-
Checked it out. Doesn't work. :-/
Ah, crap me, the script works, just displays error message. Therefor I am locking this thread.
:beat: *Gets Locked* :beat: