1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved My quest skript doesn't give a quest sometimes and it also sometimes gives more than 1 quest

Discussion in 'Skript' started by PureNuggets, Jul 13, 2021.

Thread Status:
Not open for further replies.
  1. PureNuggets

    PureNuggets Member

    Joined:
    Jun 25, 2021
    Messages:
    17
    Likes Received:
    0
    So as the title says. My quest skript that I've been tryna fix for around 2 days gives more than 1 quest sometimes and it's pretty dumb. Heres the skript.

    Code (Text):
    1. function tokenReward(p: player):
    2.   chance of 50%:
    3.     send "&eYou have completed a quest and have gotten 1 Quest Token" to {_p}
    4.     give {_p} sunflower named "&eQuest Token" with lore "&bUse This Token To Redeem Rewards"
    5.   chance of 35%:
    6.     send "&eYou have completed a quest and have gotten 2 Quest Tokens" to {_p}
    7.     give {_p} 2 sunflower named "&eQuest Token" with lore "&bUse This Token To Redeem Rewards"
    8.   chance of 15%:
    9.     send "&eYou have completed a quest and have gotten 3 Quest Tokens" to {_p}
    10.     give {_p} 3 sunflower named "&eQuest Token" with lore "&bUse This Token To Redeem Rewards"
    11.  
    12. function play1hQuest(p: player):
    13.   send "&eYou have gotten the quest:" to {_p}
    14.   wait 1 second
    15.   send "" to {_p}
    16.   send "&ePlay for 1 hour" to {_p}
    17.   set {quests::%{_p}%'s uuid::play1hQuest} to 1
    18.  
    19. function play45Quest(p: player):
    20.   send "&eYou have gotten the quest:" to {_p}
    21.   wait 1 second
    22.   send "" to {_p}
    23.   send "&ePlay for 45 minutes" to {_p}
    24.   set {quests::%{_p}%'s uuid::play45Quest} to 1
    25.  
    26. function play30Quest(p: player):
    27.   send "&eYou have gotten the quest:" to {_p}
    28.   wait 1 second
    29.   send "" to {_p}
    30.   send "&ePlay for 30 minutes" to {_p}
    31.   set {quests::%{_p}%'s uuid::play30Quest} to 1
    32.  
    33. function cobble256Quest(p: player):
    34.   send "&eYou have gotten the quest:" to {_p}
    35.   wait 1 second
    36.   send "" to {_p}
    37.   send "&eMine 256 Cobblestone" to {_p}
    38.   set {quests::%{_p}%'s uuid::cobble256Quest} to 1
    39.  
    40. function cobble192Quest(p: player):
    41.   send "&eYou have gotten the quest:" to {_p}
    42.   wait 1 second
    43.   send "" to {_p}
    44.   send "&eMine 192 Cobblestone" to {_p}
    45.   set {quests::%{_p}%'s uuid::cobble192Quest} to 1
    46.  
    47. function breadQuest(p: player):
    48.   send "&eYou have gotten the quest:" to {_p}
    49.   wait 1 second
    50.   send "" to {_p}
    51.   send "&eCraft 48 Bread" to {_p}
    52.   send "&eP.S... You can't shift click craft as it will only count as 1 item crafted!" to {_p}
    53.   set {quests::%{_p}%'s uuid::breadQuest} to 1
    54.  
    55. function sugarQuest(p: player):
    56.   send "&eYou have gotten the quest:" to {_p}
    57.   wait 1 second
    58.   send "" to {_p}
    59.   send "&eCraft 2 Stacks Of Sugar" to {_p}
    60.   send "&eP.S... You can't shift click craft as it will only count as 1 item crafted!" to {_p}
    61.   set {quests::%{_p}%'s uuid::sugarQuest} to 1
    62.  
    63. function fish30Quest(p: player):
    64.   send "&eYou have gotten the quest:" to {_p}
    65.   wait 1 second
    66.   send "" to {_p}
    67.   send "&eFish 30 Items" to {_p}
    68.   set {quests::%{_p}%'s uuid::fish30Quest} to 1
    69.  
    70. function fish25Quest(p: player):
    71.   send "&eYou have gotten the quest:" to {_p}
    72.   wait 1 second
    73.   send "" to {_p}
    74.   send "&eFish 25 Items" to {_p}
    75.   set {quests::%{_p}%'s uuid::fish25Quest} to 1
    76.  
    77. function walk1500Quest(p: player):
    78.   send "&eYou have gotten the quest:" to {_p}
    79.   wait 1 second
    80.   send "" to {_p}
    81.   send "&eWalk 1500 Blocks" to {_p}
    82.   set {quests::%{_p}%'s uuid::walk1500Quest} to 1
    83.  
    84. function walk1000Quest(p: player):
    85.   send "&eYou have gotten the quest:" to {_p}
    86.   wait 1 second
    87.   send "" to {_p}
    88.   send "&eWalk 1000 Blocks" to {_p}
    89.   set {quests::%{_p}%'s uuid::walk1kQuest} to 1
    90.  
    91. function place200Quest(p: player):
    92.   send "&eYou have gotten the quest:" to {_p}
    93.   wait 1 second
    94.   send "" to {_p}
    95.   send "&ePlace 200 Blocks" to {_p}
    96.   set {quests::%{_p}%'s uuid::place200Quest} to 1
    97.  
    98. function place150Quest(p: player):
    99.   send "&eYou have gotten the quest:" to {_p}
    100.   wait 1 second
    101.   send "" to {_p}
    102.   send "&ePlace 150 Blocks" to {_p}
    103.   set {quests::%{_p}%'s uuid::place150Quest} to 1
    104.  
    105. function break200Quest(p: player):
    106.   send "&eYou have gotten the quest:" to {_p}
    107.   wait 1 second
    108.   send "" to {_p}
    109.   send "&eBreak 200 Blocks" to {_p}
    110.   set {quests::%{_p}%'s uuid::break200Quest} to 1
    111.  
    112. function break150Quest(p: player):
    113.   send "&eYou have gotten the quest:" to {_p}
    114.   wait 1 second
    115.   send "" to {_p}
    116.   send "&eBreak 150 Blocks" to {_p}
    117.   set {quests::%{_p}%'s uuid::break150Quest} to 1
    118.  
    119. function endermanQuest(p: player):
    120.   send "&eYou have gotten the quest:" to {_p}
    121.   wait 1 second
    122.   send "" to {_p}
    123.   send "&eKill 40 Zombies" to {_p}
    124.   set {quests::%{_p}%'s uuid::endermanQuest} to 1
    125.  
    126. function spiderQuest(p: player):
    127.   send "&eYou have gotten the quest:" to {_p}
    128.   wait 1 second
    129.   send "" to {_p}
    130.   send "&eKill 50 Spiders" to {_p}
    131.   set {quests::%{_p}%'s uuid::spiderQuest} to 1
    132.  
    133. function creeperQuest(p: player):
    134.   send "&eYou have gotten the quest:" to {_p}
    135.   wait 1 second
    136.   send "" to {_p}
    137.   send "&eKill 50 Creepers" to {_p}
    138.   set {quests::%{_p}%'s uuid::creeperQuest} to 1
    139.  
    140. function skeletonQuest(p: player):
    141.   send "&eYou have gotten the quest:" to {_p}
    142.   wait 1 second
    143.   send "" to {_p}
    144.   send "&eKill 50 Skeletons" to {_p}
    145.   set {quests::%{_p}%'s uuid::skeletonQuest} to 1
    146.  
    147. function zombieQuest(p: player):
    148.   send "&eYou have gotten the quest:" to {_p}
    149.   wait 1 second
    150.   send "" to {_p}
    151.   send "&eKill 50 Zombies" to {_p}
    152.   set {quests::%{_p}%'s uuid::zombieQuest} to 1
    153.  
    154.  
    155. function loadQuests():
    156.   loop all offline players:
    157.     delete {quests::%loop-offlineplayer%'s uuid::*}
    158.   broadcast "&eQuests By &e&lPureNuggets!"
    159.  
    160.  
    161.  
    162. function getQuest(p: player):
    163.   if {quests::%{_p}%'s uuid::*} is set:
    164.     send "&cYou already have a ongoing quest!" to {_p}
    165.   else:
    166.     send "" to {_p}
    167.     send "&eRolling you a random quest!" to {_p}
    168.     send "" to {_p}
    169.     wait 3 seconds
    170.     chance of 5%: #Kill 50 Zombies
    171.       zombieQuest({_p})
    172.     chance of 5%: #Kill 50 Skeletons
    173.       skeletonQuest({_p})
    174.     chance of 5%: #Kill 50 Creepers
    175.       creeperQuest({_p})
    176.     chance of 5%: #Kill 50 Spiders
    177.       spiderQuest({_p})
    178.     chance of 5%: #Kill 40 Endermen
    179.       endermanQuest({_p})
    180.     chance of 5%: #Break 150 Blocks
    181.       break150Quest({_p})
    182.     chance of 5%: #Break 200 Blocks
    183.       break200Quest({_p})
    184.     chance of 5%: #Place 150 Blocks
    185.       place150Quest({_p})
    186.     chance of 5%: #Place 200 Blocks
    187.       place200Quest({_p})
    188.     chance of 5%: #Walk 1k Blocks
    189.       walk1000Quest({_p})
    190.     chance of 5%: #Walk 1.5k Blocks
    191.       walk1500Quest({_p})
    192.     chance of 5%: #Fish 25 Items
    193.       fish25Quest({_p})
    194.     chance of 5%: #Fish 30 Items
    195.       fish30Quest({_p})
    196.     chance of 5%: #Craft 128 Sugar
    197.       sugarQuest({_p})
    198.     chance of 5%: #Craft 48 Bread
    199.       breadQuest({_p})
    200.     chance of 5%: #Break 192 Cobble
    201.       cobble192Quest({_p})
    202.     chance of 5%: #Break 256 Cobble
    203.       cobble256Quest({_p})
    204.     chance of 5%: #Play For 30 Minutes
    205.       play30Quest({_p})
    206.     chance of 5%: #Play For 45 Minutes
    207.       play45Quest({_p})
    208.     chance of 5%: #Play For 1 Hour
    209.       play1hQuest({_p})
    210.      
    211.  
    212. command /quest:
    213.   cooldown: 1 day
    214.   trigger:
    215.     getQuest(player)
    216.    
    217. command /loadquests:
    218.   permission: quests.load
    219.   trigger:
    220.     loadQuests()
    221.    
    222. on load:
    223.   loadQuests()
    224.    
    225. on death:
    226.   if victim is zombie:
    227.     if {quests::%attacker%'s uuid::zombieQuest} is set:
    228.       add 1 to {quests::%attacker%'s uuid::zombieQuest}
    229.       send "&eYou have killed %{quests::%attacker%'s uuid::zombieQuest} - 1%&e/50 Zombies!" to attacker
    230.       if {quests::%attacker%'s uuid::zombieQuest} > 50:
    231.         send "&eYou have completed the following quest:" to attacker
    232.         send "" to attacker
    233.         send "&eKill 50 Zombies" to attacker
    234.         delete {quests::%attacker%'s uuid::zombieQuest}
    235.         tokenReward(attacker)
    236.   if victim is skeleton:
    237.     if {quests::%attacker%'s uuid::skeletonQuest} is set:
    238.       add 1 to {quests::%attacker%'s uuid::skeletonQuest}
    239.       send "&eYou have killed %{quests::%attacker%'s uuid::skeletonQuest} - 1%&e/50 Skeletons!" to attacker
    240.       if {quests::%attacker%'s uuid::skeletonQuest} > 50:
    241.         send "&eYou have completed the following quest:" to attacker
    242.         send "" to attacker
    243.         send "&eKill 50 Skeletons" to attacker
    244.         delete {quests::%attacker%'s uuid::skeletonQuest}
    245.         tokenReward(attacker)
    246.   if victim is creeper:
    247.     if {quests::%attacker%'s uuid::creeperQuest} is set:
    248.       add 1 to {quests::%attacker%'s uuid::creeperQuest}
    249.       send "&eYou have killed %{quests::%attacker%'s uuid::creeperQuest} - 1%&e/50 Creepers!" to attacker
    250.       if {quests::%attacker%'s uuid::creeperQuest} > 50:
    251.         send "&eYou have completed the following quest:" to attacker
    252.         send "" to attacker
    253.         send "&eKill 50 Creepers" to attacker
    254.         delete {quests::%attacker%'s uuid::creeperQuest}
    255.         tokenReward(attacker)
    256.   if victim is spider:
    257.     if {quests::%attacker%'s uuid::spiderQuest} is set:
    258.       add 1 to {quests::%attacker%'s uuid::spiderQuest}
    259.       send "&eYou have killed %{quests::%attacker%'s uuid::spiderQuest} - 1%&e/50 Spiders!" to attacker
    260.       if {quests::%attacker%'s uuid::spiderQuest} > 50:
    261.         send "&eYou have completed the following quest:" to attacker
    262.         send "" to attacker
    263.         send "&eKill 50 Spiders" to attacker
    264.         delete {quests::%attacker%'s uuid::spiderQuest}
    265.         tokenReward(attacker)
    266.   if victim is enderman:
    267.     if {quests::%attacker%'s uuid::endermanQuest} is set:
    268.       add 1 to {quests::%attacker%'s uuid::endermanQuest}
    269.       send "&eYou have killed %{quests::%attacker%'s uuid::endermanQuest} - 1%&e/50 Endermen!" to attacker
    270.       if {quests::%attacker%'s uuid::endermanQuest} > 50:
    271.         send "&eYou have completed the following quest:" to attacker
    272.         send "" to attacker
    273.         send "&eKill 50 Endermen" to attacker
    274.         delete {quests::%attacker%'s uuid::endermanQuest}
    275.         tokenReward(attacker)
    276.  
    277. on break:
    278.   if {quests::%player%'s uuid::break150Quest} is set:
    279.     add 1 to {quests::%player%'s uuid::break150Quest}
    280.     send "&eYou have broken %{quests::%player%'s uuid::break150Quest} - 1%&e/150 Blocks" to player
    281.     if {quests::%player%'s uuid::break150Quest} > 150:
    282.       send "&eYou have completed the following quest:" to player
    283.       send "" to player
    284.       send "&eBreak 150 Blocks" to player
    285.       delete {quests::%player%'s uuid::break150Quest}
    286.       tokenReward(player)
    287.   if {quests::%player%'s uuid::break200Quest} is set:
    288.     add 1 to {quests::%player%'s uuid::break200Quest}
    289.     send "&eYou have broken %{quests::%player%'s uuid::break150Quest} - 1%&e/200 Blocks" to player
    290.     if {quests::%player%'s uuid::break200Quest} > 200:
    291.       send "&eYou have completed the following quest:" to player
    292.       send "" to player
    293.       send "&eBreak 200 Blocks" to player
    294.       delete {quests::%player%'s uuid::break200Quest}
    295.       tokenReward(player)
    296.   if {quests::%player%'s uuid::cobble192Quest} is set:
    297.     if event-block is stone or cobblestone:
    298.       add 1 to {quests::%player%'s uuid::cobble192Quest}
    299.       send "&eYou have broken %{quests::%player%'s uuid::cobble192Quest} - 1%&e/192 Cobblestone" to player
    300.       if {quests::%player%'s uuid::cobble192Quest} > 192:
    301.         send "&eYou have completed the following quest:" to player
    302.         send "" to player
    303.         send "&eBreak 192 Cobblestone" to player
    304.         delete {quests::%player%'s uuid::cobble192Quest}
    305.         tokenReward(player)
    306.   if {quests::%player%'s uuid::cobble256Quest} is set:
    307.     if event-block is stone or cobblestone:
    308.       add 1 to {quests::%player%'s uuid::cobble256Quest}
    309.       send "&eYou have broken %{quests::%player%'s uuid::cobble256Quest} - 1%&e/256 Cobblestone" to player
    310.       if {quests::%player%'s uuid::cobble256Quest} > 256:
    311.         send "&eYou have completed the following quest:" to player
    312.         send "" to player
    313.         send "&eBreak 256 Cobblestone" to player
    314.         delete {quests::%player%'s uuid::cobble256Quest}
    315.         tokenReward(player)
    316.  
    317. on place:
    318.   if {quests::%player%'s uuid::place150Quest} is set:
    319.     add 1 to {quests::%player%'s uuid::place150Quest}
    320.     send "&eYou have placed %{quests::%player%'s uuid::place150Quest} - 1%&e/150 Blocks" to player
    321.     if {quests::%player%'s uuid::place150Quest} > 150:
    322.       send "&eYou have completed the following quest:" to player
    323.       send "" to player
    324.       send "&ePlace 150 Blocks" to player
    325.       delete {quests::%player%'s uuid::place150Quest}
    326.       tokenReward(player)
    327.   if {quests::%player%'s uuid::place200Quest} is set:
    328.     add 1 to {quests::%player%'s uuid::place200Quest}
    329.     send "&eYou have placed %{quests::%player%'s uuid::place200Quest} - 1%&e/200 Blocks" to player
    330.     if {quests::%player%'s uuid::place200Quest} > 200:
    331.       send "&eYou have completed the following quest:" to player
    332.       send "" to player
    333.       send "&ePlace 200 Blocks" to player
    334.       delete {quests::%player%'s uuid::place200Quest}
    335.       tokenReward(player)
    336.  
    337. on fish:
    338.   fish state is CAUGHT_FISH:
    339.     if {quests::%player%'s uuid::fish25Quest} is set:
    340.       add 1 to {quests::%player%'s uuid::fish25Quest}
    341.       send "&eYou have fished %{quests::%player%'s uuid::fish25Quest} - 1%/25 Times"
    342.       if {quests::%player%'s uuid::fish25Quest} > 25:
    343.         send "&eYou have completed the following quest:" to player
    344.         send "" to player
    345.         send "&eFish 25 Items" to player
    346.         delete {quests::%player%'s uuid::fish25Quest}
    347.         tokenReward(player)
    348.     if {quests::%player%'s uuid::fish30Quest} is set:
    349.       add 1 to {quests::%player%'s uuid::fish30Quest}
    350.       send "&eYou have fished %{quests::%player%'s uuid::fish30Quest} - 1%/30 Times"
    351.       if {quests::%player%'s uuid::fish30Quest} > 30:
    352.         send "&eYou have completed the following quest:" to player
    353.         send "" to player
    354.         send "&eFish 30 Items" to player
    355.         delete {quests::%player%'s uuid::fish30Quest}
    356.         tokenReward(player)
    357.      
    358. every 1 minute:
    359.   loop all players:
    360.     if {quests::%loop-player%'s uuid::play30Quest} is set:
    361.       add 1 to {quests::%loop-player%'s uuid::play30Quest}
    362.       if {quests::%loop-player%'s uuid::play30Quest} > 30:
    363.         send "&eYou have completed the following quest:" to loop-player
    364.         send "" to loop-player
    365.         send "&ePlay For 30 Minutes" to loop-player
    366.         delete {quests::%loop-player%'s uuid::play30Quest}
    367.         tokenReward(loop-player)
    368.     if {quests::%loop-player%'s uuid::play45Quest} is set:
    369.       add 1 to {quests::%loop-player%'s uuid::play45Quest}
    370.       if {quests::%loop-player%'s uuid::play45Quest} > 45:
    371.         send "&eYou have completed the following quest:" to loop-player
    372.         send "" to loop-player
    373.         send "&ePlay For 45 Minutes" to loop-player
    374.         delete {quests::%loop-player%'s uuid::play45Quest}
    375.         tokenReward(loop-player)
    376.     if {quests::%loop-player%'s uuid::play1hQuest} is set:
    377.       add 1 to {quests::%loop-player%'s uuid::play1hQuest}
    378.       if {quests::%loop-player%'s uuid::play1hQuest} > 60:
    379.         send "&eYou have completed the following quest:" to loop-player
    380.         send "" to loop-player
    381.         send "&ePlay For 1 Hour" to loop-player
    382.         delete {quests::%loop-player%'s uuid::play1hQuest}
    383.         tokenReward(loop-player)
    384.  
    385. on any move:
    386.   if {quests::%player%'s uuid::walk1kQuest} is set:
    387.     add 1 to {quests::%player%'s uuid::walk1kQuest}
    388.     if {quests::%player%'s uuid::walk1kQuest} > 1000:
    389.       send "&eYou have completed the following quest:" to player
    390.       send "" to player
    391.       send "&eWalk 1000 Blocks" to player
    392.       delete {quests::%player%'s uuid::walk1kQuest}
    393.       tokenReward(player)
    394.   if {quests::%player%'s uuid::walk1500Quest} is set:
    395.     add 1 to {quests::%player%'s uuid::walk1500Quest}
    396.     if {quests::%player%'s uuid::walk1500Quest} > 1000:
    397.       send "&eYou have completed the following quest:" to player
    398.       send "" to player
    399.       send "&eWalk 1500 Blocks" to player
    400.       delete {quests::%player%'s uuid::walk1500Quest}
    401.       tokenReward(player)
    402.  
    403. on craft:
    404.   if event-item is sugar:
    405.     if {quests::%player%'s uuid::sugarQuest} is set:
    406.       add 1 to {quests::%player%'s uuid::sugarQuest}
    407.       send "&eYou have crafted %{quests::%player%'s uuid::sugarQuest} - 1%&e/128 sugar"
    408.       if {quests::%player%'s uuid::sugarQuest} > 128:
    409.         send "&eYou have completed the following quest:" to player
    410.         send "" to player
    411.         send "&eCraft 128 Sugar" to player
    412.         delete {quests::%player%'s uuid::sugarQuest}
    413.         tokenReward(player)
    414.   if event-item is bread:
    415.     if {quests::%player%'s uuid::breadQuest} is set:
    416.       add 1 to {quests::%player%'s uuid::breadQuest}
    417.       send "&eYou have crafted %{quests::%player%'s uuid::sugarQuest} - 1%&e/48 bread"
    418.       if {quests::%player%'s uuid::sugarQuest} > 48:
    419.         send "&eYou have completed the following quest:" to player
    420.         send "" to player
    421.         send "&eCraft 48 Bread" to player
    422.         delete {quests::%player%'s uuid::breadQuest}
    423.         tokenReward(player)
    424.      
    the part that rolls the quest is this part:

    Code (Text):
    1. function getQuest(p: player):
    2.   if {quests::%{_p}%'s uuid::*} is set:
    3.     send "&cYou already have a ongoing quest!" to {_p}
    4.   else:
    5.     send "" to {_p}
    6.     send "&eRolling you a random quest!" to {_p}
    7.     send "" to {_p}
    8.     wait 3 seconds
    9.     chance of 5%: #Kill 50 Zombies
    10.       zombieQuest({_p})
    11.     chance of 5%: #Kill 50 Skeletons
    12.       skeletonQuest({_p})
    13.     chance of 5%: #Kill 50 Creepers
    14.       creeperQuest({_p})
    15.     chance of 5%: #Kill 50 Spiders
    16.       spiderQuest({_p})
    17.     chance of 5%: #Kill 40 Endermen
    18.       endermanQuest({_p})
    19.     chance of 5%: #Break 150 Blocks
    20.       break150Quest({_p})
    21.     chance of 5%: #Break 200 Blocks
    22.       break200Quest({_p})
    23.     chance of 5%: #Place 150 Blocks
    24.       place150Quest({_p})
    25.     chance of 5%: #Place 200 Blocks
    26.       place200Quest({_p})
    27.     chance of 5%: #Walk 1k Blocks
    28.       walk1000Quest({_p})
    29.     chance of 5%: #Walk 1.5k Blocks
    30.       walk1500Quest({_p})
    31.     chance of 5%: #Fish 25 Items
    32.       fish25Quest({_p})
    33.     chance of 5%: #Fish 30 Items
    34.       fish30Quest({_p})
    35.     chance of 5%: #Craft 128 Sugar
    36.       sugarQuest({_p})
    37.     chance of 5%: #Craft 48 Bread
    38.       breadQuest({_p})
    39.     chance of 5%: #Break 192 Cobble
    40.       cobble192Quest({_p})
    41.     chance of 5%: #Break 256 Cobble
    42.       cobble256Quest({_p})
    43.     chance of 5%: #Play For 30 Minutes
    44.       play30Quest({_p})
    45.     chance of 5%: #Play For 45 Minutes
    46.       play45Quest({_p})
    47.     chance of 5%: #Play For 1 Hour
    48.       play1hQuest({_p})
    49.      
    50.  
    51. command /quest:
    52.   cooldown: 1 day
    53.   trigger:
    54.     getQuest(player)
     
  2. Best Answer:
    Post #2 by AHappyLittleSloth, Jul 14, 2021
  3. AHappyLittleSloth

    Joined:
    Apr 22, 2020
    Messages:
    48
    Likes Received:
    4
    The problem lies with the "chance of" event

    "chance of" is unreliable, because each individual "chance of 5%" is calculated on it's own, not as a part of a whole 100%. So they all have a 5% chance which is why sometimes you get 0 and other times 2.

    I recommend random integer
    set {_random} to a random integer betweeen 1 and ...something you want
     
    • Like Like x 1
  4. PureNuggets

    PureNuggets Member

    Joined:
    Jun 25, 2021
    Messages:
    17
    Likes Received:
    0
    so how would i make the random integer then run one of the functions? would i do "if {_random} = 1"?
     
  5. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    You could do:
    Code (Text):
    1. set {_int} to a random integer between 1 and 5
    2. if {_int} is 1:
    3.     send "option1"
    4. else if {_int} is 2:
    5.     send "option2"
    6. else if {_int} is 3:
    7.     send "option3"
    8. else if {_int} is 4:
    9.     send "option4"
    10. else if {_int} is 5:
    11.     send "option5"
     
    • Like Like x 1
    • Agree Agree x 1
  6. AHappyLittleSloth

    Joined:
    Apr 22, 2020
    Messages:
    48
    Likes Received:
    4
    There also MAY be a syntax for "chance of" that allows for multiple to chain together to make up 100% (AKA what you were trying to code originally). I've been away from skript for a while and I tried doing some research to find it, but couldn't.

    EDIT: NVM there is NO SYNTAX for this. "if you use multiple chance of % expressions in a row then the chances in the expressions after the first one get screwed up since you have to consider the probability that the previous chance expressions aren't successful"

    Also: if you want some things to have higher chances, then use if and else if with multiple integers based on how common you want it to be
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...