Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Daniel MacIntosh · Apr 28, 2011 at 09:50 PM · respawn

Trying to make a checkpoint script

This is a script I'm working on for a school project. I've been trying to make a script that will respawn my character after they reach a certain point in my game...I've just can't get this to work. This is my first time posting and basically first time scripting for Unity.

Here is my script.

private var active1 = false; var exx = 1.5; var whyy = 37.25; var zeee = -18.82; var dead = false;

function OnControllerColliderHit(hit : ControllerColliderHit) { if (hit.gameObject.tag == "this")

{ active1 = true;

} if (active1 == true && hit.gameObject == "DEATHZONE"){ transform.position = Vector3(exx,whyy,zeee); gameObject.Find("Character").transform.position = Vector3(exx,whyy,zeee); dead = false;

} }

Thanks a bunch. Daniel

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by DaveA · Apr 28, 2011 at 10:06 PM

hit.gameObject == "DEATHZONE" looks very suspicious. Did you mean by 'name of DEATHZONE'? If so, hit.gameObject.name, if 'tag of DEATHZONE' then hit.gameObject.tag

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by zmar0519 · Apr 29, 2011 at 01:54 AM

I suggest a different logic. Look at the lerpz tutorial for a respawn script that uses static vars, not point to point logic.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Daniel MacIntosh · Apr 29, 2011 at 02:51 AM

I'm sorry I should have clarified what I was trying to do better. The game is a simple platformer where you jump from block to block to get to the end goal. If you hit the floor you are respawned at the beginning. I have been getting complaints from classmates that the game is to hard and needs a checkpoint system, so you are not sent back to the beginning of the game once you've gotten to a certain point.

I've checked out and used many of the scripts from Lerpz's tutorial and still can't understand what I need to do for this issue. I was thinking that I need to cancel out the original respawn point at the beginning so the player was able to start again from the checkpoint. Once it was reached. (The Checkpoint is a basic sphere tagged as "this")

DEATHZONE refers to the floor, once hit it calls for the character to be spawned at the beginning location.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Cannot move FPSController after respawning at a spawn point. 1 Answer

help with death zone/respawn 1 Answer

Character Re-spawn Problem 0 Answers

3d Platform tutorial respawn wrong location 3 Answers

Respawn Button 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges