Warcraft III resources & community, 2003–2006 · archived

How can I get a script working exactly?

5 posts
#1

How can I get a script working exactly?

I have a problem, I want to save the current velocity of the camera movement in a real variable. I wrote this script:
Loop every 0.1 seconds:

    set udg_CurspeedCamera[1] = GetCurrentCameraSetup()

    //CurrentTargetSpeed Updates
    set udg_CurspeedTarget = ( DistanceBetweenPoints( CameraSetupGetDestPositionLoc( udg_CurspeedCamera[0] ), CameraSetupGetDestPositionLoc( udg_CurspeedCamera[1] ) ) * 10 ) //the *10 is to get a value in distance/seconds

    set udg_CurspeedTargDir = AngleBetweenPoints( CameraSetupGetDestPositionLoc( udg_CurspeedCamera[0] ), CameraSetupGetDestPositionLoc( udg_CurspeedCamera[1] ) )

    
    set udg_zz_DCCamSystem_CurspeedCamera[0] = udg_zz_DCCamSystem_CurspeedCamera[1]

Somehow it doesn't work properly: The speed output is way lower than the speed actually is and the direction is sometimes just zero.
Why does this occur? Any ideas to make a script that works reliable?
Thanks for help,
Waldbaer
#2
WaldbärLoop every 0.1 seconds:


please be more specific. How are you doing this loop? if it is what i suspect it is ( using TriggerSleepAction ) the actual wait will be around .27 seconds. ( to .6 seconds )
#3
No, it's this more or less exact working "Periodic event - every 0.1 seconds of game time".
#4
so its an event then?

well, srry, but i cant say i know.

why do you want the camera speed, anyways?
#5
I'm working on a camera system for easy and realistic smooth camera movement. One function e.g. should just brake the camera's movement and if you have a standard camera sway using "apply camera over x seconds", I don't know the speed to brake from. The rest is working quite well, but it would be nice if I could combine the normal GUI actions with it. :)