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

Rotating/Swinging Doors Help

broken avatar :(
Created 6 years ago
by ville88
0 Members and 1 Guest are viewing this topic.
1,635 views
broken avatar :(
×
broken avatar :(
Location: rueurope
Date Registered: 2 January 2012
Last active: 2 months ago
Posts
303
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
ville88's Groups
Need to be able to add a custom sound to the script
I changed the name of the sound in the script but it does not work.
And need to change the speed of opening the door.
The script is very good but needs improvements

any ideas?

source:
https://ugx-mods.com/forum/index.php/topic,3849.msg41423.html#msg41423

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

/*
DuaLVII's Rotating Door Script v1
 - Standard Zombie Cost doors
 - Electric doors
 - Electric doors with zombie cost (players must get the electric on then pay to open it)
 - Runs on script_vector for easier use (x,y,z) = (rotate like normal, like a garage door, like a sliding door but it rolls to the side)
 - Like all other doors, Uses script_flag for zone setting
*/

config()
{
level.rotating_door_hint = "Press &&1 to open the door"; // Cost area will be added after by the script
level.rotating_door_electric_hint = "You need to turn the power on";
}

init()
{
config();
rotating_doors = GetEntArray("rotating_door", "targetname");
array_thread(rotating_doors,::rotating_door_init);
}

rotating_door_init()
{
iTarget = GetEntArray(self.target, "targetname");
for(i = 0; i < iTarget.size; i++)
{
iTarget[i] rotating_door_setup();
}
if( isDefined(self.script_flag) && !IsDefined( level.flag[self.script_flag] ))
{
flag_init( self.script_flag );
}
if(isDefined(self.script_noteworthy) && self.script_noteworthy == "electric_door")
{
self setHintString(level.rotating_door_electric_hint);
}
else
{
self setHintString( level.rotating_door_hint + " [Cost:" + self.zombie_cost + "]" );
}
self SetCursorHint( "HINT_NOICON" );
self thread rotating_door_think();
}

rotating_door_think()
{
iTarget = GetEntArray(self.target, "targetname");
while(1)
{
if(isDefined(self.script_noteworthy) && self.script_noteworthy == "electric_door" && !isDefined(self.zombie_cost))
{
flag_wait( "electricity_on" );
}
else
{
if(isDefined(self.script_noteworthy) && self.script_noteworthy == "electric_door")
{
flag_wait( "electricity_on" );
self setHintString( level.rotating_door_hint + " [Cost:" + self.zombie_cost + "]" );
}
self waittill( "trigger", player);
if(player in_revive_trigger())
{
continue;
}
if(is_player_valid(player))
{
if(player.score >= (self.zombie_cost - 1)) // -1 to remove the horrible glitch where a player needs 10 points more than the exact total needed
{
player maps\_zombiemode_score::minus_to_player_score( self.zombie_cost );
}
else
{
play_sound_at_pos( "no_purchase", self.origin);
continue;
}
}
}
for(i = 0; i < iTarget.size; i++)
{
if(isDefined(iTarget[i].script_sound))
{
play_sound_at_pos( iTarget[i].script_sound, self.origin );
}
else
{
play_sound_at_pos( "door_slide_open", self.origin );
}
if(!isDefined(iTarget[i].script_transition_time))
{
iTarget[i].script_transition_time = 1;
}
if(isDefined(iTarget[i].script_vector))
{
if(iTarget[i].script_vector[0] != 0) // DuaLVII :: script_vector = an array? huh
{
iTarget[i] RotateYaw( iTarget[i].script_vector[0], iTarget[i].script_transition_time, ( iTarget[i].script_transition_time * 0.5 ) );
}
if(iTarget[i].script_vector[1] != 0)
{
iTarget[i] RotatePitch( iTarget[i].script_vector[1], iTarget[i].script_transition_time, ( iTarget[i].script_transition_time * 0.5 ) );
}
if(iTarget[i].script_vector[2] != 0)
{
iTarget[i] RotateRoll( iTarget[i].script_vector[2], iTarget[i].script_transition_time, ( iTarget[i].script_transition_time * 0.5 ) );
}
}
iTarget[i] NotSolid();
array_thread(iTarget,::rotating_door_connect);
}
if( IsDefined( self.script_flag ) )
{
flag_set( self.script_flag );
}
triggers_related = GetEntArray(self.target, "target");
for(i = 0; i<triggers_related.size; i++)
{
triggers_related[i] disable_trigger();
}
break;
}
}

rotating_door_setup()
{
iTarget = GetEntArray(self.target, "targetname");
for(i = 0; i < iTarget.size; i++)
{
iTarget[i] linkto(self);
iTarget[i] disconnectpaths();
}
}

rotating_door_connect()
{
iTarget = GetEntArray(self.target, "targetname");
for(i = 0; i < iTarget.size; i++)
{
iTarget[i] NotSolid();
iTarget[i] connectpaths();
}
}
Last Edit: October 27, 2017, 11:40:58 am by ville88
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 3 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
The script already has code for adding both custom sounds as well as a custom rotate speed.

If you add these to KVPs on the door itself and not the trigger it will change these behaviors
Code Snippet
Plaintext
Key: script_sound Value: custom_sound
and
Code Snippet
Plaintext
Key: script_transition_time Value: 2 //will take 2 seconds to rotate
broken avatar :(
×
broken avatar :(
Location: rueurope
Date Registered: 2 January 2012
Last active: 2 months ago
Posts
303
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
ville88's Groups
this does not work

Last Edit: October 27, 2017, 12:31:34 pm by ville88
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 3 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
it does not work on which part? it doesnt modify the speed of the door or doesnt play the custom sound?

if its the sound i would say that the sound isn't being loaded into the .ff of your map/mod correctly
broken avatar :(
×
broken avatar :(
Location: rueurope
Date Registered: 2 January 2012
Last active: 2 months ago
Posts
303
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
ville88's Groups
door opening slow (speed change not work) custom sound not paly but Instead of it, the standard sound plays

 
Loading ...