Random character on spawn
by Kevin Leslie · in Game Design and Creative Issues · 05/04/2009 (8:57 pm) · 3 replies
Hi I was wondering if someone could help me with making it so a random character would spawn. Like instead of just having kork spawn for each person some people would spawn as lets say the elf from the demo.
#2
// Create the player object
%player = new Player() {
dataBlock = PlayerBody;
dataBlock = PlayerBody2;
correct?
05/04/2009 (11:30 pm)
Well thats the thing, now it will only spawn me as the elf. Unless i'm mistaken you ment to make the code in create player like this// Create the player object
%player = new Player() {
dataBlock = PlayerBody;
dataBlock = PlayerBody2;
correct?
#3
What you need to do is get a random number and make some comparison - if the comparison is true, use one datablock, otherwise use the other.
05/05/2009 (3:42 am)
The script you've written here sets the Player's datablock to be PlayerBody, then sets it to be PlayerBody2. So your player will only ever spawn with the PlayerBody2 datablock, because that's the last thing set each time. If you swap those two lines, you'll always spawn as Kork.What you need to do is get a random number and make some comparison - if the comparison is true, use one datablock, otherwise use the other.
Associate Michael Hall
Distracted...