Call of Duty: Black Ops 3 => Tutorial Desk => Scripting => Topic started by: reckfullies on October 09, 2016, 12:21:24 am
Title: [Tutorial] Shootable Triggers
Post by: reckfullies on October 09, 2016, 12:21:24 am
Its been over a year since I made this, got bored so I've decided to remake it from scratch. With newer games releasing, BO3 isn't really as popular anymore but I'm sure this tutorial will still help someone.
I have tested this multiple times, if for some reason it doesn't work then let me know.
Useful Info
Spoiler: click to open...
"Entity Browser" Shortcut = B "Entity Info" Shortcut = N
Let me know if you think I should add anything else here.
Tutorial
Spoiler: click to open...
Part 1 - Radiant
Place the models you would like to use for your Shootables, these can be anything you want.
Select all of your models.
Go into the "Entity Browser" window.
Click "Scripts" and double-click "model".
Deselect everything.
Go back into the "Entity Browser" window.
Click "Trigger" and drag "damage" onto your map.
Resize this trigger to cover your model.
Go into the "Entity Info" window. Note: Make sure you keep the trigger selected
Double-click the "Value" field of the "targetname" property.
Type "shootable_trigger" then press Enter.
With the trigger selected, copy it and put it on any other models you have.
Select ONE trigger THEN select the model that it is covering.
Press "W" to link them.
Repeat the last two steps for each pair of triggers and models you have.
This is a short youtube video for anyone who is confused.
Spoiler: click to open...
Part 2 - Scripting
Open Windows Explorer or any other file browser.
Navigate to "root/share/raw/scripts" where "root" is your BO3 game folder.
Create a new folder named "custom".
Create a new file named "shootable.gsc". Note: You might need to have "show known file extensions" enabled to make it a .gsc
Open the newly created file.
Paste the code below into that file.
Save the file.
Code
Spoiler: click to open...
Part 3 - Finishing Touches & Compiling
Open Windows Explorer or any other file browser.
Navigate to "root/usermaps/zm_mapname/scripts/zm" where "root" is your BO3 game folder and "mapname" is your map name.
Open "zm_mapname.gsc" where "mapname" is your map name.
Thanks for fixing all the problems, should have tested it sooner since I wrote this from memory cause I couldn't get on steam at the time.
**** 1 script error(s): "function_shootable_1" with 0 parameters in "scripts/custom/shootable.gsc" at line 7 **** **** Unresolved external "function_shootable_1" with 0 parameters in "scripts/custom/shootable.gsc" ****
Idk if you changed the script but I'm getting this new error now since I recopied and pasted it.
Title: Re: [Tutorial] Shootable Triggers
Post by: CraftDAnimations on October 10, 2016, 02:54:10 am
Did the OP get updated as I am getting the same error when trying to build!
I think this was a mistake when HitmanVere edited it, ill fix it since function wasn't supposed to be there in the first place.
Re do the part where the script is made, at the top where the functions are threaded they are supposed to be
Just updated OP.
Title: Re: [Tutorial] Shootable Triggers
Post by: 88ninjastar on October 10, 2016, 04:29:33 am
I've updated the script and changed the 2 threads at the top, but now when I run the map and shoot the triggers and models in the game, it says "Lost Connection" and the game freezes and eventually crashes.
Title: Re: [Tutorial] Shootable Triggers
Post by: GNT123 on October 10, 2016, 05:00:01 am
Anyone know how to get the syntax to recognize it as a function in Sublime Text 3 and change it to blue? I could also be wrong I am just a beginner when it comes to any of this honestly.
extra information: upon typing "playe", "player" is located in the drop down list but no matter what it won't change to blue.
Title: Re: [Tutorial] Shootable Triggers
Post by: Blink-420 on October 10, 2016, 06:43:36 am
When I shoot the triggers with the updated fixes you posted my game gives me connection interrupted then crashes everytime..hahaha
Title: Re: [Tutorial] Shootable Triggers
Post by: CraftDAnimations on October 10, 2016, 08:51:41 am
Although I now get no errors while compiling I do get a Connection Interrupted after shooting the 2nd bottle
I think this was a mistake when HitmanVere edited it, ill fix it since function wasn't supposed to be there in the first place.
Re do the part where the script is made, at the top where the functions are threaded they are supposed to be
Just updated OP.
I apparently need to test my modifications as well when I fix stuff, lmao. Also, your break; is at the wrong place, should be inside if-statement. Now it breaks even when if-statement is false
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 10, 2016, 10:01:47 am
I apparently need to test my modifications as well when I fix stuff, lmao. Also, your break; is at the wrong place, should be inside if-statement. Now it breaks even when if-statement is false
I can see why you would have done that, I mistakenly wrote thread function shootable_1 so it seemed like it was meant to be function_shootable_1 lol.
As for the break, I feel like an idiot since I keep making little mistakes. Guess that is what happens when you are too lazy to test everything you modify.
Title: Re: [Tutorial] Shootable Triggers
Post by: CraftDAnimations on October 10, 2016, 10:32:52 am
Slowly getting there lol. No errors (ie no connection interrupted) but when I shoot just ONE model - it says "All Shootables Collected". Then when I shoot the next it says the same.
I tried adding the Electric Cherry addition and it doesn't award player with the perk.
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 10, 2016, 10:55:43 am
Slowly getting there lol. No errors (ie no connection interrupted) but when I shoot just ONE model - it says "All Shootables Collected". Then when I shoot the next it says the same.
I tried adding the Electric Cherry addition and it doesn't award player with the perk.
I know about this and was just updating OP to fix it, I revised the entire script to make sure it was working. Just re-read OP and it will fix this problem.
Next time ill make sure it works before I post it to avoid all of this.
I don't know about your perk problem since this tutorial is for the shootables. I haven't given any perks in bo3 through script yet so I don't really know what your problem is.
Title: Re: [Tutorial] Shootable Triggers
Post by: CraftDAnimations on October 10, 2016, 11:34:26 am
Works a treat - thank you for taking the time to sort this.
How would I go about taking a door open after last model is shot?
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 10, 2016, 11:40:35 am
Works a treat - thank you for taking the time to sort this.
How would I go about taking a door open after last model is shot?
This might be hard to do since you would need to change the script where they control all doors and at the moment in the mod tools we can't actually modify most of the scripts so it would be really complicated if not, impossible to do unless you made your own door script.
If you want me to make you a door script and add this for you contact me on ugx via messages and we can figure something out.
Title: Re: [Tutorial] Shootable Triggers
Post by: Harry Bo21 on October 10, 2016, 12:27:31 pm
Not really
You would just use different kvps for this door so it's not controlled by the "old" system and make sure to set the zone it opens flag
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 10, 2016, 12:33:18 pm
This is the fully code if you want to get "Electric Cherry" :)
Tested and it works fine ;)
This is for 3 triggers :)
Thanks for sharing your script with anyone who might not know how to do this, if anyone wants to change the perk all names are located in _zm_perks.gsh
Title: Re: [Tutorial] Shootable Triggers
Post by: TheKillerey on October 11, 2016, 02:50:58 pm
Thanks for sharing your script with anyone who might not know how to do this, if anyone wants to change the perk all names are located in _zm_perks.gsh
No Problem :)
Title: Re: [Tutorial] Shootable Triggers
Post by: Blink-420 on October 12, 2016, 12:42:58 am
I get no errors compiling map and it works but the game doesn't give me electric cherry once i shoot all three bottles just the on screen messages
Make sure you actually have the perks enabled on your map. By default electric cherry and widows wine are not enabled.
To add them go into root/usermaps/zm_mapname/scripts/zm/zm_mapname.gsc and add this to the top of the file:
Do the same thing inside root/usermaps/zm_mapname/scripts/zm/zm_mapname.csc
Title: Re: [Tutorial] Shootable Triggers
Post by: jrderuki on October 12, 2016, 05:31:53 am
I get this error it looks like a path error anyone know what I did wrong? :poker: ^1ERR(83) scripts/zm/zm_hard.gsc (12,32) : Compiler Internal Error : Compile error processing "using" file - file not found : scripts/custom/shootable.gsc
EDIT: Nevermind got it fixed and working :)
Title: Re: [Tutorial] Shootable Triggers
Post by: Gondor on October 13, 2016, 11:48:06 pm
I want to give the zombie shield weapon instead of a perk how do you do that?
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 14, 2016, 09:55:31 am
I want to give the zombie shield weapon instead of a perk how do you do that?
*Note - Make sure you are using the script that TheKillerey made above since it has access to the player variable*
Replace player zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false ); with this:
I'm not sure if this is the right way to do it since it acts as a equipment not a weapon but it should work since it is in the weapons table. Please let me know if anything doesn't work and Ill figure out the right way.
Title: Re: [Tutorial] Shootable Triggers
Post by: Gondor on October 14, 2016, 07:12:58 pm
it works with raygun but not zombie shield probably because its a equipment
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 14, 2016, 08:19:48 pm
it works with raygun but not zombie shield probably because its a equipment
You could try this.
Add this to your includes:
then add this inside shootable_done under IPrintLn:
This should work, if it doesn't you or someone else will need to figure it out since I can't find another way inside the equipment file.
Title: Re: [Tutorial] Shootable Triggers
Post by: Gondor on October 14, 2016, 09:21:54 pm
Thanks man that worked ill give you some credit in my map description once its updated! Double Post Merge: October 15, 2016, 12:30:44 amThe script works but after testing it on multiplayer it gives the shield to only 1 player and not all players. Is theirs a way to script it to all players or all 4? Double Post Merge: October 15, 2016, 12:31:42 amholly fuck i was baked when I wrote that
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 15, 2016, 09:18:50 am
Thanks man that worked ill give you some credit in my map description once its updated! Double Post Merge: October 15, 2016, 12:30:44 amThe script works but after testing it on multiplayer it gives the shield to only 1 player and not all players. Is theirs a way to script it to all players or all 4? Double Post Merge: October 15, 2016, 12:31:42 amholly fuck i was baked when I wrote that
Replace this:
With this:
Title: Re: [Tutorial] Shootable Triggers
Post by: M0ul3_G4m3r on October 15, 2016, 03:04:03 pm
Hi! What is the code to play song or a custom song when a trigger was shooted ?! thanks ! :accepted:
Title: Re: [Tutorial] Shootable Triggers
Post by: Gondor on October 16, 2016, 01:10:14 am
Thanks man but im currently having a glitch where sometimes the script bugs out and does not fully work and you only have to shoot 1 trigger and it gives you the Easter egg complete status. This is my code
Title: Re: [Tutorial] Shootable Triggers
Post by: DeletedUser on October 16, 2016, 03:36:09 am
I've noticed that when you done shooting all of the triggers only the first player gets the rewards and other three players don't. Is there a fix for this?
Title: Re: [Tutorial] Shootable Triggers
Post by: donovanne on October 16, 2016, 10:16:38 pm
I've noticed that when you done shooting all of the triggers only the first player gets the rewards and other three players don't. Is there a fix for this?
I think this should work.
Title: Re: [Tutorial] Shootable Triggers
Post by: GNT123 on October 18, 2016, 01:01:31 pm
How do I make it so only a certain gun activates the shootable trigger and others don't? It would help me out a lot thanks!
Title: Re: [Tutorial] Shootable Triggers
Post by: jasonpage260 on October 18, 2016, 05:05:10 pm
how would I go about to change this to the PowerUp free perk
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 18, 2016, 05:59:16 pm
how would I go about to change this to the PowerUp free perk
Add this to the top of the script:
Then add this to the shootable_done function:
Just replace "powerupname" with the code name of the powerup.
Avaliable Powerups:
Spoiler: click to open...
bonfire_sale
carpenter
double_points
fire_sale
free_perk
full_ammo
insta_kill
shield_charge
weapon_minigun
ww_grenade
Then make origin the origin you want the powerup to spawn at. Example:
Title: Re: [Tutorial] Shootable Triggers
Post by: shaan211 on October 18, 2016, 09:49:12 pm
Thanks a lot, should be able to add in a easter egg into my map now :D
Title: Re: [Tutorial] Shootable Triggers
Post by: Gondor on October 18, 2016, 10:50:35 pm
im having a glitch with my script where you don't need to shoot all 3 objects to get the easter egg complete. Sometimes its only 1 or 2 triggers you only need to shoot.
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 18, 2016, 11:57:53 pm
im having a glitch with my script where you don't need to shoot all 3 objects to get the easter egg complete. Sometimes its only 1 or 2 triggers you only need to shoot.
This shouldn't be possible since it checks twice if they are all activated, anyways try this.
Replace:
with:
Title: Re: [Tutorial] Shootable Triggers
Post by: Taven on October 20, 2016, 06:23:28 am
Trying to get audio to play when a trigger has been shot tried everything. Sorta like the EE from The Giant.
EDIT: Figured it out :P
Title: Re: [Tutorial] Shootable Triggers
Post by: M0ul3_G4m3r on October 20, 2016, 05:43:21 pm
Just as the error says, you didn't initialize the variable player.
There are 2 ways you can do this depending on who you want to give the perk to.
All Players:
Spoiler: click to open...
Only the players that shot a shootable: First, go into each of the shootable functions and change them to this:
Spoiler: click to open...
then change the shootables_done function to this:
Spoiler: click to open...
Thanks but I have try to use the "All Players" script but I got this error when I launching the game : (http://image.noelshack.com/fichiers/2016/42/1477036168-error.png)
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 21, 2016, 02:43:41 pm
Thanks but I have try to use the "All Players" script but I got this error when I launching the game : (http://image.noelshack.com/fichiers/2016/42/1477036168-error.png)
You must have messed something up when copying or something, the function I gave you shouldn't be causing this.
Check line 30 of that script and if you cant figure it out just post the whole script here and Ill look at it
Title: Re: [Tutorial] Shootable Triggers
Post by: Vetrotec on October 25, 2016, 06:16:29 pm
I've already seen this being talked about. I'm very very new to all this and was wondering how I'd go about making this script open a door if anyone can help me this would mean a lot to me and others. :poker:
Title: Re: [Tutorial] Shootable Triggers
Post by: GNT123 on October 25, 2016, 08:01:52 pm
I've already seen this being talked about. I'm very very new to all this and was wondering how I'd go about making this script open a door if anyone can help me this would mean a lot to me and others. :poker:
Haven't test this but it should work. Just do reckfullies tutoral at the top of the forum and just add one more script model with a targetname "shootable_model_3" and a trigger damage with the targetname "shootable_trig_3" then add your door make it a script modle and add the targetname "door_power". Finally, this should work but it will not say your entering the zone so if you want zombies to spawn in your power room you might have to have someone easle help you with that.
Title: Re: [Tutorial] Shootable Triggers
Post by: Vetrotec on October 25, 2016, 08:53:05 pm
Haven't test this but it should work. Just do reckfullies tutoral at the top of the forum and just add one more script model with a targetname "shootable_model_3" and a trigger damage with the targetname "shootable_trig_3" then add your door make it a script modle and add the targetname "door_power". Finally, this should work but it will not say your entering the zone so if you want zombies to spawn in your power room you might have to have someone easle help you with that.
Ill check now if it works :)
Title: Re: [Tutorial] Shootable Triggers
Post by: Vetrotec on October 25, 2016, 10:31:09 pm
Haven't test this but it should work. Just do reckfullies tutoral at the top of the forum and just add one more script model with a targetname "shootable_model_3" and a trigger damage with the targetname "shootable_trig_3" then add your door make it a script modle and add the targetname "door_power". Finally, this should work but it will not say your entering the zone so if you want zombies to spawn in your power room you might have to have someone easle help you with that.
Black screens my game on load up. just me?
Title: Re: [Tutorial] Shootable Triggers
Post by: Kierpok on October 26, 2016, 02:25:20 pm
could you tell me if its possible to make is so every person in my game gets the perk Double Post Merge: October 26, 2016, 09:36:55 pm
You must have messed something up when copying or something, the function I gave you shouldn't be causing this.
Check line 30 of that script and if you cant figure it out just post the whole script here and Ill look at it
THIS IS MY SCRIPT FOR IT AND IT WORKS TO SHOOT ALL 3 TEDDYS BUT WHEN IT GETS TO IT IT DOSE NOT GIVE ANY PERK ANY ONE GOT IDEAS WHY? (Sorry for caps trying to make it look different from the script ^.^)
I would just like to state that using PERK_WIDOWS_WINE will not affect the outcome. Also it is "specialty_widowswine" which is also defined by PERK_WIDOWS_WINE.
His problem was inside the loop.
I have fixed the code so if you wish to replace the function you can do.
Also question for OP, out of curiosity why did you add a loop into shootables_done?
Title: Re: [Tutorial] Shootable Triggers
Post by: Kierpok on October 29, 2016, 02:41:22 am
I would just like to state that using PERK_WIDOWS_WINE will not affect the outcome. Also it is "specialty_widowswine" which is also defined by PERK_WIDOWS_WINE.
His problem was inside the loop.
I have fixed the code so if you wish to replace the function you can do.
Also question for OP, out of curiosity why did you add a loop into shootables_done?
Thank you sooo much I would have no idea thats what was wrong with the scrip ^^ Trying my best to wrap my head round it but its preaty hard :0 Thank you again !!
Title: Re: [Tutorial] Shootable Triggers
Post by: reckfullies on October 29, 2016, 08:37:16 pm
I would just like to state that using PERK_WIDOWS_WINE will not affect the outcome. Also it is "specialty_widowswine" which is also defined by PERK_WIDOWS_WINE.
His problem was inside the loop.
Spoiler: click to open...
I have fixed the code so if you wish to replace the function you can do.
Also question for OP, out of curiosity why did you add a loop into shootables_done?
I'm pretty sure the reason the loop is there was for something I was doing with the script in my map before I released it here, doubt it is really needed unless i'm forgetting something.
Title: Re: [Tutorial] Shootable Triggers
Post by: pedrehitor on November 12, 2016, 10:51:06 am
Someone knows what script I have to put to shoot three bears and open a door
Title: Re: [Tutorial] Shootable Triggers
Post by: leonardo745 on July 18, 2017, 05:09:39 am
Can you tell me how to allow the trigger to activate only when the tesla_gun fires at the trigger ?
Title: Re: [Tutorial] Shootable Triggers
Post by: Wolfilms on July 18, 2017, 06:16:28 pm
are you getting errors while linking your scripts?
Have you done all the necessary steps to make those fx play?
I can't really test anything at the moment because my game won't open
When I use this:
I'm get errors while linking, but when I use the code that I sent, it links but does not work in the game, and when I use without checking the weapon, the effects appear without any problem.
Title: Re: [Tutorial] Shootable Triggers
Post by: Wolfilms on July 20, 2017, 03:26:54 pm
Well, I stumbled upon this topic while searching through the help section. Hope this helps
Title: Re: [Tutorial] Shootable Triggers
Post by: Archaicvirus on July 20, 2017, 09:43:34 pm
I re-wrote the script to be much shorter, and more flexible. I'm not trying to step on your toes, or 1-up you or anything like that. Just figured this might help, especially if you are busy and I know you've mentioned updating the script anyways, so maybe this will save you the trouble. If you don't use it that's fine also, no offense taken. I'm not the best scripter, but pretty decent I believe, lol. Here it is.
Title: Re: [Tutorial] Shootable Triggers
Post by: Wolfilms on July 20, 2017, 10:02:13 pm
leonardo745, looking back at your original code, I noticed you weren't getting the trigger using so the game never knew what trigger it was looking for
Title: Re: [Tutorial] Shootable Triggers
Post by: leonardo745 on July 20, 2017, 10:23:26 pm
leonardo745, looking back at your original code, I noticed you weren't getting the trigger using so the game never knew what trigger it was looking for
I was, I just forgot to put it here. My problem is the time to say which weapon I wanted the game to check. Now my code looks like this:
Title: Re: [Tutorial] Shootable Triggers
Post by: leonardo745 on July 20, 2017, 10:29:23 pm
I re-wrote the script to be much shorter, and more flexible. I'm not trying to step on your toes, or 1-up you or anything like that. Just figured this might help, especially if you are busy and I know you've mentioned updating the script anyways, so maybe this will save you the trouble. If you don't use it that's fine also, no offense taken. I'm not the best scripter, but pretty decent I believe, lol. Here it is.
Thanks, this will help me a lot !!
Title: Re: [Tutorial] Shootable Triggers
Post by: Archaicvirus on July 21, 2017, 02:42:24 am