|
Post by Strider on Jun 8, 2017 5:39:09 GMT
Hi! been working on my game (not so much really, not as much as i would like) and wanted to ask, how can i add checkpoints?
i have a little platformer section and then a 3rd person one, but it can get hard at times, and going all the way back can be really tiresome.
Thanks!
|
|
|
Post by jrackley on Jun 8, 2017 6:45:41 GMT
Quick and easy way would be to add a collider and then a simple script to set get the gamecontroller and set the spawn point to be the collider object on trigger enter. I actually have the script on my other computer if you need it. Have not tested it without using easy save though.
|
|
|
Post by Strider on Jun 8, 2017 15:14:53 GMT
Quick and easy way would be to add a collider and then a simple script to set get the gamecontroller and set the spawn point to be the collider object on trigger enter. I actually have the script on my other computer if you need it. Have not tested it without using easy save though.
That would be cool! i'm still getting used to a lot of things in invector, like what to do when the character dies..normally it restarts, but some other times it just stays there lying in the ground. Thanks!
|
|
|
Post by steak on Jun 8, 2017 15:27:02 GMT
I've actually noticed this recently, as well. Sometimes when my ragdoll activates on my character, my dude will just lay there and never stand back up. I don't remember this being a problem in the past, and only noticed it this week. (granted I've been testing some odd scenarios) Players health is only missing a sliver, so he's definitely not dead, but he is also just laying there with some random wiggles of the ragdoll. Anyone else notice this?
|
|
|
Post by Invector on Jun 8, 2017 16:02:20 GMT
I always create new tech demos using new assets from time to time just to check the workflow of the template and to see if everything is working as expected, and since 2.2, 2.2a and now 2.2b we have several important changes on the templates, so I will create another tech demo today to check for current issues
|
|
|
Post by jrackley on Jun 8, 2017 23:17:04 GMT
Quick and easy way would be to add a collider and then a simple script to set get the gamecontroller and set the spawn point to be the collider object on trigger enter. I actually have the script on my other computer if you need it. Have not tested it without using easy save though.
That would be cool! i'm still getting used to a lot of things in invector, like what to do when the character dies..normally it restarts, but some other times it just stays there lying in the ground. Thanks! Here is that script for the checkpoints if you still need it. using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Invector;
public class CheckPoint : MonoBehaviour {
public void OnTriggerEnter(Collider other)
{
if (other.CompareTag ("Player")) {
var gc = FindObjectOfType<vGameController> ();
gc.spawnPoint = this.transform;
//Debug.Log ("Spawn Point = " + gc.spawnPoint);
}
}
}
|
|
|
Post by Strider on Jun 9, 2017 0:02:36 GMT
Thanks a lot!
|
|
|
Post by Strider on Jun 9, 2017 0:20:19 GMT
But... what should i do? i created a box and added a box collider as a trigger, but can't add the script to the object...
|
|
|
Post by jrackley on Jun 9, 2017 0:26:01 GMT
But... what should i do? i created a box and added a box collider as a trigger, but can't add the script to the object... ?I am confused here. Did you create the script and then attach it as a component? All you need to do is create a cube, then add the script to the cube and turn off the mesh renderer on the cube. upload multiple pics
|
|
|
Post by Strider on Jun 9, 2017 0:42:25 GMT
i tried, but it won't allow me to attach the script:
|
|
|
Post by jrackley on Jun 9, 2017 1:28:15 GMT
how did you create the script? It appears that you did not create it at all
|
|
|
Post by jrackley on Jun 9, 2017 1:33:40 GMT
i tried, but it won't allow me to attach the script: you need to right click in the project then go to create c# script and name it exactly the same name as the class i.e. CheckPoint then copy the script I posted into that script that you just created and you will be able to add it. upload picture
|
|
|
Post by Strider on Jun 9, 2017 5:56:43 GMT
ok, got it, i can add the script to the cube, looked like the script needed to be in the scripts/generic folder. the Debug shows that the character is colliding with the cube, but when my character dies, still goes to the start, not the checkpoint.
I suppose i'm missing something still.
Thanks for the help!
|
|
|
Post by jrackley on Jun 9, 2017 6:26:22 GMT
ok, got it, i can add the script to the cube, looked like the script needed to be in the scripts/generic folder. the Debug shows that the character is colliding with the cube, but when my character dies, still goes to the start, not the checkpoint. I suppose i'm missing something still. Thanks for the help! in that case you will need to implement a save feature I have easysave2 so it works fine with that. There are some Unity tutorials about using player prefs to save if you google that, but I highly recommend easysave2 from the asset store.
|
|
|
Post by steak on Jun 9, 2017 12:54:01 GMT
Actually, it just sounds like you don't have your player prefab assigned in your vgamecontroller field. Try just going to your vGameController in your hierarchy, and you should see the field if you look at it's inspector. Make a prefab of your character, and drag it into the player field on the vGameController.
|
|