Sinusoid Motion

Sinusoid Motion via Script

I have example of Twister moving in sinusoid motion:

name IzWWind
type none
subject_to_wall 1
subject_to_platform 1
subject_to_hole 1
subject_to_minz 0
no_adjust_base  0
offscreenkill 200


anim idle
@script
    void self = getlocalvar("self"); //Get calling entity
    int Dir = getentityproperty(self, "direction");
    float Fram = getentityproperty(self, "animpos") + 1;
    float Vx = 1;
    float Vz = 2*cos(Fram*30);
   
    if(Dir==0){
      Vx = -Vx;
    }

    changeentityproperty(self, "velocity", Vx, Vz);
@end_script
loop 1
delay 6
offset  60 112
frame data/chars/WWind/IzWWind1.png
frame data/chars/WWind/IzWWind2.png
frame data/chars/WWind/IzWWind3.png
frame data/chars/WWind/IzWWind4.png
frame data/chars/WWind/IzWWind5.png
frame data/chars/WWind/IzWWind6.png #
frame data/chars/WWind/IzWWind1.png
frame data/chars/WWind/IzWWind2.png
frame data/chars/WWind/IzWWind3.png
frame data/chars/WWind/IzWWind4.png
frame data/chars/WWind/IzWWind5.png
frame data/chars/WWind/IzWWind6.png #

I believe you know how to modify non script stuffs so I'll just explain how to modify script to your need
  Blue number defines x velocity while green one defines z velocity. These 2 are the values you need to modify for your need
Another thing I should mention is number of frames. The script is designed to work with 12 frames (no less no more) so you might need to adjust your twister animation to suit that
However, if your twister animation has more frames than 12 but still in multiplies of 5 or 6 (such as 20, 24, 30 and 36), I can modify the script for that :D

HTH
 
Hello!
Sorry for the delay, i m' working a lot in the chosen one, and dont have much time.
First to all thanks for all your help.
Finally can test the script and crash with this error:
Code:
Script compile error: can't find function 'cos'

Script compile error in 'twister': cos line 12, column

Here my test script. :
Code:
name      twister
type      none
subject_to_wall   1
subject_to_platform 1
subject_to_hole 1
subject_to_minz 0
no_adjust_base  0
offscreenkill   200


anim idle
@script
    void self = getlocalvar("self"); //Get calling entity
    int Dir = getentityproperty(self, "direction");
    float Fram = getentityproperty(self, "animpos") + 1;
    float Vx = 1;
    float Vz = 2*cos(Fram*30);
   
    if(Dir==0){
      Vx = -Vx;
    }

    changeentityproperty(self, "velocity", Vx, Vz);
@end_script
   loop   1
   delay   6
   offset  60 112
   frame   data/chars/kitana/twister/wind301.png
   frame   data/chars/kitana/twister/wind302.png
   frame   data/chars/kitana/twister/wind303.png
   frame   data/chars/kitana/twister/wind304.png
   frame   data/chars/kitana/twister/wind305.png
   frame   data/chars/kitana/twister/wind306.png #
   frame   data/chars/kitana/twister/wind307.png
   frame   data/chars/kitana/twister/wind308.png
   frame   data/chars/kitana/twister/wind309.png
   frame   data/chars/kitana/twister/wind310.png
   frame   data/chars/kitana/twister/wind311.png
   frame   data/chars/kitana/twister/wind312.png #

I have a twister with 36 frames of animation. If you can make the changes in the script to work with this number of frames would be great. Thanks.
 
dantedevil said:
Hello!
Sorry for the delay, i m' working a lot in the chosen one, and dont have much time.
First to all thanks for all your help.
Finally can test the script and crash with this error:
Code:
Script compile error: can't find function 'cos'

Script compile error in 'twister': cos line 12, column

Update engine to OpenBOR v3.0 Build 4086
 
Thanks White Dragon!
Now work without crashing,  but the move of the twister is out of place.
When the twister moves down, can go out of the screen. The same when moves up, the twister pass through the z coords. This looks really bad.
The other problem, is when Kitana spawn the twister,  he goes to the right and up, down, up, down,  until leave the screen.
I want the movement of the twister like in the Ilusionista video, the Storm hurricane.
In this video the spawned hurricane moves in circles around of the screen,  and never moves out of Z coords.
 
Well... i try using the first script of this thread:
Code:
@script
   void self = getlocalvar("self");
   int counter;

        float x,z;

        if(frame==0)
        {
            counter = 0;
        }
        if (frame>0)
        {
            x = -sin(counter/1.45)*2;
            z = -cos(counter/1.45)/3;
            changeentityproperty(self, "velocity", x, z, 0) ;
            counter +=5;
        }
@end_script
And never works like in the Storm video.
And the same problems about Z coords still appear.
I test making changes in the values, and nothing close to the movement i want.
Someone can show a script example about this movement.
Thanks.
 
Try again and again changing values with the scripts in this thread and still moves bad.
Someone know wath missing here?
 
I told you before that you need to modify velocity values for your twister, if you want twister not to cross z borders, set smaller value such as 1 so it becomes this:

    float Vz = 1*cos(Fram*30);

I want the movement of the twister like in the Ilusionista video, the Storm hurricane.

Hmmm... try changing float Vx with this:

    float Vx = 2*cos(Fram*30);

Like before, you might need to find proper velocity for your purpose so don't hesitate to change blue colored number with lower or higher number :)
 
Thanks for your help Bloodbane!
Well... now with this change:
Code:
float Vz = 1*cos(Fram*30);
The twister only shows out of the screen , if Kitana is in the bottom of the screen.

I try changing the  float Vx, and only the velocity change. But the movement of the twister is always the same.
He goes to the right and down, up, down, until leave the screen.
To solve the problem with Z coords,  use this:
subject_to_minz 1
subject_to_maxz 1
Now the twister shows  perfect into the limits of the screen.
Now i only need to know how modify the script to reach the desired movement.
 
I think Ilusionista can show the right way for this problem. He make the hurricane for Storm in the video, so he have the knowledge.
Hey friend, can you give me a hand here?
I send you a PM some days ago, but not response.
 
Yes,  i try the two options of the first post.
Try changing the values,  and never work like in your video.
Next try with the script of Bloodbane,  and the same. Never moves like you show in the video.
 
O Ilusionista said:
Have you tried the codes I posted at the first post? There are two options there.

Can you post the animation of the hurricane of the Storm video?
I think is the best to understand how really works.
 
Sure:
name shurr
type none
shadow 0
nolife  1
remove 0



Antigravity 100
candamage enemy obstacle
subject_to_minz 1
subject_to_maxz 1

subject_to_wall 1
subject_to_hole 1
subject_to_obstacle 1
subject_to_platform 1
no_adjust_base 0

palette none
















anim follow2
delay 3
loop 0
offset 56 143
hitflash flash2
attack11 41 64 32 79 30 1 0 0 5 20
dropv 10 0.5
damageonlanding 10 1
@script
void self = getlocalvar("self");
        void time = openborvariant("elapsed_time");
        void mTime = time - (openborvariant("elapsed_time")-100);
        float a,x,y;
        x = -sin(time/1.45)*2;
        y = -cos(time/1.45)/3;
        changeentityproperty(self, "velocity", x, y, 0) ;
@end_script
drawmethod scalex 0.9
frame data/chars/misc/ahelper/proj/hur00.png
drawmethod scalex 0.8
frame data/chars/misc/ahelper/proj/hur01.png
drawmethod scalex 0.7
frame data/chars/misc/ahelper/proj/hur02.png
drawmethod scalxe 0.6
frame data/chars/misc/ahelper/proj/hur03.png
drawmethod scalex 0.5
frame data/chars/misc/ahelper/proj/hur04.png
drawmethod scalex 0.4
frame data/chars/misc/ahelper/proj/hur05.png
drawmethod scalex 0.3
frame data/chars/misc/ahelper/proj/hur06.png
drawmethod scalex 0.2
frame data/chars/misc/ahelper/proj/hur07.png
drawmethod scalex 0.1
frame data/chars/misc/ahelper/proj/hur08.png
@cmd killentity getlocalvar("self")
frame data/chars/misc/ahelper/proj/hur08.png

anim idle
delay 3
loop 1 9 19
offset 56 143
hitflash flash2
@script
void self = getlocalvar("self");
int Summon = getentityvar(self, 1);
        int time;

        float x,z;

        if(frame==0){
        //changeentityproperty(self,"blink",2);
        setentityvar(self, 1, openborvariant("elapsed_time"));
        time = 0;

        }
        if (frame==1){
        int Screen = openborvariant("hResolution")/2; // Get screen width
        int XPos = openborvariant("xpos");
        int Width = openborvariant("PLAYER_MIN_Z")+(openborvariant("PLAYER_MAX_Z") - openborvariant("PLAYER_MIN_Z")); // Get width
        changeentityproperty(self, "position", Screen+XPos-120, Width+1, 0);
        }
        if (frame>0)
        {
        x = sin(time/1.45)*2;
        z = cos(time/1.45)/2;
        changeentityproperty(self, "velocity", x, z, 0) ;
        time +=7;
        //setglobalvar("HelperControl", time);
        }

        if(Summon <= openborvariant("elapsed_time") - 1000){
        setentityvar(self, 1, NULL());
        performattack(self,openborconstant("ANI_FOLLOW2"));
        }


@end_script
frame none
attack11 41 64 32 79 50 1 1 0 5 20
dropv 10 0.5
damageonlanding 10 1
sound data/chars/misc/ahelper/proj/hurricane.wav
drawmethod scalex 0.2
frame data/chars/misc/ahelper/proj/hur01.png
drawmethod scalex 0.3
frame data/chars/misc/ahelper/proj/hur02.png
drawmethod scalxe 0.4
frame data/chars/misc/ahelper/proj/hur03.png
drawmethod scalex 0.5
frame data/chars/misc/ahelper/proj/hur04.png
drawmethod scalex 0.6
frame data/chars/misc/ahelper/proj/hur05.png
drawmethod scalex 0.7
frame data/chars/misc/ahelper/proj/hur06.png
drawmethod scalex 0.8
frame data/chars/misc/ahelper/proj/hur07.png
drawmethod scalex 0.9
frame data/chars/misc/ahelper/proj/hur08.png
nodrawmethod
frame data/chars/misc/ahelper/proj/hur09.png
frame data/chars/misc/ahelper/proj/hur00.png
frame data/chars/misc/ahelper/proj/hur01.png
frame data/chars/misc/ahelper/proj/hur02.png
frame data/chars/misc/ahelper/proj/hur03.png
frame data/chars/misc/ahelper/proj/hur04.png
frame data/chars/misc/ahelper/proj/hur05.png
frame data/chars/misc/ahelper/proj/hur06.png
frame data/chars/misc/ahelper/proj/hur07.png
frame data/chars/misc/ahelper/proj/hur08.png

#|edited by openBor Stats v 0.67
 
Thank you!
can you explain this part?
Code:
         if(Summon <= openborvariant("elapsed_time") - 1000){
         setentityvar(self, 1, NULL());
         performattack(self,openborconstant("ANI_FOLLOW2"));
         }

For it is the "ANI_FOLLOW2"?
I need to create?
 
Hmmm... Storm's hurricane has 2 phases. The first phase is when it is playing IDLE animation and 2nd one is FOLLOW2
The part you quoted is the script part to check if hurricane has played IDLE animation long enough. If it has, it will change to FOLLOW2 aka 2nd phase

If you want your twister to have 2 phases like this, then do the same but if not, use my suggestion above
 
I've been trying to use this script for animation level with fog, but the result of the animation is never very convincing.
Has anyone used it for this purpose or something like this?
 
Back
Top Bottom