Jump to content

Share your scripts


Recommended Posts

Scripts to move actors. Useful for doors and switches. As seen in my videos:

https://youtube.com/@MikeTMike

SLIDE

script "SLIDE" (int Angle, int Distance, int Thing)
{
    PlaySound(Thing,"SOUND");
        for (int i = 0; i <Distance; i++)
        {
            ThrustThing(Angle,4,0,Thing);
            Delay(1);
            Thing_Stop(Thing);
        }
}

On line 10, the 4 determines the speed, but you need to adjust the distance in the thing properties. (2nd arg.).
The lines at the bottom are just if you have monsters on the other side of the door. Models dont block visibility and offer limited collision.
The "sound" is a place holder. Just put the name of your sound, as defined in SNDINFO.

ROLL and PITCH

script "ROLL" (int Angle, int Thing)
{
    while (Angle-- > 0)
    {
        SetActorRoll (Thing, GetActorRoll (Thing) + 0.01);
        Delay (1);
    }
}

script "PITCH" (int Angle, int Thing)
{
    while (Angle-- > 0)
    {
        SetActorPitch (Thing, GetActorPitch (Thing) + 0.01);
        Delay (1);
    }
}
A way to create swinging levers for switches. replace "ROLL" with "PITCH" to change it from side to side, to back and forth. good also for lids that open like a chest.

UP AND DOWN

script "UP" (int Distance, int Thing)
{
    PlaySound(Thing,"SOUND");
        for (int i = 0; i <Distance; i++)
        {
            ThrustThingZ(Thing,8,0,1);
            Delay(1);
            Thing_Stop(Thing);
        }
        PlaySound(Thing,"SOUND");
}

script "DOWN" (int Distance, int Thing)
{
    PlaySound(Thing,"SOUND");
        for (int i = 0; i <Distance; i++)
        {
            ThrustThingZ(Thing,4,1,1);
            Delay(1);
            Thing_Stop(Thing);
        }
        PlaySound(Thing,"SOUND");
}

These actions are good for lifts and to deploy bridges, or to lift fancy doors you create as models. Sold platforms, if theyre square, will be fully solid. Sadly, if you stop them, they break. They need something that checks for obstructions, but my knowledge is not that extensive. (I dunno how to do it. Yet.)

PUSH

script "PUSH" (int Angle)
{
    ThrustThing(Angle,4,0,0);
}

I use this for when a swinging door opens towards me. I get pushed away, so the door doesnt go through me, and it looks like the door is pushing me.

"Angle" is:

Right = 0

Left = 128

Up = 64

Down = 192

SWING

script "SWING" (int Angle, int Thing, int Line)
{
    while (Angle-- > 0)
    {
        SetActorAngle (Thing, GetActorAngle (Thing) + 0.01); //To reverse direction, change the + into a -.
        Delay (1);
    }

Here, "Angle" is:

100 = 360 Degrees
50 = 180 Degrees    
25 = 90 Degrees

 

Hope you find this useful 🤞

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...