The roles list
mob
Start_Game
// One question.
// Should the Start_Game verb close off the game to new players?
// Well, I did my job. I have my own game to work on, now. Good luck.
icon = 'StartGame.dmi'
Click()
switch(input("What mode would you like","Modes")in list("Normal","Real World", "Swat", "Zombie mode"))
if("Normal")
NormalMode = 1
if("Real World")
RealWorldMode = 1
if(NormalMode)
AvailableRoles += "L"
AvailableRoles += "Watari"
var/tfm
if(SwatMode || RealWorldMode || NormalMode)
for (tfm=1, tfm<7, tfm++)
AvailableRoles += "Task Force Member"
AvailableRoles += "Chief of Police"
var/po
if(SwatMode || RealWorldMode || NormalMode)
for (po=1, po<4, po++)
AvailableRoles += "Police Offer"
if(NormalMode)
AvailableRoles += "Shinigami"
AvailableRoles += "Shinigami"
AvailableRoles += "Mafia Leader"
var/mm
if(NormalMode || RealWorldMode || SwatMode)
for (mm=1, mm<4, mm++)
AvailableRoles += "Mafia Member"
AvailableRoles += "Double Agent"
var/kf
if(NormalMode|| RealWorldMode)
for (kf=1, kf<4, kf++)
if(NormalMode)
AvailableRoles += "Kira Follower"
AvailableRoles += "STV Manager"
var/stv
if(NormalMode || RealWorldMode)
for (stv=1, stv<4, stv++)
AvailableRoles += "STV Employee"
var/ym
if(NormalMode || RealWorldMode)
for (ym=1, ym<4, ym++)
AvailableRoles += "Yotsuba Member"
AvailableRoles += "Yotsuba Leader"
AvailableRoles += "Detective"
var/pw
if(NormalMode || RealWorldMode)
for (pw=1, pw<4, pw++)
AvailableRoles += "Attorney"
AvailableRoles += "Judge"
AvailableRoles += "Grocery Store Manager"
AvailableRoles += "Electronics Store Manager"
AvailableRoles += "Clothing Store Manager"
AvailableRoles += "Auto-dealership Manager"
AvailableRoles += "Furniture Store Manager"
AvailableRoles += "Pet Store Manager"
var/gse
if(NormalMode || RealWorldMode)
for (gse=1, gse<4, gse++)
AvailableRoles += "Grocery Store Employee"
var/ese
if(NormalMode || RealWorldMode)
for (ese=1, ese<4, ese++)
AvailableRoles += "Electronics Store Manager"
var/cse
if(NormalMode || RealWorldMode)
for (cse=1, cse<4, cse++)
AvailableRoles += "Clothing Store Employee"
var/ade
if(NormalMode || RealWorldMode)
for (ade=1, ade<4, ade++)
AvailableRoles += "Auto-dealership Employee"
var/fse
if(NormalMode || RealWorldMode)
for (fse=1, fse<4, fse++)
AvailableRoles += "Furniture Store Employee"
var/pse
if(NormalMode || RealWorldMode)
for (pse=1, pse<4, pse++)
AvailableRoles += "Pet Store Employee"
AvailableRoles += "Mercenary"
var/fbi
if(NormalMode || RealWorldMode)
for (fbi=1, fbi<4, fbi++)
AvailableRoles += "FBI Agent"
AvailableRoles += "FBI Leader"
// There. Only twenty roles exist now. Now to fix the giving system so tht Kira and L are always given.
//Where is your God, now?
// Uhm. Up.
// Now, should I make it randomly assign everyone a role, and delete your old role if you ahve one? Not a clue. Uhm. Yes?
// Alright, let me think. I know what the problem is. // The problem is.
// For some reason, it reads 'AvailablRoles' as having 0 objects in its list.
//
for(var/mob/Pl in world)
if (Pl.key != null)
if (Pl.Role != "None" && Pl.Role != "Player")
AvailableRoles -= Pl.Role
/*world << "Available Roles:"
var/role
for (b=1, b<c, b++)
role = AvailableRoles[b]
world << "[role]"*/
// So far so good. Wait. I have a question.
// Yes?
// Well, so, does it randomly assign the roles?
// Not yet. I wanted to see if it worked first, by having it display all available roles.
// So, how do we get that to work, persay?
// Like thus:
var/pick
var/outofguys = "No"
var/breakloop = "No"
// What does 'while' do?
// Loop scontinuously while the argument is true.
// In other words, the loop breaks automatically if the argument is no longer true.
// Which, in this cas,e is ehwn there are no more available roles.
// Ah. So, I could use the 'while' proc, instead of the go to' thing for my battle system,
// Mine used 'while' to keep the battle going only while there were two fighters who both wre abl to fight.
// I used goto in it to skip between turns and items and such.
// Ah. Well, so, did that fix it?
// No, it's not done yet.
// Continue
while(breakloop == "No" && AvailableRoles.len > 0)
pick = rand(1, AvailableRoles.len) // Can you gues what this does?
outofguys = "Yes"
for (var/mob/Guy in world)
if (Guy.key != null)
if (Guy.Role == "None")
outofguys = "No"
Guy.Role = AvailableRoles[pick]
if (Guy.Role == "Shinigami")
Guy.invisibility = 1
AvailableRoles -= AvailableRoles[pick]
goto PICKED
PICKED
if (outofguys == "Yes")
breakloop = "Yes"
for (var/mob/Go in world)
if (Go.key && Go.Role != "Player")
var/x = rand(6, 18)
var/y = rand(7, 14)
Go.loc = locate(x, y, 2)
Go.icon = 'CharacterL.dmi'
Ingore the comments
The verb
ShowRoles()
world<<list2params(AvailableRoles)
Problem description:
The problem is that i want to see if it shows the roles that are available to the world. But it doesn't show anything at all.
it goes like this:
Instead of the following:
you should just use break where the goto is. That'll stop (or rather, break) the for() loop.
Ugh! Why don't you group all similar if()s together? Like all the if(NormalMode || RealWorldMode) in one. And you can reuse the same variable! But, if you paid attention to the first snippet I provided, you don't even need that!
Again, if you want to break a loop, use break. Especially in that while. And learn some Boolean tricks as well, they are so ever useful. (Ugh, I wish Bwiki was still here :( ).
Now, is AvailableRoles an initialized globally-defined variable? Did any errors appeared when you tried using the said snippet/verb? Did you tried using length() to make sure that the /list is not empty?