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

[Tutorial] Shootable Triggers

HOT
broken avatar :(
Created 8 years ago
by reckfullies
0 Members and 1 Guest are viewing this topic.
43,260 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
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...
Code Snippet
Plaintext
// Credit to Archaicvirus for the updated code. I modified it a tiny bit.
// I also changed some variable & function names to make it more easily readable and added simple comments.

// If you spot any optimizations that could be made let me know, at a glance it seems fine.

function init()
{
// Get all the entities with the targetname "shootable_trigger" then assign them to a variable.
triggerArray = GetEntArray("shootable_trigger", "targetname");

// Create the shootablesNeeded level variable then set it to the amount of entities in the triggerArray variable.
level.shootablesNeeded = triggerArray.size;

// Create the shootablesCollected level variable and set it to 0.
level.shootablesCollected = 0;

// Loop through all the entites in triggerArray
foreach(trigger in triggerArray)
{
// Set the HintString to "".
trigger SetHintString("");

// Set the CursorHint to "HINT_NOICON".
trigger SetCursorHint("HINT_NOICON");

// Create a new property on the trigger named "bottle".
// Get the target entity then assign it to "bottle".
trigger.bottle = GetEnt(trigger.target, "targetname");

// Call the trigger_wait function on this trigger entity.
trigger thread trigger_wait();
}
}

function trigger_wait()
{
// Wait for the trigger to be activated.
self waittill("trigger");

// Delete the bottle(AKA model).
self.bottle Delete();

// Increment the shootablesCollected variable.
level.shootablesCollected++;

// Check if shootablesCollected is greater than or equal to shootablesNeeded.
if (level.shootablesCollected >= level.shootablesNeeded)
{
// Call the give_reward function on the level.
level thread give_reward();
}

// Print info to the screen.
IPrintLnBold("Shootables Collected = [" + level.shootablesCollected + "]");
}

function give_reward()
{
// Print info to the screen.
IPrintLnBold("Reward Given");

// Insert reward code here
}




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.
  • Below "#using scripts\zm\zm_usermap;" add "#using scripts\custom\shootable;"
  • Find the function "main" and add "thread shootable::init();" at the bottom.
  • Save the file.
  • Navigate to "root/usermaps/zm_mapname/zone_source/zm_mapname.zone" where "root" is your BO3 game folder and "mapname" is your map name.
  • At the bottom of the file add "scriptparsetree,scripts/custom/shootable.gsc".
  • Save the file.
  • Go into your launcher then Compile & Link.
Last Edit: May 19, 2018, 04:48:28 am by reckfullies
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 9 May 2015
Last active: 7 years ago
Posts
3
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
mindy12345's Groups
mindy12345's Contact & Social Links
can you make  me a script where i shoot 3 teddy bears it gives me electric cherry
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
can you make  me a script where i shoot 3 teddy bears it gives me electric cherry

This script can be easily adapted to do just that.

I won't be making scripts for everyone who wants them but here is how to give a perk since its pretty simple:

First, go into the script and add this to the top of the file:
Code Snippet
Plaintext
#using scripts\zm\_zm_perks;

Change:
Code Snippet
Plaintext
function shootables_done()
to
Code Snippet
Plaintext
function shootables_done(player)

then go into each of the shootables(shootable_1 and shootable_2) and change this:
Code Snippet
Plaintext
thread shootables_done();
to
Code Snippet
Plaintext
thread shootables_done(player);

lastly go back into shootables_done and add this under the IPrintLn:
Code Snippet
Plaintext
player zm_perks::give_perk("electric_cherry_perk") // I'm not sure what the perk names are for this function so you would need to find the rest.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 18 February 2015
Last active: 1 month ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Blink-420's Groups
Blink-420's Contact & Social LinksBlink-420
^1    thread function
^1------------------^
^1ERR(0) scripts/custom/shootable.gsc (7,19) in "init()" : syntax error, unexpected TOKEN_FUNCTION, expecting TOKEN_LEFT_BRACKET or TOKEN_IDENTIFIER :     thread function

I got this error when compiling?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 10 January 2016
Last active: 7 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
xTundra's Groups
xTundra's Contact & Social Links
This script can be easily adapted to do just that.

I won't be making scripts for everyone who wants them but here is how to give a perk since its pretty simple:

...


This is pretty dope dude.  Is there anything you can recommend for someone who is trying to learn the basic of gsc scripting?
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 8 months ago
Posts
3,997
Respect
1,024Add +1
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
^1    thread function
^1------------------^
^1ERR(0) scripts/custom/shootable.gsc (7,19) in "init()" : syntax error, unexpected TOKEN_FUNCTION, expecting TOKEN_LEFT_BRACKET or TOKEN_IDENTIFIER :     thread function

I got this error when compiling?

Try now. OP was missing few underscores. Fixed it for you, OP, since its easy fix + dont want more people having issues
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 9 October 2014
Last active: 5 years ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GNT123's Groups
GNT123's Contact & Social Links
got this error when compiled the map:

^1
^1^
^1ERR(6E) scripts/custom/shootable.gsc (15,0)  : Compiler Internal Error :  Uninitialized local variable 'targetname'

Any thoughts on how to fix?
broken avatar :(
×
broken avatar :(
Location: gbbradford
Date Registered: 26 September 2014
Last active: 7 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
harvez's Groups
harvez's Contact & Social Links
I get this error while compiling?

^1}
^1^
^1ERR(6E) scripts/custom/shootable.gsc (18,1)  : Compiler Internal Error :  Uninitialized local variable 'targetname'
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 8 months ago
Posts
3,997
Respect
1,024Add +1
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
got this error when compiled the map:

^1
^1^
^1ERR(6E) scripts/custom/shootable.gsc (15,0)  : Compiler Internal Error :  Uninitialized local variable 'targetname'

Any thoughts on how to fix?

I get this error while compiling?

^1}
^1^
^1ERR(6E) scripts/custom/shootable.gsc (18,1)  : Compiler Internal Error :  Uninitialized local variable 'targetname'


Reck, I suggest testing your scripts before releasing them. Fixed this one for you as well
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
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.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 9 October 2014
Last active: 5 years ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GNT123's Groups
GNT123's Contact & Social Links
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.
broken avatar :(
×
broken avatar :(
Location: gbUnited Kingdom
Date Registered: 28 December 2014
Last active: 4 years ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Signature
Be sure to follow me on Twitter:
https://twitter.com/CraftDAnimation
×
CraftDAnimations's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Did the OP get updated as I am getting the same error when trying to build!

I get this when launching the game

Last Edit: October 10, 2016, 03:18:35 am by CraftDAnimations
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
Did the OP get updated as I am getting the same error when trying to build!

I get this when launching the game

(Image removed from quote.)

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
Code Snippet
Plaintext
thread shootable_1();
thread shootable_2();

Just updated OP.
Last Edit: October 10, 2016, 04:18:57 am by reckfullies
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 June 2013
Last active: 7 years ago
Posts
1
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
88ninjastar's Groups
88ninjastar's Contact & Social Links88ninjastariPhone8
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.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 9 October 2014
Last active: 5 years ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GNT123's Groups
GNT123's Contact & Social Links
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
Code Snippet
Plaintext
thread shootable_1();
thread shootable_2();

Just updated OP.
I can get in the game but after I shoot the model my game get connection interrupted.

 
Loading ...