×
×
• Create New...
• 0

# Private shop random

## Question

Hello, I would like to modify this function Set Polymorph (30000, true); to put a random VNUM between 10000 and 10100 how?

• Created

## Recommended Posts

• 0

C++ or LUA?

LUA: SetPolymorph(math.random(10000, 10100), true); OR SetPolymorph(number(10000, 10100), true);
C++: SetPolymorph(number(10000, 10100), true);

You can use the 2nd solution for both but there is a difference in LUA:
local var = number(1, 10);
local var2 = math.random(1, 10);
for i = 1, 10 do
chat(var);
chat(var2);
end -- for

will return a different output:
math.random will save the value in the variable, so "chat(var2)" will always return the same number.
while chat(var) will ALWAYS return a different number, cause the "number" function will always randomize the output, even if you save it in a variable, it doesn't save its value.

• 1

My service topic: https://bit.ly/2UPly54

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

• 0
1 hour ago, NabbHackeR said:

C++ or LUA?

LUA: SetPolymorph(math.random(10000, 10100), true); OR SetPolymorph(number(10000, 10100), true);
C++: SetPolymorph(number(10000, 10100), true);

You can use the 2nd solution for both but there is a difference in LUA:
local var = number(1, 10);
local var2 = math.random(1, 10);
for i = 1, 10 do
chat(var);
chat(var2);
end -- for

will return a different output:
math.random will save the value in the variable, so "chat(var2)" will always return the same number.
while chat(var) will ALWAYS return a different number, cause the "number" function will always randomize the output, even if you save it in a variable, it doesn't save its value.

Nice functions.So this can be used in manny things...I want to make an quest so player with an special item can change his level random.With your function its easy.

• 0
11 hours ago, Thanatos said:

Nice functions.So this can be used in manny things...I want to make an quest so player with an special item can change his level random.With your function its easy.

yes

• 1

My service topic: https://bit.ly/2UPly54

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

• 0
3 hours ago, NabbHackeR said:

Ohh,Thank you!

• 0
7 minutes ago, Thanatos said:

Ohh,Thank you!

yw!

My service topic: https://bit.ly/2UPly54

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

• 0

ty !

## Create an account

Register a new account

### Announcements

• -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021

1. 3

2. 2

3. 3

4. 414

5. 11

6. 9

7. 17

8. 17

9. 3