Page 1 of 1
Re: I need help regarding the scripting
Posted: Mon Feb 19, 2018 2:53 am
by Hoang Marcel
List<string> objectlist = new List<string>{"Barrel00","BarrelExplosive","Crate00","WpnKnife","WpnPistol","WpnCarbine"};
Random random = new Random();
public void spawnrandomobject(TriggerArgs arg){
IObject spawnpoint = Game.GetSingleObjectByCustomID("spawnpoint");
int randomnumber = random.Next(5); //Number of objects in the object list
string randomobject = objectlist[randomnumber];
Game.CreateObject(randomobject, spawnpoint.GetWorldPosition());
}
Create a button with script method spawnrandomobject and an invisibleblocknocollision with custom id spawnpoint
Each time you press the button it will spawn a random object at the position of the invisible block
Re: I need help regarding the scripting
Posted: Mon Mar 05, 2018 11:18 pm
by Islem mahmoud
Hoang Marcel wrote: ↑Mon Feb 19, 2018 2:53 am
List<string> objectlist = new List<string>{"Barrel00","BarrelExplosive","Crate00","WpnKnife","WpnPistol","WpnCarbine"};
Random random = new Random();
public void spawnrandomobject(TriggerArgs arg){
IObject spawnpoint = Game.GetSingleObjectByCustomID("spawnpoint");
int randomnumber = random.Next(5); //Number of objects in the object list
string randomobject = objectlist[randomnumber];
Game.CreateObject(randomobject, spawnpoint.GetWorldPosition());
}
Create a button with script method spawnrandomobject and an invisibleblocknocollision with custom id spawnpoint
Each time you press the button it will spawn a random object at the position of the invisible block
How did u learn this !
Re: I need help regarding the scripting
Posted: Wed Mar 07, 2018 2:31 pm
by JakSparro98
Islem mahmoud wrote: ↑Mon Mar 05, 2018 11:18 pm
Hoang Marcel wrote: ↑Mon Feb 19, 2018 2:53 am
List<string> objectlist = new List<string>{"Barrel00","BarrelExplosive","Crate00","WpnKnife","WpnPistol","WpnCarbine"};
Random random = new Random();
public void spawnrandomobject(TriggerArgs arg){
IObject spawnpoint = Game.GetSingleObjectByCustomID("spawnpoint");
int randomnumber = random.Next(5); //Number of objects in the object list
string randomobject = objectlist[randomnumber];
Game.CreateObject(randomobject, spawnpoint.GetWorldPosition());
}
Create a button with script method spawnrandomobject and an invisibleblocknocollision with custom id spawnpoint
Each time you press the button it will spawn a random object at the position of the invisible block
How did u learn this !
Self-study or previous programming skills from his course of study I guess.

Re: I need help regarding the scripting
Posted: Fri Mar 09, 2018 10:27 am
by Islem mahmoud
JakSparro98 wrote: ↑Wed Mar 07, 2018 2:31 pm
Islem mahmoud wrote: ↑Mon Mar 05, 2018 11:18 pm
Hoang Marcel wrote: ↑Mon Feb 19, 2018 2:53 am
List<string> objectlist = new List<string>{"Barrel00","BarrelExplosive","Crate00","WpnKnife","WpnPistol","WpnCarbine"};
Random random = new Random();
public void spawnrandomobject(TriggerArgs arg){
IObject spawnpoint = Game.GetSingleObjectByCustomID("spawnpoint");
int randomnumber = random.Next(5); //Number of objects in the object list
string randomobject = objectlist[randomnumber];
Game.CreateObject(randomobject, spawnpoint.GetWorldPosition());
}
Create a button with script method spawnrandomobject and an invisibleblocknocollision with custom id spawnpoint
Each time you press the button it will spawn a random object at the position of the invisible block
How did u learn this !
Self-study or previous programming skills from his course of study I guess.
Can you give any book name or channel in youtube that can them help me to learn this shit
& thank you bro
Re: I need help regarding the scripting
Posted: Sat Mar 10, 2018 7:12 pm
by JakSparro98
Islem mahmoud wrote: ↑Fri Mar 09, 2018 10:27 am
Can you give any book name or channel in youtube that can them help me to learn this shit[..]
Also known as C#.

If you google around there are tons of video covering programming languages in general, you can achieve pretty the same level of mine, that I learned programming fundaments at school, but in my opinion I think it's always better to take a complete course (and it results in paying some money for learning) to master programming in the right way, and more importantly, to have constant support of skilled people when problems occurs, and trust me, silly problems will always occur and when you realise what the problem was you will feel like an idiot, personal experience.

Re: I need help regarding the scripting
Posted: Sun Mar 11, 2018 1:20 pm
by Islem mahmoud

tnx bro
