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

Scripting Help (Buildable Door Activation)

broken avatar :(
Created 10 years ago
by Sounder1995
0 Members and 1 Guest are viewing this topic.
1,871 views
broken avatar :(
×
broken avatar :(
Location: usPennyslvania, United States
Date Registered: 25 October 2015
Last active: 9 years ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Just a gamer and modding novice...
Signature
"All life's a Transformers movie; no one knows what's going on. " - Sounder 2015
Hello, readers. I would totally PM this to JR-Imagine, since this involves his buildables script, but since I haven't reached 20 posts yet (BibleThump), I was wondering if anyone could help me with scripting a door to clear whenever the buildable is finished? I don't entirely get why the buildables_bench_item() function includes a bench parameter; I figure that has something to do with it?
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
Do you want the players to buy the door before opening, or do you want it just to open automatically? Something like this will work.

Code Snippet
Plaintext
buildables_bench_item(trig, bench)
{
door = getEnt("buildable_door", "targetname");  //this will be the door that opens
trig = getEnt("buildable_door_trig", "targetname");    //this is the trigger that you buy on the workbench
cost = 1000; //This is how much it will cost to open the door
while(1)
{
                trig setCursorHint("HINT_NOICON");
                trig sethintstring("Press &&1 to open Door [Cost: " + cost +"); //Change this is what you want the trig to say.
trig waittill("trigger",player);
if(player.score >= cost)
{
if( IsDefined( trig.script_flag ) )
{
flag_set( trig.script_flag );
}
else
{
iprintlnbold("Did not set the script flag on the trigger properly.");
}
play_sound_at_pos( "purchase", player.origin );
trig delete();
door MoveZ (500, 1);
play_sound_at_pos("door_slide_open", door.origin);
door delete();
door connectpaths();     
wait 1;
}
else
{
play_sound_at_pos( "no_purchase", player.origin ); //I believe that is the no money sound.
}
}
}

If you want it to open without it costing, then you don't need 90% of this code, just the stuff dealing with the door.

Make sure you set up the door and trig just like you do with every normal door. Make sure the trig has the script_flag for the name of the zone, and that the zone is set up properly.

Also make sure dynamic path is checked on the door.


If there are any problems just tell me. I kind of wrote this quick, and I am extremely tired xD
Last Edit: April 11, 2016, 02:22:41 am by thezombiekilla6
broken avatar :(
×
broken avatar :(
Location: usPennyslvania, United States
Date Registered: 25 October 2015
Last active: 9 years ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Just a gamer and modding novice...
Do you want the players to buy the door before opening, or do you want it just to open automatically? Something like this will work.

Code Snippet
Plaintext
buildables_bench_item(trig, bench)
{
door = getEnt("buildable_door", "targetname");  //this will be the door that opens
trig = getEnt("buildable_door_trig", "targetname");    //this is the trigger that you buy on the workbench
cost = 1000; //This is how much it will cost to open the door
while(1)
{
                trig setCursorHint("HINT_NOICON");
                trig sethintstring("Press &&1 to open Door [Cost: " + cost +"); //Change this is what you want the trig to say.
trig waittill("trigger",player);
if(player.score >= cost)
{
if( IsDefined( trig.script_flag ) )
{
flag_set( trig.script_flag );
}
else
{
iprintlnbold("Did not set the script flag on the trigger properly.");
}
play_sound_at_pos( "purchase", player.origin );
trig delete();
door MoveZ (500, 1);
play_sound_at_pos("door_slide_open", door.origin);
door delete();
door connectpaths();     
wait 1;
}
else
{
play_sound_at_pos( "no_purchase", player.origin ); //I believe that is the no money sound.
}
}
}

If you want it to open without it costing, then you don't need 90% of this code, just the stuff dealing with the door.

Make sure you set up the door and trig just like you do with every normal door. Make sure the trig has the script_flag for the name of the zone, and that the zone is set up properly.

Also make sure dynamic path is checked on the door.


If there are any problems just tell me. I kind of wrote this quick, and I am extremely tired xD

Well, I circumvented the problem by making two doors, one of them with only a targetname KVP. I probably won't try your method for now cause it takes forever for my map to compile, but thanks for the help! :)

 
Loading ...