• All, I am currently in the process of migrating domain registrations. During this time there may be some intermittent outages or slowdowns. Please contact staff if you have any questions.

OpenBOR v3.0 Build 4129 for Windows/Linux/Wii

Status
Not open for further replies.
Quake doesnt work if you dont have enough frames in animation to shake anymore, so if your quake takes 5 frames and animation1 has only 4 then quake wont work during animation2.
 
bWWd said:
Quake doesnt work if you dont have enough frames in animation to shake anymore, so if your quake takes 5 frames and animation1 has only 4 then quake wont work during animation2.

My quake work on updated.c
Code:
void quake() {
    int loop = getglobalvar("quake_loop");
    int refresh_time = getglobalvar("quake_refreshtime");
    int intensity = getglobalvar("quake_intensity");

    if ( loop != NULL() && refresh_time != NULL() && intensity != NULL() && openborvariant("in_level") ) {
        int time = openborvariant("elapsed_time");
        int ETA = refresh_time*loop;

        if ( getlocalvar("finish_quake_time") == NULL() ) setlocalvar("finish_quake_time",get_next_time(ETA));

        if ( time%refresh_time == 0 ) {
            changelevelproperty("quake", intensity);

            if ( loop > 0 ) --loop;
            else loop = NULL();
            if ( time > getlocalvar("finish_quake_time") ) loop = NULL();

            setglobalvar("quake_loop", loop);

            if ( loop == NULL() ) {
                setglobalvar("quake_refreshtime", NULL());
                setglobalvar("quake_intensity", NULL());
                setlocalvar("finish_quake_time", NULL());
            }
        }
        if ( time > getlocalvar("finish_quake_time") ) {
            setglobalvar("quake_loop", NULL());
            setglobalvar("quake_refreshtime", NULL());
            setglobalvar("quake_intensity", NULL());
            setlocalvar("finish_quake_time", NULL());
        }
    } // fine if loop
}

using changelevelproperty("quake", intensity);
but it doesnt work anywhere...
 
White Dragon said:
My quake work on updated.c

[...]

using changelevelproperty("quake", intensity);
but it doesnt work anywhere...

Hey, cool function you got there White Dragon, I wondered and struggled on how to effectively use the quake level property so as to generate quake via script. Hope it'll work again then.

Edit : Tested the function with this build, and while it doesn't give the same consistent results as with older versions of the engine, it does quake nonetheless.

Edit 2 : Here's an alternate version that doesn't involve modifying elapsed_time nor the engine updating on every centisecond. Seems to work better that way with the new build.

Code:
void quake() {
    int loop = getglobalvar("quake_loop");
    int refresh_time = getglobalvar("quake_refreshtime");
    int intensity = getglobalvar("quake_intensity");

    if ( loop != NULL() && refresh_time != NULL() && intensity != NULL() && openborvariant("in_level") ) {
        int currentTime = openborvariant("elapsed_time");
	
	int lastQuakeTime = getlocalvar("last_quake_time");


	if (lastQuakeTime == NULL() || currentTime - lastQuakeTime >= refresh_time ) {
	    log("\nQuake !");
            changelevelproperty("quake", intensity);
	    setlocalvar("last_quake_time", currentTime );

            if ( loop > 1 ) --loop;
            else loop = NULL();

            setglobalvar("quake_loop", loop);

            if ( loop == NULL() ) {
                setglobalvar("quake_refreshtime", NULL());
                setglobalvar("quake_intensity", NULL());
		setlocalvar("last_quake_time", NULL());
            }
        }
        
    } // fine if loop
}
 
Status
Not open for further replies.
Back
Top Bottom