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: 55246
Latest: AkayaKagame
New This Month: 23
New This Week: 4
New Today: 0
Stats
Total Posts: 55921
Total Topics: 3275
Most Online Today: 3951
Most Online Ever: 26696
(March 25, 2026, 17:42:18)
Users Online
Members: 0
Guests: 2499
Total: 2524
Google (AdSense) (5)
Google (12)
Baidu (8)

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

0 Members and 1 Guest are viewing this topic.

Offline Kakashi Natsu

  • Special Jonin Donator
  • Chunin Poster
  • ***
  • Posts: 145
  • Reputation Power: 2
  • Kakashi Natsu has no influence.
  • Gender: Male
    • 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

U4N Examines What Makes MapleStory Classic World Feel Authentic by adonis
September 22, 2026, 07:28:55

U4N Reviews Ranger Strengths Across Aion 2 PvP and PvE by adonis
September 22, 2026, 07:28:03

Material, Technology, and Design in Chocolate Milling Equipment by jsszgusufood
September 22, 2026, 07:27:58

U4N Previews What the Frozen Trail Update Means for ARC Raiders by adonis
September 22, 2026, 07:26:52

Hand Seal Proficiency leading to Improved Jutsu Damage by Kakashi Natsu
April 02, 2026, 15:04:40

Agni by Kakashi Natsu
March 22, 2026, 19:22:09

Fengshui Clan by mamita
March 14, 2026, 21:31:07

Kazuki Raiu by Leebz
February 11, 2026, 22:56:31

Acrobatics by mamita
January 23, 2026, 17:06:01

Shinobi Life Hunger Games by mamita
January 23, 2026, 17:04:48

Top Posters

Mars
Posts: 2637
Reminance
Posts: 2232
Shivraj
Posts: 1610
m4r1us
Posts: 1298
Manuster
Posts: 1265
NinjaMirage
Posts: 1165
Nova
Posts: 1139
taigakun
Posts: 1091
Fraudulent
Posts: 1084
Konohuro
Posts: 1056