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
Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
I need help regarding the scripting
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
-
- Superfighter
- Posts: 62
- Joined: Sun Mar 20, 2016 3:40 am
- Title: Custom map lover
- Started SFD: PreAlpha 1.6.4
- Location: Vietnam
- Gender:
- Islem mahmoud
- Fighter
- Posts: 23
- Joined: Mon Oct 31, 2016 9:06 am
- Title: Producer of [RIOT] clan
- SFD Account: El grim
- SFD Alias: El grim
- Started SFD: March 2012
- Location: Algeria
- Gender:
- Age: 27
- Contact:
How did u learn this !Hoang Marcel wrote: ↑Mon Feb 19, 2018 2:53 amList<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
0 x
Hell Man »»» El grim
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
Self-study or previous programming skills from his course of study I guess.Islem mahmoud wrote: ↑Mon Mar 05, 2018 11:18 pmHow did u learn this !Hoang Marcel wrote: ↑Mon Feb 19, 2018 2:53 amList<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
1 x
- Islem mahmoud
- Fighter
- Posts: 23
- Joined: Mon Oct 31, 2016 9:06 am
- Title: Producer of [RIOT] clan
- SFD Account: El grim
- SFD Alias: El grim
- Started SFD: March 2012
- Location: Algeria
- Gender:
- Age: 27
- Contact:
Can you give any book name or channel in youtube that can them help me to learn this shitJakSparro98 wrote: ↑Wed Mar 07, 2018 2:31 pmSelf-study or previous programming skills from his course of study I guess.Islem mahmoud wrote: ↑Mon Mar 05, 2018 11:18 pmHow did u learn this !Hoang Marcel wrote: ↑Mon Feb 19, 2018 2:53 amList<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
& thank you bro
0 x
Hell Man »»» El grim
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
Also known as C#.Islem mahmoud wrote: ↑Fri Mar 09, 2018 10:27 amCan you give any book name or channel in youtube that can them help me to learn this shit[..]
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.
1 x
- Islem mahmoud
- Fighter
- Posts: 23
- Joined: Mon Oct 31, 2016 9:06 am
- Title: Producer of [RIOT] clan
- SFD Account: El grim
- SFD Alias: El grim
- Started SFD: March 2012
- Location: Algeria
- Gender:
- Age: 27
- Contact: