ID:2191600
 
(See the best response by Reformist.)
Hello I am creating a Naruto game, from scratch, and right now I am working on the Chunin Exam part. The first proc named "Chunin Exam()" is a world proc and it works fine, it's just that when the exam finishes and tries to go through the second proc it doesn't work. I want it so that when a person's squad gets the required points from questions 25/30. They will be added to the chunin list variable so that they can do a capture the flag team vs team style. I do not know exactly how to make sure peoples teams are added in the chunin exam variable list as a whole so that in the second part people are summoned in their teams. Please help!
        Chunin_Exam()
world<<"<b>The Chunin Exams are about to begin. If you have been chosen to take the test please travel to the [assignedvillage] Village!"
sleep(20)
world<<"The Chunin Exams will begin in 5 minutes!"
sleep(500)
world<<"The Chunin Exams will begin in 4 minutes!"
sleep(500)
world<<"The Chunin Exams will begin in 3 minutes!"
sleep(500)
world<<"The Chunin Exams will begin in 2 minutes!"
sleep(500)
world<<"The Chunin Exams will begin in 1 minute!"
sleep(500)
world<<"<b>The Chunin Exams have begun!"
Chunintime=1
sleep(500)
src.Chunin_First_Exam()
world<<"<b>The Chunin Exams are now over, another will be held in 40 minutes!"
Chunintime=0
sleep(15000)
..()
mob
proc
Chunin_First_Exam()
for(var/mob/P in squad)
if(P.squadexampoints>=25)
usr<<"<b><font color=red>Your team has passed The Chunin Exams - Part 1 with [squadexampoints]/30!"
chunin+=P

else
usr<<"<b><font color=red>Your team has failed The Chunin Exams - Part 1 with [squadexampoints]/30!"
sleep(20)
for(var/mob/M in chunin)
usr<<"<b>Congrats!"
return


Problem description:

Best response
The problem is Chunin_Exam() doesn't have a reference to a mob. You'd have to loop through all of the people who took the exam and then call Chunin_First_Exam() for each of them (at least the way you have it set up).

As a side note, if you don't change the system you'll find that each person will be added to the chunin list equal to the number of people found in their squad list.
In response to Reformist
Reformist wrote:
The problem is Chunin_Exam() doesn't have a reference to a mob. You'd have to loop through all of the people who took the exam and then call Chunin_First_Exam() for each of them (at least the way you have it set up).

As a side note, if you don't change the system you'll find that each person will be added to the chunin list equal to the number of people found in their squad list.

I made a new variable called "taking_exam" so that I would be able to distinguish who's taking the exam and who is not. I still, however, can not figure out how to make it so that the team is added. Would I have to make it so that individuals are added instead of trying to have squads added?
Universe_Steven you might have to just create a proc different for the teams and then just add it to the Chunin_exam_2. Make it so that the people are randomly place on a team. Example. It would be like a 4 team R,G,B or Y fighting each other for a flag to claim. You have 16 people and the programming place them into R,G,B or Y
In response to Zanoroku
Or he could just manage the system using datums

var
list/Squads = list()

Squad
var
tmp
list/Members = list()
New()
Squads += src

proc
Chunin_Exam()
// yada yada exam stuff here
sleep(600) // 1 minute
var/PassCheck
for(var/Squad/S in Squads)
PassCheck = 0
for(var/mob/M in S.Members)
if(M.squadexampoints >= 25)
PassCheck ++
if(PassCheck == S.Members.len)
S.Members << "Your squad has passed the Chunin Exam."
else
S.Members << "Your squad has failed the Chunin Exam."

Another thing to note is that 600 is one minute, not 500 like you have in the original code. sleep() and spawn() are based on real time in 10ths of a second. (10 is 1 second, 60 seconds in a minute, 10*60 = 600)

world<<"<b>The Chunin Exams are now over, another will be held in 40 minutes!"
Chunintime=0
sleep(15000)

What you have there with sleep(15000) actually sleeps for 25 minutes, not 40. An easy way to keep track of minutes is to simply do 600 * number of minutes. (600*5) for 5 minutes.
In response to Reformist
Sorry I have been gone for quite a while, I wanted to say that I already have a code for squads in a separate file and what happens is Jonin will be able to invite Genins to a squad and once a chunin exam happens the team will go to take the test and after the time limit the points are added to a total. Though your code makes it better I was wondering how to have it so it will be each squad versus each other.