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

automatic door script advice

HOT
broken avatar :(
Created 10 years ago
by sgray97
0 Members and 1 Guest are viewing this topic.
3,844 views
broken avatar :(
×
broken avatar :(
Location: usearth
Date Registered: 3 January 2014
Last active: 3 years ago
Posts
12
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
Kill all the Zombies :D
×
sgray97's Groups
sgray97's Contact & Social Links
i just set up a basic door movement script and have a some questions about how to  make it truly "automatic" like for example if a player is in the radius of the trigger the movement will occur.



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

main()
{
thread auto_door();
}

auto_door()
{
auto = GetEnt( "auto_door", "targetname" );
auto1 = GetEnt( "auto_door1", "targetname" );
auto_trigger = GetEnt( "auto_trig", "targetname");

auto_trigger waittill ("trigger", user);

auto movex(-50, 6); 
auto1 movex(50, 6);

wait 3;
auto movex(25, 6); 
auto1 movex(-25, 6);

wait 3;

thread auto_door();
}

this is one of my first few scripts and i would like some advice to improve my scripting any help will be appreciated and credit given
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
I don't see anyway to really improve it besides using getentarray() so you can have more than one "automatic" door. For what your trying to do in your code you can't simplify it any.

But you don't need

Code Snippet
Plaintext
waittill ("trigger", user);

the "user" in this unless you need to specify who is triggering the entity.
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 6 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Make it a while or a for loop (while( true ) preferably) and check if the door is moving if it is pull it back again so player doesn't have to wait (unless you want to). Currently you're only making it only run once.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Make it a while or a for loop (while( true ) preferably) and check if the door is moving if it is pull it back again so player doesn't have to wait (unless you want to). Currently you're only making it only run once.

It is looping. He just didn't use a while() or for() loop on it.

Calling the same function within itself will loop it.
broken avatar :(
×
broken avatar :(
Location: usearth
Date Registered: 3 January 2014
Last active: 3 years ago
Posts
12
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
Kill all the Zombies :D
×
sgray97's Groups
sgray97's Contact & Social Links
i wanted to have the doors open without having to use F key to open it maybe use a trigger_radius would that do that?
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
i wanted to have the doors open without having to use F key to open it maybe use a trigger_radius would that do that?

I don't know about trigger radius's, but i know a trigger_multiple will work for that.
broken avatar :(
×
broken avatar :(
Location: usearth
Date Registered: 3 January 2014
Last active: 3 years ago
Posts
12
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
Kill all the Zombies :D
×
sgray97's Groups
sgray97's Contact & Social Links
alright thanks ill try that is there a way to reduce the stock radius of the trigger maybe use KvP "radius" "#"
broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 15 March 2014
Last active: 5 years ago
Posts
214
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
WaW Scriptor
Signature
WaW Scriptor
×
PROxFTW's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
PROxFTW's Contact & Social LinksPROxFTWPROxFTWPROxFTWPROxFTW
Quick script I made waiting to dl something. Simply what it does it checks if a player is in a certain distance then opens the door. Hasn't been tested so if any errors just let me know.
Code Snippet
Plaintext
#include maps\_music;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_utility;

main()
{
Auto = GetEntArray( "auto_door", "targetname" );
Auto1 = GetEntArray( "auto_door1", "targetname" );// Also wanna know what this is for it would let me know if this is needed or not. Put it here since you had but might not be needed.

for( i = 0; i < Auto.size; i++ )
Auto[i] thread auto_door( -50, 25 );

for( i = 0; i < Auto1.size; i++ )
Auto1[i] thread auto_door( 50, -25 );
}

auto_door( Num, Num2 )
{
NotAlreadyIn = undefined;
        Play = GetPlayers();

for( i = 0; i < Play.size; i++ )
{
if( distance( Play[i].origin, self.origin ) < 300 && !IsDefined( NotAlreadyIn ) ) // Maybe bigger/smaller depending on distance you want
{
NotAlreadyIn = true;
                        self MoveX( Num, 6 );
wait 3;
self MoveX( Num2, 6 );
wait 3;
}
}
self thread auto_door();
}
Last Edit: June 11, 2014, 10:58:34 pm by PROxFTW
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
The trigger is activated when a player touches it. Simply resize the trigger until you have it where you want for the radius.
Last Edit: June 11, 2014, 10:58:55 pm by daedra descent
broken avatar :(
  • steviewonder87
  • Deleted Member
×
broken avatar :(
steviewonder87
This user is deleted :(
But what about zombies? Do they trigger it too, otherwise they're gonna spawn in the adjacent/current zone and just pile up on the other side of the door if the player is standing on the other side..
broken avatar :(
×
broken avatar :(
Location: usearth
Date Registered: 3 January 2014
Last active: 3 years ago
Posts
12
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
Kill all the Zombies :D
×
sgray97's Groups
sgray97's Contact & Social Links
i was thinking about a way to do that but i guess i might have to just give them a path around the doors through barriers or something but quick question how would i make the doors open faster then the slow opening of the doors?
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
i was thinking about a way to do that but i guess i might have to just give them a path around the doors through barriers or something but quick question how would i make the doors open faster then the slow opening of the doors?

The second argument defines the speed. See Zeroys script reference for function arguments http://www.zeroy.com/script/motion/movex.htm
broken avatar :(
×
broken avatar :(
Location: usearth
Date Registered: 3 January 2014
Last active: 3 years ago
Posts
12
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Personal Quote
Kill all the Zombies :D
×
sgray97's Groups
sgray97's Contact & Social Links
any idea on how to have zombies trigger the trigger_multiple im keeping this as simple as possible since im just starting off
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
942
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
The second argument defines the speed. See Zeroys script reference for function arguments http://www.zeroy.com/script/motion/movex.htm
why not tell him how to use "moveto" that way he han move the  doors to structs and made prefabs instead of having to make 1 script for every door lol
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
why not tell him how to use "moveto" that way he han move the  doors to structs and made prefabs instead of having to make 1 script for every door lol

Forgot that even exists. I don't use the move<whatever>() functions very often.

 
Loading ...