UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Vertasea

 
======================================================================================
A SCRIPT
BY: VERTASEA
    ======================================================================================
ROTATE MULTIPLE ENTITIES
This script can handle multiple rotating ents.
======================================================
Features that can be set via kvp:
Choose rotation direction.
Set rotation speed.
Require power to rotate/ or rotate without power.
Play a looping sound on the rotating ent.


USES:
This script would be good to add to a map with ceiling fans, vent fans, or if you want props to rotate like the gif above.
If you want anything to rotate in your map this is a easy way to do it.

Instructions:

In Radiant add a script_model or a script_brushmodel.
Besure to look at the script doc within the script to see what all kvp to add to your script_model or script_brushmodel.


Thread this function inside of mapname.gsc in main() UNDER maps\_zombiemode::main();

Code Snippet
cs
// Rotate entitys
level thread get_rotate_ents();
Copy this and paste it at the bottom of mapname.gsc
Code Snippet
cs
/*============================== SCRIPT DOC BEGIN ==============================//

REQUIRED: "targetname" = "rotate_ent" // Must be a script_model or a script_brushmodel
REQUIRED: "script_noteworthy" = "DIR" // DIR = Direction  - Choose "pitch", "roll", or "yaw"

OPTIONAL: "script_transition_time" = "NUMBER" // NUMBER = Any number you want in seconds. Lower the number = faster rotation. Lowest number is 0.05
OPTIONAL: "script_string" = "needs_power" // Don't add this kvp if you want it to rotate when the game starts
OPTIONAL: "script_sound" = "sound_alias_name" // If you want a sound to play from the ent make sure it's 3D and LOOPING

//=============================== SCRIPT DOC END ===============================*/

get_rotate_ents() {

    e_models = GetEntArray("rotate_ent", "targetname");

    for(i = 0; i < e_models.size; i++) {

        e_models[i] thread handle_rotating_ents();
    }
}

handle_rotating_ents() {

    if(!isdefined(self.script_noteworthy)) {
        return;
    }
    if(isdefined(self.script_transition_time)) {
        time = self.script_transition_time;
    }else{
        time = 1;
    }
    if(isdefined(self.script_string) && self.script_string == "needs_power") {
        flag_wait("electricity_on"); // wait for power
    }
    if(isdefined(self.script_sound)) {
        self PlayLoopSound( self.script_sound );
    }
   
    while (true) {

        switch(self.script_noteworthy) {

            case "pitch":
                self RotatePitch(360, time);
                break;
            case "yaw":
                self RotateYaw(360, time);
                break;
            case "roll":
                self RotateRoll(360, time);
                break;
        }
        wait(time - .1);
    }
}

If you use this a credit would be appreciated thanks.
If you find any bugs or have any issues please let me know.
4 years ago
Loading ...