Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Gate building function in Radiation (Confirmed)
#1
Do anyone know WTF is this?
It is _elevator.gsc
Code:
/*
Elevators and You: A Consice Guide.
Bloodlust

First place a script_model or create a script_brushmodel to be used for the elevator platform.

Make a trigger_use if you want a switch operated elevator.
Make a trigger_multiple if you want a Quake style elevator.

Give this trigger a targetname of elevator_trigger.

If making a switch operated elevator, place a script_model or script_brushmodel in the map where you want the switch.
Make the trigger target the newly created switch entity.

If making a Quake style elevator, make the trigger target the elevator platform entity.

Place a script_struct dead center of the platform entity at the bottom point in the platform's route.
Place a script_struct dead center of the platform entity at the next point in the platform's route.
Continue placing script_structs dead center of the platform entity at the next point in the platform's route.
These can be placed in any direction, not just straight up and down. Just ensure the platform will center on them.

Give the bottom script_struct a script_noteworthy of platform_start.
Make the platform entity target this script_struct.
Make this script_struct target the next script_struct in the elevator's path.
Continue making the elevator's path by targeting the path script_structs to eachother.


Optional:

If you want to play hydraulic or machinery sounds for the elevator, place a script_struct where you want the sound to play.
Make the platform target this script_struct.
Give this script_struct a script_noteworthy of audio_point.
Define a variable in your level script of level.scr_sound["description"] = "actual_sound_alias".
The "description" can be any description you want to use, such as "hydraulics".
the "actual_sound_alias" must be an actual sound alias defined in your level's csv or a common csv.
Give this script_struct a script_sound of whatever you defined as "description".
You can place as many script_structs this way as you want.


Optional:

If you want an alarm sound to play when the elevator is activated, place a script_model or script_brushmodel where you want the sound to play.
Make the platform target this entity.
Give this entity a script_noteworthy of elevator_klaxon_speaker.
Define a variable in your level script of level.scr_sound["description"] = "actual_sound_alias".
The "description" can be any description you want to use, such as "alarm_sound".
the "actual_sound_alias" must be an actual sound alias defined in your level's csv or a common csv.
Give this entity a script_sound of whatever you defined as "description".
You can place as many entities this way as you want.


Optional:

If you want a gate or gates to animate when the elevator is activated, place a script_model or script_brushmodel to use as the gate.
Do NOT rotate the gate or place it where you want the gate to be. This will be handled by the _elevator.gsc utility script.
Make the platform target this gate.
Give this gate a script_noteworthy of elevator_gate.
Give this gate a script_int equal to the amount of degrees you want it to rotate, ie: 90
Place a script_struct where you want the gate to be centered and have the gate target this script_struct.
Rotate this script_struct in the direction you want the gate to move.
You can place as many gates per elevator this way as you want.

Define a variable in your level script of level.scr_sound["description"] = "actual_sound_alias".
The "description" can be any description you want to use, such as "gate_rotate".
the "actual_sound_alias" must be an actual sound alias defined in your level's csv or a common csv.
Give this gate a script_sound of whatever you defined as "description".


Optional:

If you dont specify a speed for your elevator platform in Radiant, it will default to 100.
To set the speed, make a K/V pair of speed / 100 (or whatever speed you want).
Each individual platform can have a different speed set to it if you want.
This is the speed of the platform in MPH.
Do not set a speed K/V pair on the script_struct that the platform targets;
set it on THAT script_struct's target instead.
You can then set any positive whole number value for speed on the rest of the script_structs that make up the elevator's path if you want to.

If you dont specify a speed for your elevator platform gates in Radiant, it will default to 1.
This is how many seconds the platform gates, if you included any in your level, will take to rotate when they are raised or lowered.
To set the speed, make a K/V pair of speed / 1 (or whatever speed you want).
This speed should be defined in seconds, not actual speed in MPH like the platforms.
This speed must also be a whole number, no fractions!

If you dont specify an amount of degrees for your elevator platform gates to rotate in Radiant, it will default to 90.
To set the desired amount of angles, make a K/V pair of script_int / 90 (or whatever angle you want).
Each individual platform can have a different angle set to it if you want.


Notes of Interest:

Platforms and platform switches must be either a script_model or a script_brushmodel.
You can use a prefab for the platform that actually moves, but you must stamp it into your level.
You cannot have a trigger or switch target a prefab.

You can setup the elevator and all its parts, then save this as a prefab, and copy and paste
this prefab into the level where ever you want to. Be certain that your platform triggers inside the prefab retain their
targetname of elevator_trigger though, as it may change when you make the prefab and paste it around the level.
*/

#include maps\mp\_utility;
#include common_scripts\utility;
init()
{
    platform_triggers = getEntArray("elevator_trigger", "targetname");
    if(platform_triggers.size <= 0)
    {
        return;
    }
    
    platform_switches = [];
    platforms_non_switched = [];
    platforms_total = [];
    trigger_target_targets = [];
    
    for(i = 0; i < platform_triggers.size; i++)
    {
        trigger_target = getEnt(platform_triggers[i].target, "targetname");
        
        if(!isDefined(trigger_target))
        {
            AssertMsg("This trigger does not have a target: " + platform_triggers[i].origin);
        }
        
        // does the trigger target a switch model or just a platform?
        if(isDefined(trigger_target))
        {
            trigger_target_targets = getEntArray(trigger_target.target, "targetname");
            
            // if the trigger's target has only 1 target, then the trigger is targeting a switch model, not a platform
            if(isDefined(trigger_target_targets) && (trigger_target_targets.size == 1))
            {
                platform_switches[platform_switches.size] = trigger_target;
            }
            else
            {
                platforms_non_switched[platforms_non_switched.size] = trigger_target;
            }
        }
    }

    for(i = 0; i < platform_switches.size; i++)
    {
        platform = getEnt(platform_switches[i].target, "targetname");
        
        if(!isDefined(platform))
        {
            AssertMsg("This switch does not target a platform: " + platform_switches[i].origin);
        }
        else
        {
            counter = 0;
            
            for(x = 0; x < platforms_total.size; x++)
            {
                if(platform == platforms_total[x])
                {
                    counter++;
                }
            }
            
            if(counter > 0)
            {
                continue;
            }
            else
            {
                platforms_total[platforms_total.size] = platform;
            }
        }
    }
    
    for(i = 0; i < platforms_non_switched.size; i++)
    {
        counter = 0;
        
        for(x = 0; x < platforms_total.size; x++)
        {
            if(platforms_non_switched[i] == platforms_total[x])
            {
                counter++;
            }
        }
        
        if(counter > 0)
        {
            continue;
        }
        else
        {
            platforms_total[platforms_total.size] = platforms_non_switched[i];
        }
    }
    
    array_thread(platforms_total, ::define_elevator_parts);
}

// self = the platform
define_elevator_parts()
{
    audio_points = [];
    klaxon_speakers = [];
    elevator_gates = [];
    platform_start = undefined;
    
    platform = self;
    platform_name = platform.targetname;
    platform.at_start = true;
    
    platform_triggers = [];
    targets_platform = getEntArray(platform_name, "target");
    
    
    for(i = 0; i < targets_platform.size; i++)
    {
        if(targets_platform[i].classname == "script_model" || targets_platform[i].classname == "script_brushmodel")
        {
            switch_trigger = getEnt(targets_platform[i].targetname, "target");
            platform_triggers[platform_triggers.size] = switch_trigger;
        }
        else
        {
            platform_triggers[platform_triggers.size] = targets_platform[i];
        }
    }
    
    platform_targets_Ents = getEntArray(platform.target, "targetname");
    platform_targets_Structs = getStructArray(platform.target, "targetname");    
    platform_targets = array_combine(platform_targets_Ents, platform_targets_Structs);
    
    if(platform_targets.size <= 0)
    {
        AssertMsg("This platform does not have any targets: " + platform.origin);
    }
            
    if(isDefined(platform_targets))
    {
        for(i = 0; i < platform_targets.size; i++)
        {
            if(isDefined(platform_targets[i].script_noteworthy))
            {
                if(platform_targets[i].script_noteworthy == "audio_point")
                {
                    audio_points[audio_points.size] = platform_targets[i];
                }
                
                if(platform_targets[i].script_noteworthy == "elevator_gate")
                {
                    elevator_gates[elevator_gates.size] = platform_targets[i];
                }
                
                if(platform_targets[i].script_noteworthy == "elevator_klaxon_speaker")
                {
                    klaxon_speakers[klaxon_speakers.size] = platform_targets[i];
                }
                                
                if(platform_targets[i].script_noteworthy == "platform_start")
                {
                    platform_start = platform_targets[i];
                }
            }
        }
    }
    
    if(!isDefined(platform_start))
    {
        AssertMsg("This platform does not target a script_struct with a script_noteworthy of platform_start: " + platform.origin);
    }
    
    if(isDefined(elevator_gates) && (elevator_gates.size >0))
    {
        array_thread(elevator_gates, ::setup_elevator_gates, platform_name);
    }
    
    if(isDefined(klaxon_speakers) && (klaxon_speakers.size >0))
    {
        array_thread(klaxon_speakers, ::elevator_looping_sounds, "elevator_" + platform_name + "_move", "stop_" + platform_name + "_movement_sound");
    }
    
    if(isDefined(audio_points) && (audio_points.size >0))
    {
        array_thread(audio_points, ::elevator_looping_sounds, "start_" + platform_name + "_klaxon", "stop_" + platform_name + "_klaxon");
    }
    
    array_thread(platform_triggers, ::trigger_think, platform_name);
    
    platform thread move_platform(platform_start, platform_name);
}

// each seperate platform trigger in the level is run through this function
// self = the trigger
trigger_think(platform_name)
{
    while(1)
    {
        self waittill("trigger");
        
        // start the platform motion klaxon alarm
        level notify("start_" + platform_name + "_klaxon");
        
        wait 2;
        
        // start the platform moving
        level notify("elevator_" + platform_name + "_move");
        
        level waittill("elevator_" + platform_name + "_stop");
        
        // stop the platform motion klaxon alarm
        level notify("stop_" + platform_name + "_klaxon");
    }
}

// play any looping sounds if its defined by self.script_sound
// self = the entity to play the sound at its origin
elevator_looping_sounds(notify_play, notify_stop)
{
    level waittill(notify_play);
    
    if(isDefined(self.script_sound))
    {
        self thread loop_sound_in_space(level.scr_sound[self.script_sound], self.origin, notify_stop);
    }
}

// self = the gate
setup_elevator_gates(platform_name)
{
    struct = getStruct(self.target, "targetname");
    if(!isDefined(struct))
    {
        AssertMsg("This gate does not target a script_struct: " + self.origin);
    }
    
    self.origin = struct.origin;
    self.angles = struct.angles;
    
    self thread move_elevator_gates(platform_name, "raise_");
    self thread move_elevator_gates(platform_name, "lower_");
}

// self = the gate
move_elevator_gates(platform_name, direction)
{
    // amount of degrees to rotate the gate
    amount = undefined;
    // speed at which to rotate the gate
    speed = undefined;
    
    if(isDefined(self.script_int))
    {
        amount = (self.script_int);
    }
    else
    {
        amount = (90);
    }
    
    if(direction == "raise_")
    {
        amount = (amount * -1);
    }
    
    if(isDefined(self.script_delay))
    {
        speed = self.script_delay;
    }
    else
    {
        speed = 1;
    }
    
    while(1)
    {
        level waittill(direction + platform_name + "_gates");
        self rotatePitch(amount, speed);
    }
}

// self = the platform
move_platform(platform_start, platform_name)
{
    move_up = [];
    move_down = [];
    
    move_up[move_up.size] = platform_start;
    
    platform_start_first_target = getStruct(platform_start.target, "targetname");
    
    if(!isDefined(platform_start_first_target))
    {
        AssertMsg("This platform start point does not have a script_struct target to move to. There needs to be at least two script_structs to make a path for the elevator to move along: " + platform_start.origin);
    }
    
    path = true;
    pstruct = platform_start;
    
    while(path)
    {
        if(isDefined(pstruct.target))
        {
            pstruct = getStruct(pstruct.target, "targetname");
        
            if(isDefined(pstruct))
            {
                move_up[move_up.size] = pstruct;
            }
        }
        else
        {
            path = false;
        }
    }
    
    for(i = move_up.size - 1; i >= 0; i--)
    {
        move_down[move_down.size] = move_up[i];
    }
    
    while(1)
    {
        level waittill("elevator_" + platform_name + "_move");
        
        wait 2;
        
        if(isDefined(level.scr_sound["elevator_start"]))
        {
            self playSound(level.scr_sound["elevator_start"]);
        }
        
        if(self.at_start)
        {
            speed = -1;
            
            for(i = 0; i < move_up.size; i++)
            {
                org = move_up[i + 1];
                
                if(isDefined(org))
                {
                    speed = get_speed(org, speed);
                    
                    // convert speed to a time
                    time = distance(self.origin, org.origin) / speed;
                    self moveto(org.origin, time);
                    wait time;
                }
            }
            
            // play any metal screeching / groaning sounds if assigned
            if(isDefined(self.script_sound))
            {
                self playSound(level.scr_sound[self.script_sound]);
            }
            
            level notify("elevator_" + platform_name + "_stop");
            level notify("stop_" + platform_name + "_movement_sound");    
            level notify("stop_" + platform_name + "_klaxon");
            level notify("lower_" + platform_name + "_gates");
            
            if(isDefined(level.scr_sound["elevator_end"]))
            {
                self playSound(level.scr_sound["elevator_end"]);
            }
            
            self.at_start = false;
        }
        else
        {
            level notify("raise_" + platform_name + "_gates");
            
            wait 2;
            
            level notify("elevator_" + platform_name + "_move");
            
            if(isDefined(level.scr_sound["elevator_start"]))
            {
                self playSound(level.scr_sound["elevator_start"]);
            }
            
            speed = -1;
            
            for(i = 0; i < move_down.size; i++)
            {
                org = move_down[i + 1];
                
                if(isDefined(org))
                {
                    speed = get_speed(org, speed);
                    
                    // convert speed to a time
                    time = distance(self.origin, org.origin) / speed;
                    self moveto(org.origin, time);
                    wait time;
                }
            }
            
            // play any metal screeching / groaning sounds if assigned
            if(isDefined(self.script_sound))
            {
                self playSound(level.scr_sound[self.script_sound]);
            }

            level notify("elevator_" + platform_name + "_stop");
            level notify("stop_" + platform_name + "_movement_sound");    
            level notify("stop_" + platform_name + "_klaxon");
            
            if(isDefined(level.scr_sound["elevator_end"]))
            {
                self playSound(level.scr_sound["elevator_end"]);
            }
            
            self.at_start = true;
        }
    }
}

// check if a speed is defined on the current path point script_struct
get_speed(path_point, speed)
{
    if(speed <= 0)
    {
        speed = 100;
    }
    
    if(isDefined(path_point.speed))
    {
        speed = path_point.speed;
    }
    
    return speed;
}

It is the answer from toobanooba in MPGH:
Quote:[Image: mapihw.png]
Now in this image. the red circles on the map indicate where the button is to activate the doors on the map, their are 2 buttons you can press on either side of the door, the door is the square orange part, where you can jump down to the lower level but you cant jump back up, you can only take the ladders, you can continue to close and open as many times you want, as long as you dont get killed lol, and btw those green dots is where the buttons should be located. like a console crane button thingy. =)
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#2
Elevators and You ? ....what a bunch of fcks.... sorry m8 to much txt xD

it's say's some stuff about creating an elevator..

example mw2:
Code:
the init stuff
level.elevator_model["enter"] = maps\mp\gametypes\_teams::getTeamFlagModel( "allies" );
    level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );
precacheModel( level.elevator_model["enter"] );
    precacheModel( level.elevator_model["exit"] );


and the function
Code:
CreateElevator(enter, exit, angle, notantycamp)
{
        if(!isDefined(notantycamp)) notantycamp = true;
        if(notantycamp) {
            flag = spawn( "script_model", enter );
            flag setModel( level.elevator_model["enter"] );
            wait 0.01;
            flag = spawn( "script_model", exit );
            flag setModel( level.elevator_model["exit"] );
        }
        wait 0.01;
        self thread ElevatorThink(enter, exit, angle);
}  

ElevatorThink(enter, exit, angle)
{
        self endon("disconnect");
        while(1)
        {
                foreach(player in level.players)
                {
                        if(Distance(enter, player.origin) <= 90){
                                player SetOrigin(exit);
                                player SetPlayerAngles(angle);
                        }
                }
                wait .25;
        }
}

well i think u just need to adjust the code a bit and woop! like model's ect.
if it doesnt work to let me know Wink


example :
mw2
Code:
level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );

BO
Code:
level.elevator_model["exit"] = maps\mp\gametypes\_elevator::getTeamFlagModel( "axis" ); //im not sure xDD about getTeamFlagModel
i changed _teams to _elevator cuz u said u found it there Wink

Reply

#3
(11-19-2010, 11:45)TheSaboteur Wrote: Elevators and You ? ....what a bunch of fcks.... sorry m8 to much txt xD

it's say's some stuff about creating an elevator..

example mw2:
Code:
the init stuff
level.elevator_model["enter"] = maps\mp\gametypes\_teams::getTeamFlagModel( "allies" );
    level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );
precacheModel( level.elevator_model["enter"] );
    precacheModel( level.elevator_model["exit"] );


and the function
Code:
CreateElevator(enter, exit, angle, notantycamp)
{
        if(!isDefined(notantycamp)) notantycamp = true;
        if(notantycamp) {
            flag = spawn( "script_model", enter );
            flag setModel( level.elevator_model["enter"] );
            wait 0.01;
            flag = spawn( "script_model", exit );
            flag setModel( level.elevator_model["exit"] );
        }
        wait 0.01;
        self thread ElevatorThink(enter, exit, angle);
}  

ElevatorThink(enter, exit, angle)
{
        self endon("disconnect");
        while(1)
        {
                foreach(player in level.players)
                {
                        if(Distance(enter, player.origin) <= 90){
                                player SetOrigin(exit);
                                player SetPlayerAngles(angle);
                        }
                }
                wait .25;
        }
}

well i think u just need to adjust the code a bit and woop! like model's ect.
if it doesnt work to let me know Wink


example :
mw2
Code:
level.elevator_model["exit"] = maps\mp\gametypes\_teams::getTeamFlagModel( "axis" );

BO
Code:
level.elevator_model["exit"] = maps\mp\gametypes\_elevator::getTeamFlagModel( "axis" ); //im not sure xDD about getTeamFlagModel
i changed _teams to _elevator cuz u said u found it there Wink
This is not the elevator(teleporter) from MW2...I think it is a real elevator
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#4
well that explains alot Wink

it's not new me math also discovered one in highrise(*mw2) ill ask him =D
but hes not home yet...
Reply

#5
(11-19-2010, 12:02)TheSaboteur Wrote: well that explains alot Wink

it's not new me math also discovered one in highrise(*mw2) ill ask him =D
but hes not home yet...
When I read through the intro, I think of this:
- Teleporter can't have a path
- Teleporter can't have a trigger
- Teleporter can't have machinery sounds
- Teleporter can't have an alarm sound
- Teleporter can't have a gate
- Teleporter can't have a platform
- Teleporter have parts LOL


(11-19-2010, 12:02)TheSaboteur Wrote: well that explains alot Wink

it's not new me math also discovered one in highrise(*mw2) ill ask him =D
but hes not home yet...
Wish u can help


I think iModBlackOps will be happy of this
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#6
Code:
You can setup the elevator and all its parts, then save this as a prefab, and copy and paste
this prefab into the level where ever you want to. Be certain that your platform triggers inside the prefab retain their
targetname of elevator_trigger though, as it may change when you make the prefab and paste it around the level.


prefab whahaah xD funny word


i think they also failed in creating function's...

@ topic
like it say's paste the prefab in the map u want it... maybe u found something in some maps... or they deleted it...
Reply

#7
(11-19-2010, 12:33)TheSaboteur Wrote:
Code:
You can setup the elevator and all its parts, then save this as a prefab, and copy and paste
this prefab into the level where ever you want to. Be certain that your platform triggers inside the prefab retain their
targetname of elevator_trigger though, as it may change when you make the prefab and paste it around the level.


prefab whahaah xD funny word


i think they also failed in creating function's...

@ topic
like it say's paste the prefab in the map u want it... maybe u found something in some maps... or they deleted it...
I can't see any elevator in the map...They actually deleted it...But it seems to be a gift
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#8
The name elevator for the teleports everyone used is the wrong name anyways.
I actually thought it would be real elevators. and this was already possible in mw2, waw, mw, cod2, uo, cod, quake3, quake2, quake
Reply

#9
(11-19-2010, 12:53)SuperNovaAO Wrote: The name elevator for the teleports everyone used is the wrong name anyways.
I actually thought it would be real elevators. and this was already possible in mw2, waw, mw, cod2, uo, cod, quake3, quake2, quake
It is real elevator i think...Platform and gates...This shouldn't be in teleporters...But finally there are code and a detail guide, so anyone can understand these code?

[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#10
This is maybe in the zombie in SP the elevators.....
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Help Function Fire dargula 1 2,167 10-31-2013, 23:03
Last Post: Nekochan
  Black Ops II IWI block decompression/decryption function kokole 7 5,475 12-07-2012, 22:53
Last Post: master131
  [Release] Kill Confirmed - BO - BetaV0.2 rotceh_dnih 32 20,133 08-23-2012, 06:57
Last Post: rotceh_dnih
  [CPMAP]Radiation Remake alistair3149 12 10,970 08-12-2012, 07:39
Last Post: Pozzuh
  [News] Black Ops 2 - Ranked Dedi Server Confirmed Tomsen1410 11 5,778 06-17-2012, 07:17
Last Post: Pozzuh
  [News] Black ops 2 confirmed! Pozzuh 35 15,869 05-02-2012, 11:35
Last Post: kokole
  Help [C#] Function pointer? Pozzuh 3 3,870 03-31-2012, 22:26
Last Post: crAyon
  Preview Kill Confirmed - BO rotceh_dnih 17 8,611 03-25-2012, 14:36
Last Post: Xzite
Lightbulb [News] if you need help upgradeing your pc or building a new one read:) rawr-saours 5 3,444 03-18-2012, 15:52
Last Post: d0h!
  Help 2 function Run raminr63 4 2,827 02-23-2012, 14:42
Last Post: Yamato

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.