Important News

We have released Shinobi Life Online Pre-Alpha Version 1.1.0.0! This update features Earth Release: Earth Dome Jutsu, Aiming Mode and more! Try it out and tell us what you think.

User

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

Discord

Statistics

Members
Total Members: 53843
Latest: Mehki
New This Month: 41
New This Week: 2
New Today: 2
Stats
Total Posts: 55991
Total Topics: 3364
Most Online Today: 349
Most Online Ever: 4232
(January 14, 2020, 07:47:33)
Users Online
Members: 1
Guests: 311
Total: 314
Grim2021
Google (2)

Author Topic: Chase Script actual code c#  (Read 2159 times)

0 Members and 1 Guest are viewing this topic.

Offline Kakashi Natsu

  • Chunin Poster
  • ***
  • Posts: 141
  • Reputation Power: 2
  • Kakashi Natsu has no influence.
  • Gender: Male
  • Give up trying to make me give up.
    • View Profile
  • Clan: Agni
Chase Script actual code c#
« on: August 11, 2016, 02:34:07 »
it goes haywire when it comes incontact with two players.
Modified(Edited code): enemy now goes unhuman speeds when he moves to the player, then he just stops..., moves out of his trigger box, moves back in again normal then it speeds up.

@Vreg

Code: [Select]
void OnTriggerEnter(Collider other){ //this will check what has entered the trigger


if (playerchosen) {

} else {
if (other.gameObject.tag == "Player") {
print ("player found");
playerchosen = true;
Player = other.gameObject;
}

}
print ("Player Chosen: " +playerchosen);

}
void OnTriggerStay(Collider other){

if (playerchosen) {
Vector3 direction = Player.transform.position - this.transform.position;
Quaternion rotation = Quaternion.LookRotation (direction);
if (rotation.x != 0) {
rotation.x = 0;
}
if (rotation.z != 0) {
rotation.z = 0;
}
this.transform.rotation = Quaternion.Slerp (this.transform.rotation,
rotation, Time.deltaTime + damping);

if (Vector3.Distance (Player.transform.position, this.transform.position) < 15) {
anim.SetBool ("IsIdle", false);
if (direction.magnitude > 1) {
this.transform.Translate (0, 0, 0.1f);
anim.SetBool ("IsWalking", true);
anim.SetBool ("IsAttacking", false);
} else {
anim.SetBool ("IsAttacking", true);

if (canAttack) {
print ("Before invoke");
canAttack = false;
Invoke ("waiting", 2f);
print ("After invoke");
} else {

}
anim.SetBool ("IsWalking", false);
}

} else {


}

} else {
playerchosen = false;


}

print ("Player Chosen: " +playerchosen);
}

void OnTriggerExit(Collider other){ //this will check what has left the trigger

if (other.gameObject.tag != "Player") {//if the game object that left was not a player

playerchosen = true;
} else {

anim.SetBool ("IsWalking", false);
playerchosen = false;
print ("Player left");
}
print (playerchosen);
}
« Last Edit: August 11, 2016, 03:23:44 by Kakashi Natsu »



 

Recent Topics

Uzumaki Clan by LethalDarkness4
March 14, 2022, 23:07:32

My Computer Freezes While Playing 'Shinobi Life Online' by Jamezoar
March 13, 2022, 17:04:23

Crashed when I log in by WeebyJay
November 02, 2021, 00:38:43

The Lie That Never Lived: Shionbi Life Online by Ken
October 26, 2021, 00:28:55

OC by Hikaru_Kitetsu
September 30, 2021, 17:29:28

I suggest we can do genjutsus by NinjaMirage
September 28, 2021, 13:01:13

Hug,slap,kiss or kill - Fourm game. by MarkKlaus3
September 17, 2021, 12:59:31

Unable To Hide Online Status From Xbox! by EfrainSawayn
September 16, 2021, 07:45:04

I suggest that we can customize our character and we can belong to a clan by raruto
August 18, 2021, 22:54:15

I suggest that we can have a biju stamp like naruto and that we can become biju by raruto
August 18, 2021, 22:53:10

Top Posters

Mars
Posts: 2648
Reminance
Posts: 2246
Shivraj
Posts: 1610
m4r1us
Posts: 1298
Manuster
Posts: 1271
NinjaMirage
Posts: 1173
Nova
Posts: 1152
taigakun
Posts: 1099
Fraudulent
Posts: 1098
Konohuro
Posts: 1060