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

How to make something "chanced" of dropping an item on death?

Asked by 6 years ago

Basically, I am a beginner at scripting. I have made it able to drop a weapon on death, but it will do it constantly. How can I make it so there's a chance of it dropping?

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

Set the code on line 3 to the number you want. 0 being impossible, 1 being inevitable, 0.5 being 50/50 and so on.

Script:

math.randomseed(tick()) -- put at BEGINNING of script to make it even more random

if math.random() > 0.5 then
    -- code
end
0
Thank you. P_sychik 7 — 6y
Ad

Answer this question