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

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

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

23I'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

101Put the tree values in rows in a table, and use the random function on the tree rows to get your randox x

12,457(random(1,3)*100)+56

101Ehem, of course use the brilliantly simpler solution of @Socks ...

10,722I 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"

23Thanks you very much, I will do it

12,457What about 356 + random(-2,0)*100

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

12,457I nearly forget:

256+random(-1,1)*100

12,457. . . or

156 +random(0,2)*100

439Is this how you reach 12,000 posts?

23Haha, amazing

23and thanks every body

12,457No, that would be . . .

random(0,0)+12,000

12,457Change 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

23thanks 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

790Google "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.

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

8,786Merged these two threads. Let's remember to keep each topic in one thread, please.

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

23thank 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,786It's related so I think keeping it all in one thread is a good idea.

23ok

12,457Your 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)

?

23ok, 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,457This . . . . 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 ?

23haha 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,360This 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.

23Thanks you very much