x


kill boundary script

does anyone know a script that when you walk into the area it will kill your character? if so what is the script? also how would i insert the script into the game so that the block is invisible?

I would also like a script that gives you time to return to the game area.

more ▼

asked Jul 10 '11 at 11:54 PM

infectedgamer51 gravatar image

infectedgamer51
29 9 14 16

Take a look at the Lerpz tutorial, it covers this.

Jul 11 '11 at 01:07 AM Chris D
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can use triggers to check when something enters that area. A trigger is just a collider in which you set the Is Trigger option. You can create a cube, adjust its position and size (scale) to the area you want to cover, and check the Is Trigger option. Name it "KillArea", then disable the Mesh Renderer : the trigger will become invisible.
Include the OnTriggerEnter function in the player script:

function OnTriggerEnter(col:Collider){

  if (col.name == "KillArea"){ // die only in this trigger!
    // do whatever you want to kill your player:
    // zero health, decrement lives, make him scream, etc.
    // or just write a message to the console to test this trigger:
    print("Arghhh... I'm dead!");
  }

Well, the rest is on you. A good start point is to download the FPS Tutorial Completed and follow the instructions found in FPS_Tutorial_1 to 3.

more ▼

answered Jul 11 '11 at 01:07 AM

aldonaletto gravatar image

aldonaletto
41.3k 16 42 195

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2484
x981
x383
x63

asked: Jul 10 '11 at 11:54 PM

Seen: 940 times

Last Updated: Jul 11 '11 at 01:07 AM