It looks like you're new here. If you want to get involved, click one of these buttons!

warloparthur@gmail.com
Posts: **23**Member

in Help Wanted

Hello, I'm scripting a game but I can't resolve a problem: I want to change tree cubes randomly from place: one with the X 56 another with the X 156 and another with the X 256 But they can't be on the same place, so I don't know how change their place randomly and every one have hiw own place, please help me, and sorry for my English, I'm french. Thank's therefor

0

## Comments

23MemberI'm scripting a game but have a problem: I want to change the X from an actor to 156 or 256 or 356 and I want do that randomly, but when you choose the random function you can only put a minimum and a maximum, and I don't wanna change the X to for example 223, it must be 156 or 256 or 356. There is also no functions that express the word 'or' I guess, so thank's to help me and sorry for my English, I'm French

97Member, PROPut the tree values in rows in a table, and use the random function on the tree rows to get your randox x

12,324Member, BASIC(random(1,3)*100)+56

97Member, PROEhem, of course use the brilliantly simpler solution of @Socks ...

10,614Member, Sous Chef, PRO, Senior Sous-ChefI would have gone with (random(6,8)-5)*1000)/10+560/((mod(random(1,4),1)+10)...

...but I agree @Socks' method is simpler.

What about random(1,3).."56"

23MemberThanks you very much, I will do it

12,324Member, BASICWhat about 356 + random(-2,0)*100

5,271Member, BASIC@socks and @tatiang, STOP IT! There is only supposed to be ONE way to do things!!!

12,324Member, BASICI nearly forget:

256+random(-1,1)*100

12,324Member, BASIC. . . or

156 +random(0,2)*100

434MemberIs this how you reach 12,000 posts?

23MemberHaha, amazing

23Memberand thanks every body

12,324Member, BASICNo, that would be . . .

random(0,0)+12,000

12,324Member, BASICChange A to random(0,2)

Change B to mod(A+(random1,2),3)

Change C to 3-(A+B)

Move to / Spawn:

Cube 1 to A *100+56

Cube 2 to B *100+56

Cube 3 to C *100+56

23Memberthanks you very much, but I don't understand what mod(...) is, can you explain, I want to understand what I do, other side it isn't usefull to just do what you say

709Member, PROGoogle "gamesalad mod function"

https://stormystudio.com/math-functions-reference-for-gamesalad-2/

C'est une fonction mathématique.

Socks Il est mathimatics dieu. Les gens ne comprennent pas. Haha.

Script. nous disons Rules in Gamesalad.

Pardon moi Canada French.

23MemberHaha merci beaucoup, je vais faire ca, c'est gentil

8,765Member, Sous Chef, PRO, Bowlboy SidekickMerged these two threads. Let's remember to keep each topic in one thread, please.

23MemberYes, sorry, but it's another subject, so I think it's normal I do two thread, no ?

23Memberthank you very much, but I did a little calculation, and I saw it doesn't work

for example:

A=2

B=mod((2+2)/3)

B=1/3

C=3-(2+1/3)

C=2/3

cube 1: 2*100 + 56 = 256

cube 2: 100/3 + 56 = 89.333 (89+(1/3))

cube 3: 200/3 + 56 = 122.666 (122+(2/3))

maybe there is a fault in your calculation, thank's for help me

8,765Member, Sous Chef, PRO, Bowlboy SidekickIt's related so I think keeping it all in one thread is a good idea.

23Memberok

12,324Member, BASICYour calculation is different to the one I suggested.

For example for cubes 2 and 3 you are dividing 100 by 3 ? There is no division in my suggested calculation ?

Also I'm not sure what this is . . . . B=mod((2+2)/3) . . . ?

My suggestion for B was . . . . . B=mod(A+(random1,2),3)

?

23Memberok, I begin to understand, and if I have four blocks, X1: 56 X2: 156 X3: 256 X4: 356 than the calculation is A=random(0,3) B=mod(A+random(1,3),4) C=4-(A+B), no ? Thank's for helping me

12,324Member, BASICThis . . . . X1 X2 X3 X4 . . . . is 4 values.

This . . . . A B C . . . . is 3 values.

???

Also, if A is 0 and B is 1 then C=4-(A+B) would be 3.

So, for four values, X1, X2, X3 and X4, in this example you would have the three values 0, 1 and 3 ?

23Memberhaha I don't really understand, so with 4 values, what would it be ? I will understand it if you say me , thanks for helping me

4,340Member, PROThis has all been quite entertaining, but it's clearly been very confusing for our poor question asker. This project demonstrates an easy to understand (but not very efficient) method, as well as Sock's original, serious method, explaining what it does.

23MemberThanks you very much