Author Topic: [Tutorial] Shootable Triggers  (Read 17851 times)

0 Members and 1 Guest are viewing this topic.

Offline reckfullies

  • - Original Poster (OP) -
  • Perk Hacker
  • Posts: 306
  • Country: us
  • Respect: 68
    • Reckfullies's YouTube Channel
    • View Profile
  • WaW: Reckfullies

[Tutorial] Shootable Triggers

« on: October 08, 2016, 03:21:24 pm »
This is an updated tutorial on how to make shootable triggers. The last version was filled with bugs since I never really tested it so i thought I would just redo the entire tutorial with better code methods and making sure it works. I might even make additional tutorials on how to make it work with doors, music etc.

WIP Tutorial - Not Complete
You must have an account to view the spoiler contents. Please log in or create an account.

Step 2 - Setting Up Script
You must have an account to view the spoiler contents. Please log in or create an account.
[/spoiler]

Old Tutorial(Use this one until the other tutorial is complete!):
You must have an account to view the spoiler contents. Please log in or create an account.
« Last Edit: November 02, 2016, 10:18:20 pm by reckfullies »
If anyone needs scripts made for their map contact me.

Offline mindy12345

  • Fresh Corpse
  • Posts: 3
  • Country: gb
  • Respect: 0
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #1 on: October 08, 2016, 03:59:21 pm »
can you make  me a script where i shoot 3 teddy bears it gives me electric cherry

Offline reckfullies

  • - Original Poster (OP) -
  • Perk Hacker
  • Posts: 306
  • Country: us
  • Respect: 68
    • Reckfullies's YouTube Channel
    • View Profile
  • WaW: Reckfullies

Re: [Tutorial] Shootable Triggers

« Reply #2 on: October 08, 2016, 04:54:52 pm »
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: [Select]
#using scripts\zm\_zm_perks;

Change:
Code: [Select]
function shootables_done()
to
Code: [Select]
function shootables_done(player)

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

lastly go back into shootables_done and add this under the IPrintLn:
Code: [Select]
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.

Offline Blink-420

  • Rotting Walker
  • Posts: 63
  • Country: us
  • Respect: 13
    • Blink-420
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #3 on: October 08, 2016, 07:38:14 pm »
^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?

Offline xTundra

  • Fresh Corpse
  • Posts: 4
  • Country: us
  • Respect: 0
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #4 on: October 09, 2016, 01:49:55 am »
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?

Offline HitmanVere

  • Eviscerator
  • UGX V.I.P.
  • Posts: 3,912
  • Country: fi
  • Respect: 839
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #5 on: October 09, 2016, 06:30:22 am »
^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

Offline GNT123

  • Legless Crawler
  • Posts: 15
  • Country: us
  • Respect: 1
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #6 on: October 09, 2016, 10:02:07 am »
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?

Offline harvez

  • Legless Crawler
  • Posts: 5
  • Country: gb
  • Respect: 0
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #7 on: October 09, 2016, 11:21:44 am »
I get this error while compiling?

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

Offline HitmanVere

  • Eviscerator
  • UGX V.I.P.
  • Posts: 3,912
  • Country: fi
  • Respect: 839
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #8 on: October 09, 2016, 02:00:56 pm »
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

Offline reckfullies

  • - Original Poster (OP) -
  • Perk Hacker
  • Posts: 306
  • Country: us
  • Respect: 68
    • Reckfullies's YouTube Channel
    • View Profile
  • WaW: Reckfullies

Re: [Tutorial] Shootable Triggers

« Reply #9 on: October 09, 2016, 03:23:36 pm »
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.

Offline GNT123

  • Legless Crawler
  • Posts: 15
  • Country: us
  • Respect: 1
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #10 on: October 09, 2016, 05:26:53 pm »
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.

Offline CraftDAnimations

  • *
  • Legless Crawler
  • Posts: 45
  • Country: gb
  • Respect: 22
    • CraftDAnimations
    • CraftDAnimation' Twitter Feed
    • CraftDAnimation's YouTube Channel
    • View Profile
    • My YouTube Channel

Re: [Tutorial] Shootable Triggers

« Reply #11 on: October 09, 2016, 05:54:10 pm »
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 09, 2016, 06:18:35 pm by CraftDAnimations »
Be sure to follow me on Twitter:
[You are not allowed to view external links. Register or Login to see them]

Offline reckfullies

  • - Original Poster (OP) -
  • Perk Hacker
  • Posts: 306
  • Country: us
  • Respect: 68
    • Reckfullies's YouTube Channel
    • View Profile
  • WaW: Reckfullies

Re: [Tutorial] Shootable Triggers

« Reply #12 on: October 09, 2016, 07:13:20 pm »
Did the OP get updated as I am getting the same error when trying to build!

I get this when launching the game

( [You are not allowed to view external links. Register or Login to see them] .)

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: [Select]
thread shootable_1();
thread shootable_2();

Just updated OP.
« Last Edit: October 09, 2016, 07:18:57 pm by reckfullies »

Offline 88ninjastar

  • Fresh Corpse
  • Posts: 1
  • Country: us
  • Respect: 0
    • 88ninjastar
    • View Profile
  • WaW: iPhone8

Re: [Tutorial] Shootable Triggers

« Reply #13 on: October 09, 2016, 07:29:33 pm »
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.

Offline GNT123

  • Legless Crawler
  • Posts: 15
  • Country: us
  • Respect: 1
    • View Profile

Re: [Tutorial] Shootable Triggers

« Reply #14 on: October 09, 2016, 08:00:01 pm »
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: [Select]
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.