Hey I need some help I want the enemy to give you random like health or coins after you kill them I sucks in scripting can somebody make it in C# please
I’m not good in C#, but I believe I can give you a hint in Java Script:
var coin : Transform;
var health : Transform;
private var ran : int;
function Start(){
ran = Random.Range(0,1);
}
function Update(){
if(enemyHealth == 0){
Destroy(gameObject);
if(ran == 0){
Instantiate(coin,transform.position, transform.rotation);
}
if(ran == 1){
Instantiate(health,transform.position, transform.rotation);
}
}
}
thanks for your help but I need it in c#
Well, we usually don’t write scripts FOR people so… However, I don’t believe it’s hard to convert a simple script like this to C#, they’re almost the same.
There are some pretty good free tutorials at
http://walkerboystudio.com/html/unity_training___free__.html#unity3game1
It’s not going to help you to keep asking people to write scripts for you. It’s like asking someone to read for you. Basically, you instantiate a prefab at the character location and rotation when the character is destroyed, probably in the OnCollisionEnter() function.
well I’m new to unity I would like if somebody who can teach me how to scrips in C#
Javascript is easier to learn and it will be very simple switching to c# when you at least learn programming. Stop dictating and start learning.
The link fire7side gave is a good start to learn. I’m using that almost as a guide for my game. I started learning with Tornadoe Twins on YouTube. You should check it out!
I have seen the Tornadoe Twin video before also I’m happy that fire7side give me that link I hope they can help me in C#
lol. I think that’s in Java too for the most part…