Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 03:36:46 AM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: [QUESTION] How do I adjust traitor chances?
Pages: [1]
Author Topic: [QUESTION] How do I adjust traitor chances?  (Read 4588 times)
DeathByFire
Poster

Posts: 3


« on: July 07, 2011, 03:52:04 PM »

How do I adjust traitor chances for donator & superadmins using ulx?

PS: I do not have any knowledge on lua, but some donators requested this and since I depend on them, it would be very cool if you guys could help me out here.

Greets
Darkest_97
Poster

Posts: 286


Hi.


« Reply #1 on: July 07, 2011, 04:09:50 PM »

I dont know how to do it, but its a horrible idea. Its not fair by any means to the other players.

Give the donators reserved slot or colored names or something. Giving them something that effects the game is stupid.
DeathByFire
Poster

Posts: 3


« Reply #2 on: July 07, 2011, 04:26:25 PM »

Well, it would be fair if the chance is small imo, like say 2% more chance :P
Also, they already have reserved slots & colored names are not being implemented for now :P
Charles445
Build Tester
*
Posts: 2338


I LOVE THIS AVATAR


« Reply #3 on: July 07, 2011, 06:35:14 PM »

Traitor selection is in the method SelectRoles in init.lua

It signs up non-spectator people to try out as traitor.
This is part of the code (the important bit)

local pick = math.random(1, #choices)
local pply = choices[pick]
     if IsValid(pply) and
        ((not table.HasValue(prev_roles[ROLE_TRAITOR], pply)) or (math.random(1, 3) == 2)) then
        pply:SetRole(ROLE_TRAITOR)

        table.remove(choices, pick)
        ts = ts + 1
     end
  end



This snippet picks a random player from the sign up array, checks if they are a valid player, and if they were traitor last round. If they were traitor last round, they have to get a lucky roll (what appears to be a 1/3 chance) in order to get traitor again. If they were not traitor, they are instantly selected as traitor.

It seems hard to add a 2% bonus or something of that kind to donators because selection is heavily dependent on how many people are signed up.

A simple way to give donators an easier chance of getting traitor is to exempt them from the 1/3 roll if they were traitor last round (so being a donator makes it easier to get traitor twice in a row)


del>Ok, so Bad King, you are just going to wait for Garry to fix?
What an idiotic thing to ask. Dammit weed.

Bookcases, Bookcases Everywhere
DeathByFire
Poster

Posts: 3


« Reply #4 on: July 07, 2011, 07:01:09 PM »

This sounds a good idea charles, do you have any idea what the coding would be for that?
Charles445
Build Tester
*
Posts: 2338


I LOVE THIS AVATAR


« Reply #5 on: July 07, 2011, 07:47:06 PM »

This sounds a good idea charles, do you have any idea what the coding would be for that?

No, because I don't know how you keep the information on donators.
If you could post the code you used to specify colors for donators, it would be helpful

EDIT: I ran a calculation, adding this for donators would change their chances from 20.833% to 25%, about a 4% increase.
« Last Edit: July 07, 2011, 07:55:41 PM by Charles445 »

del>Ok, so Bad King, you are just going to wait for Garry to fix?
What an idiotic thing to ask. Dammit weed.

Bookcases, Bookcases Everywhere
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: [QUESTION] How do I adjust traitor chances? « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.009 seconds with 18 queries.