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

Opening a door by shooting a trigger

broken avatar :(
Created 8 years ago
by Eggies
0 Members and 1 Guest are viewing this topic.
7,435 views
broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 6 August 2015
Last active: 2 years ago
Posts
145
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Hiya!
×
Eggies's Groups
Eggies's Contact & Social LinkstiyoushiXelasto
So, as the title says, I'm trying to open a door by shooting a trigger.  So I made a door with the regular kvps that all doors have with the targetname door6, and made a trigger_damage as well with the targetname "Secret_Trigger" and then in my maps .gsc I came up with my first (horrible) script!

Code Snippet
Plaintext
secret_door_trigger()
{
trigger = getEnt("Secret_Trigger, door6");
while(1)
{
self waittill("Secret_Trigger", player);
door_open(door6, player);
player iprintInbold("You hear an unlocking sound.");
self delete();
}
}

I've been reading all I can on scripting, and I THINK most of this makes sense. I just don't know what function I should use to open the door. Would ent delete(); work instead of door_open(door6, player);? Now that I think of it, doesn't self delete(); refer to the Entity, which is the door? 0-o How would I correct this script?

Last Edit: June 21, 2016, 09:10:16 am by Tiyoushi
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21'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.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
Self is whatever you threaded this function "on"

If nothing then self is level

Also "secret_trigger" is not a default notify

You prob just want "trigger" or might be "damage"
Last Edit: June 21, 2016, 10:10:53 am by Harry Bo21
broken avatar :(
×
broken avatar :(
Location: it
Date Registered: 5 September 2014
Last active: 3 years ago
Posts
282
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I belive purple is getting me...
×
IperBreach86's Groups
IperBreach86's Contact & Social LinksIperBreach86
Self is whatever you threaded this function "on"

If nothing then self is level

Also "secret_trigger" is not a default notify

You prob just want "trigger" or might be "damage"
Isnt the getent used wrongly too?
Code Snippet
Plaintext
	trigger = getEnt("Secret_Trigger, door6");
Should be
Code Snippet
Plaintext
	trigger = getEnt("value", "key");
Where eky and value are the ones of the KVP that you are looking for?
broken avatar :(
×
broken avatar :(
Location: usLouisiana
Date Registered: 1 January 2014
Last active: 1 year ago
Posts
65
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Beginner Scripter && A7X Deathbat
×
idogftw's Groups
idogftw's Contact & Social LinksIdogftw00
So, first things first, since you said your trigger is targetname secret_trigger you would put it as this
Code Snippet
Plaintext
trigger = getEnt("Secret_Trigger", "targetname");
The first parameter is the name in radiant the second is the type, like script_noteworthy or of course targetname.

So, next thing is in your infinite loop (while loop)
like Harry said,  secret_trigger isn't a default notify it has to be notified somewhere else because of something you do, but really if you are doing a trigger, you would do this
Code Snippet
Plaintext
trigger waittill("trigger", player);
So, what you would be doing is the trigger you are waiting for is the ent you defined above, so when you wait for it to be damaged and the damager is the player it will go past the waittill and call your function or do what you want it to do after.

Next thing is the door open function now since you don't have thread before it, it'll wait till the function is done then do what you want which you have here is the iprintlnbold, which I would think you want to be done as soon as the function is called, so you would do this:
Code Snippet
Plaintext
thread door_open(trigger, player);
player iprintInbold("You hear an unlocking sound.");
trigger waittill("moved"); //This is what I was talking about above, you are gonna
//notify this from your door_open function and then it will delete the trigger after the move is done
trigger delete();

So, finally here is how your code should look.
Code Snippet
Plaintext
secret_door_trigger()
{
trigger = getEnt("Secret_Trigger", "targetname");
while(1)
{
trigger waittill("trigger", player);
thread door_open(trigger);
player iprintInbold("You hear an unlocking sound.");
                trigger waittill("moved");
trigger delete();
                break; //You are gonna break out of the function because you wont be using it anymore since you're deleting
                //the trigger
}
}
Now for the door_open function use this
Code Snippet
Plaintext
door_open(trigger)
{
//Now gotta get the door so
door = getEnt("input_a_name_from_radiant", "targetname"); //Make the door a script brushmodel and give it these kvps
door moveTo(); //Put in the x,y,z coords of where you want it to go
trigger notify("moved"); //This is how you call the waittill by notifying it
}

I believe that is it, so that should work, I wasn't able to test in game, but if you have any errors just pm me.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I posted a shootable door script here, with prefabs:

http://ugx-mods.com/forum/index.php/topic,4508.0.html


One thing you may notice is connectpaths(). That is important if you want the zombies to walk through this area as well. Also if you want to spawn more zombies in another area once it is shot, then you would need to add something to set that flag as well. That is not in the script but could be added around the connectpaths() line, with a check for a script_flag kvp.
Last Edit: June 21, 2016, 12:16:10 pm by MakeCents
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
you could instead make the door and trigger the exact same way you made all the other doors but with a trigger_damage instead of a trigger_use.  then in zombiemode_blockers_new.gsc make a check to see if the trigger is a trigger_damage instead of trigger_use. this way the door would act the exact same as the rest of the doors in your level except you wouldnt have to press "use " and it wouldnt check for the score when its opened

for the check do a search for
Code Snippet
Plaintext
is_player_valid( who )
there are multiple the one you are looking for is in the method door_think()

under neither that previous if statement and before the  if checking who.score do something like this
Code Snippet
Plaintext
if(IsSubStr(self.classname, "damage")
{
//i know it seems weird to make an empty if statement, but you have to ensure that the player wont loose its points if its a damage trigger
}
else if( who.score >= self.zombie_cost )
{
// set the score
who maps\_zombiemode_score::minus_to_player_score( self.zombie_cost );
if( isDefined( level.achievement_notify_func ) )
{
level [[ level.achievement_notify_func ]]( "DLC3_ZOMBIE_ALL_DOORS" );
}
bbPrint( "zombie_uses: playername %s playerscore %d round %d cost %d name %s x %f y %f z %f type door", who.playername, who.score, level.round_number, self.zombie_cost, self.target, self.origin );
}
broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 6 August 2015
Last active: 2 years ago
Posts
145
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Hiya!
×
Eggies's Groups
Eggies's Contact & Social LinkstiyoushiXelasto
Hmmm. I'm confused. Why is it not working?

Door KVPs:



Trigger_damage KVPs:



Code that is in my map's .gsc:

Code Snippet
Plaintext
secret_door_trigger()
{
trigger = getEnt("Secret_Trigger", "targetname");
while(1)
{
trigger waittill("trigger", player);
door_open(trigger);
player iprintlnbold("You hear an unlocking sound.");
        trigger waittill("moved");
trigger delete();
        break;
}
}

door_open(trigger)
{

door = getEnt("door6", "targetname"); //Make the door a script brushmodel and give it these kvps
door moveTo(-704, 896, 0); //Put in the x,y,z coords of where you want it to go
trigger notify("moved"); //This is how you call the waittill by notifying it
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Your moveto isn't right
broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 6 August 2015
Last active: 2 years ago
Posts
145
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Hiya!
×
Eggies's Groups
Eggies's Contact & Social LinkstiyoushiXelasto
How do I fix it?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 6 August 2015
Last active: 2 years ago
Posts
145
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Hiya!
×
Eggies's Groups
Eggies's Contact & Social LinkstiyoushiXelasto
It's still not working!

I changed it to door moveTo((-704, 896, 0), 1, 0.1, 0.1);

does the trigger need to be inside the play area?

Is there anything else wrong?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 8 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9'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.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
well that script has some un-necessary stuff going on in your script such as the while loop and the notify, I would change it to this:
Code Snippet
Plaintext
secret_door_trigger()
{
trigger = GetEnt( "Secret_Trigger", "targetname" );
trigger waittill( "trigger", player );
trigger Delete();
door = GetEnt( "door6", "targetname" );
door MoveTo( ( -704, 896, 0 ), 1, 0.1, 0.1 );
player IPrintLnBold( "You hear an unlocking sound." );
}
And why do you have all those extra KVP's like script_flag and target and script_fxid and script_firefx and script_noteworthy. This script requires absolutely none of that.

But your script does look like it should work so yeah.
Last Edit: June 21, 2016, 11:09:28 pm by alaurenc9
Marked as best answer by Tiyoushi 8 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Could be a problem if you have more than one ent with either of those kvps, also. You should get an array, then thread a function on each.

If that's not it, where are you threading it?
Last Edit: June 21, 2016, 11:30:15 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 6 August 2015
Last active: 2 years ago
Posts
145
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Hiya!
×
Eggies's Groups
Eggies's Contact & Social LinkstiyoushiXelasto
Okay, both the door and trigger have no KVPs except for targetnames, and I replaced my script with what deadpool's got.

Still nothing.  :alone:

EDIT: Also, I moved the trigger to inside the play area, and made it a large sheet dividing a room in half, so I just shoot in it and boom.
Last Edit: June 21, 2016, 11:35:33 pm by Tiyoushi
broken avatar :(
×
broken avatar :(
Location: usCalifornia
Date Registered: 6 August 2015
Last active: 2 years ago
Posts
145
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Hiya!
×
Eggies's Groups
Eggies's Contact & Social LinkstiyoushiXelasto
I knew I had done something so obviously wrong!  :alone:

Everything was fine, but I forgot I had to call the function under maps\_zombiemode::main();  :poker:

 
Loading ...