Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: Conbini2017 on February 20, 2017, 10:05:33 am
Title: How to open the door for free with 3 buttons?
Post by: Conbini2017 on February 20, 2017, 10:05:33 am
Please tell me the script to open the door for free with 3 buttons. :)
Title: Re: How to open the door for free with 3 buttons?
Post by: Chilltacular on February 22, 2017, 11:49:10 pm
You would have to make sure that the door is either a script model or a script brushmodel and is named "door" for its target name and each of the triggers are named "trigger1", "trigger2", and "trigger3" in the targetname. If you want you could change the names but they have to correspond in radiant and the script. I included a clip in there in case you use a model for the door instead of a brushmodel as models are non collidable and can be walked through without a clip. Make sure the clip covers the entire door so players can't walk through it.
If you choose to you can rotate the door instead of deleting it by using RotateYaw([angle], [time for rotation]) instead of Delete(), but I won't get into that you can just look it up. JBird has some tutorials on doors and rotations on youtube.
Title: Re: How to open the door for free with 3 buttons?
Post by: MakeCents on February 24, 2017, 03:13:20 pm
You would have to make sure that the door is either a script model or a script brushmodel and is named "door" for its target name and each of the triggers are named "trigger1", "trigger2", and "trigger3" in the targetname.
Some people get offended by this, but please know I mean no offense:
Here are some tips to clean up your code, make it more readable, and dynamic:
Here is the code cleaned up. I would also set the doors as the target of the triggers and make some more tweaks, but this is cleaner and you can add as many triggers as you want this way: (sorry for any typos or errors, didn't test)
Title: Re: How to open the door for free with 3 buttons?
Post by: Conbini2017 on February 26, 2017, 11:50:47 am
Some people get offended by this, but please know I mean no offense:
Here are some tips to clean up your code, make it more readable, and dynamic:
Here is the code cleaned up. I would also set the doors as the target of the triggers and make some more tweaks, but this is cleaner and you can add as many triggers as you want this way: (sorry for any typos or errors, didn't test)
thank you!!!! :D
In radiant it is use_trigger?
Title: Re: How to open the door for free with 3 buttons?
Post by: qbm1 on May 29, 2017, 12:27:50 am
What am i doing wrong all my trigger are set and linked to the door but still say not available :-[
Title: Re: How to open the door for free with 3 buttons?
Post by: MakeCents on May 29, 2017, 12:30:18 am
Anytime that happens, the script is not running, or the kvps are wrong, or get ent is being used when you have multiple of a kvp.
Right so ive used your cleaned up version and put scriptparsetree,scripts/zm/Trigger_door.gsc in my zone folder and your script in scripts/zm/Trigger_door.gsc. is that right? Then my triggers targetname's as trigger and target as door. target name of the script brush model as door. Something is wrong but i can't figure out what sorry im new ish to modding
Title: Re: How to open the door for free with 3 buttons?
Post by: MakeCents on May 29, 2017, 01:12:27 am
Right so ive used your cleaned up version and put scriptparsetree,scripts/zm/Trigger_door.gsc in my zone folder and your script in scripts/zm/Trigger_door.gsc. is that right? Then my triggers targetname's as trigger and target as door. target name of the script brush model as door. Something is wrong but i can't figure out what sorry im new ish to modding
Did you call or thread the function openDoor anywhere? Those were just two functions. They won't run by themselves, unless an auto exec was added to the script. Easiest to call or from main and add a using fit that script.
Title: Re: How to open the door for free with 3 buttons?
Post by: qbm1 on May 29, 2017, 01:16:04 am
Did you call or thread the function openDoor anywhere? Those were just two functions. They won't run by themselves, unless an auto exec was added to the script. Easiest to call or from main and add a using fit that script.
how and where would i add that sorry. Thanks for your help guess we all have to learn somewhere
Title: Re: How to open the door for free with 3 buttons?
Post by: MakeCents on May 29, 2017, 01:26:37 am
how and where would i add that sorry. Thanks for your help guess we all have to learn somewhere
usings are used when you want to call a function in another script. They go at the top of a script that you want to call the function from. See this for more info. https://youtu.be/UlxoW3_0BMs?list=PLhT8THhu7qLxZNQwy0cFQvZ630qyfmZnA
your using would look like this:
You can add this to your mapname.gsc and then in the main function add:
Title: Re: How to open the door for free with 3 buttons?
Post by: qbm1 on May 29, 2017, 02:05:44 am
Just getting an error after that
UNRECOVERABLE ERROR: ^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_five.gsc'
Linker will now terminate. ********************************************************************************
Oh, my bad, was on phone, just copied your text. I think your issue is the usings slash has to be like this:
fixed in op. The way I had it was just for zone files.
Hahaha looking at the code now it's stands out so much as being wrong but it's still saying no available. So must be the kvp's is there any particular trigger type I need to use or kvp's for them or the script model. Don't know how I'm finding it so hard when I've followed everything lol
Title: Re: How to open the door for free with 3 buttons?
Post by: MakeCents on May 29, 2017, 09:41:13 pm
Hahaha looking at the code now it's stands out so much as being wrong but it's still saying no available. So must be the kvp's is there any particular trigger type I need to use or kvp's for them or the script model. Don't know how I'm finding it so hard when I've followed everything lol
Its tough to help on this post like this. Might be better if you make your own with examples and pictures of what you have done so far.
But as far as kvps, they simply must match what is in script. So for this line:
the kvp for the tirggers would be targetname>triggers
I have a scripting tut series if that would be any help. It goes over kvps and things like this.
Title: Re: How to open the door for free with 3 buttons?
Post by: qbm1 on May 29, 2017, 11:43:09 pm
Sorry last one I've got it working but opens after one of the triggers is pressed when theirs 4 to press :'(
Title: Re: How to open the door for free with 3 buttons?
Post by: MakeCents on May 30, 2017, 01:51:15 pm
Sorry last one I've got it working but opens after one of the triggers is pressed when theirs 4 to press :'(
It's tough to say. I'd add some prints to see what is happening. A print before it checks the level.buttonsPressed, a print before it level.buttonsPressed--.
Something like that to try and troubleshoot your issue.
Title: Re: How to open the door for free with 3 buttons?
Post by: Wolfilms on July 11, 2017, 04:58:04 am
Some people get offended by this, but please know I mean no offense:
Here are some tips to clean up your code, make it more readable, and dynamic:
Here is the code cleaned up. I would also set the doors as the target of the triggers and make some more tweaks, but this is cleaner and you can add as many triggers as you want this way: (sorry for any typos or errors, didn't test)
Could the problem be that you are setting buttonsNeeded to trigs.size, but later in the code you are subtracting buttonsPressed and not buttonsNeeded?