Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can I use compound inequalities in lua?

Asked by 6 years ago

Can I use compound inequalities to spawn a number of npcs? Like 250>npc>100.

0
Do you mean a random number between 100 and 250? DanzLua 2879 — 6y
0
Yes rilgundam 65 — 6y
0
But the number is the number of npcs that spawn rilgundam 65 — 6y

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

What you can do is use math.random() to get a random number between a range.

Just make a for loop and give it a random number between 100 and 250

for i=1,math.random(100,250) do
    --spawn npc
    --"i" is the current npc it is on
    print("this is the "..i.." npc that was made")
end
0
Wait, what do I put for the light blue text? rilgundam 65 — 6y
0
@rilgundam that was just an example, you want to spawn your npc inside the for loop DanzLua 2879 — 6y
0
Oh ok thx. rilgundam 65 — 6y
Ad

Answer this question