I am making a game in 3DFA.
And I want to work with a dice.
Everything is good and all but I don't exactly know the script for a random number.
I found the functions of Blanius.
This script:
Code:
function randomRange(Min,Max){
return random(Max-Min+1)+Min;
}
And how can I get the output into a textbox. What should I insert as the variable?
Another question about it
My game is becoming a version of a well known game. (don't know how they call it in English).
But what I want is when; die1==1 the position of the player (just a circle with gradient) must go forward one position. And when die1==2 it has to go forward 2 positions etc.
So my questions: How can I set the positions (?? position1=element("player").x.y=145.200 ??).
And how can I make sure he counts the value of die1 to the previous values.
I hope it is clear what I mean and I hope you can help me.
Grtz,, Yoer88
it depends alot on how you are displaying them, and how you are tracking where they are. I'm guessing that you may need to rethink that part of your game. This is something you needed to plan for when starting the project.
you set the position of an object with myobject.position.x and I think myobject.x works just as well. And substitute y for the x for the other dimension.
You should read up on ARRAYS as I've found that is usually the best way to do this sort of board game thing.
this is easy you just need to add in some editboxes or something, like in your starting script say
die=whatever the die says (create some scriot within die to make this work)
position=0 (position will be the varible)
position1=number.x and number.y
position2=number.x and number.y
(ect for hom many positions you have)
then say
if [thedierolls]{
position+=die
}
if position=1{
element (player)=position1
}
thered be a lot of scripting but this is what i first thought of, it has soem holes but you could fill em in.
With regards to random numbers, you'll notice that in the 3DFA viewer, the numbers aren't very random. If you restart the movie, the numbers are the same the second time around.
However, it seems it's OK in the exported movie, so maybe it's not a problem.