I'm new, please help me for a script, I need help !
warloparthur@gmail.com
Member 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
Comments
I'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
Put the tree values in rows in a table, and use the random function on the tree rows to get your randox x
(random(1,3)*100)+56
Ehem, of course use the brilliantly simpler solution of @Socks ...
I 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"
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks you very much, I will do it
What about 356 + random(-2,0)*100
@socks and @tatiang, STOP IT! There is only supposed to be ONE way to do things!!!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I nearly forget:
256+random(-1,1)*100
. . . or
156 +random(0,2)*100
Is this how you reach 12,000 posts?
Haha, amazing
and thanks every body
No, that would be . . .
random(0,0)+12,000
Change 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
thanks 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
Google "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.
Haha merci beaucoup, je vais faire ca, c'est gentil
Merged these two threads. Let's remember to keep each topic in one thread, please.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Yes, sorry, but it's another subject, so I think it's normal I do two thread, no ?
thank 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
It's related so I think keeping it all in one thread is a good idea.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
ok
Your 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)
?
ok, 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
This . . . . 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 ?
haha 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
This 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.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Thanks you very much