ID:263057
 
Code:
mob/players
proc
Update_Party()
var/party_limit = 0
for(var/mob/players/P in party)
party_limit++
if(party_limit == 1) // -- If the Party was jsut created when the Update Proc was ran
P.party = src.party // it will assign the Following Verbs to the Party Leader
P.in_party = 1
P.party_leader = src.name
P.verbs -= /mob/Party/verb/Create_Party
P.verbs += /mob/Party/verb/Party_Chat
P.verbs += /mob/Party/verb/Leave_Party
P.verbs += /mob/Party_Leader/verb/Party_Invite
P.verbs += /mob/Party_Leader/verb/Boot_Party_Member
else
P.in_party += 1 // -- Else the Member verbs are assigned to those who join after the party is created
P.verbs -= /mob/Party/verb/Create_Party
P.verbs += /mob/Party/verb/Leave_Party
P.verbs += /mob/Party/verb/Party_Chat

Remove_Verbs() // -- Used when a Mob Joins. Removes any Verbs that may have been accidently Saved
src.verbs -= /mob/Party_Leader/verb/Party_Invite
src.verbs -= /mob/Party_Leader/verb/Boot_Party_Member
src.verbs -= /mob/Party/verb/Party_Chat
src.verbs -= /mob/Party/verb/Leave_Party

Disband_Party_Proc() // -- This proc is used for when the Leader leaves the Party
for(var/mob/players/P in party)
src.verbs -= /mob/Party_Leader/verb/Party_Invite // -- Removes the Party Leaders Verbs
src.verbs -= /mob/Party_Leader/verb/Boot_Party_Member
P.verbs += /mob/Party/verb/Create_Party // -- Then Add's the Default Party Creation verb
P.verbs -= /mob/Party/verb/Leave_Party // -- and removes the verbs when used in a Party
P.verbs -= /mob/Party/verb/Party_Chat
P << "<b>[src] Disbands the party."
P.party_leader = list()
P.party = list()
P.in_party = 0

Leave_Party_Proc() // -- This proc is used for when a Member of the Party Leaves
if(src.in_party == 0)
return
for(var/mob/players/P in party)
if(src.party_leader == src.name)
src.Disband_Party_Proc()
else
P << "<b>[src] Leaves's the party"
P.party.Remove(src)
src.party = list()
src.in_party = 0
src.party_leader = list()
src.verbs += /mob/Party/verb/Create_Party // -- Removes the Party Members Verbs
src.verbs -= /mob/Party/verb/Leave_Party
src.verbs -= /mob/Party/verb/Party_Chat

mob/Party
verb
Create_Party()
set category = "Party"
if(src.in_party == 1)return
party.Add(src) // -- Add's the Person to the Party's List
src.in_party = 1
src.Update_Party() // -- Runs the Update proc (See above)
src.party_leader = src.name // -- Sets the Party's Leader to src (One who Created the Party)

Party_Chat(msg as text)
set category = "Party"
if(src.in_party == 1) // -- Makes it so only P (Party Members) of your Party can see the Chat
P << "<B>[src]</B> *Party* says: [msg]" // -- Sends the Message to the Party
else
M << "<B>[src]</B> Your not part of a party!!!" // -- It will tell the player they arn't part of a party!

Leave_Party()
set category = "Party"
src.Leave_Party_Proc() // -- Runs the Leave Party Proc (See above)

mob/Party_Leader
verb
Boot_Party_Member(var/mob/players/M in src.party) // -- Used to Boot a Member of the Party
set category = "Party"
if(M == src)return // -- Prevents the Party Leader from Booting Themself!
switch(alert(usr,"Are you sure about Boot [M] from the Party?","","Yes","No"))
if("Yes")
alert(M,"You have been Booted from the Party") // -- Sends an Alert to the Member being Booted
M.Leave_Party_Proc() // -- Runs the Leave Party Proc (See above)
else
return

Party_Invite()
set category = "Party"
var/members = 0 // -- Members in the Party so Far
for(var/mob/players/M in get_step (src,src.dir)) // To invite someone, you must be facing them
if(M.in_party == 1)// -- Prevents the Leader from inviting someone already in a party
usr << "<B>They are already in a Party!"
return
if(M.considering == 1)// -- Prevents the Leader from inviting someone already being asked to Join a Party
usr << "<B>They are already Considering Joining a Party!"
return

if(usr.name == usr.party_leader && members < 8 && usr.key != null) // -- If the Person inviting someone to the Party is the Party leader
M.considering = 1 // -- And the Party count is less than 8 (Max Party Limit. Can be changed)
switch(alert(M,"Do you want to join [usr]'s Party?","","Yes","No")) // -- And the Party Leader's Key isn't null, then it asks
if("Yes") // -- The Person [M] if they want to join the party
members++ // -- If they accept, then the Party gains One member (members++)
usr.party += M // -- Add's [M] to the Party's list
M.party = usr.party // -- Set's [M]'s Party to the Leaders
M.considering = 0
usr.Update_Party() // -- Runs the Update Party Proc (See above)
for(var/mob/P in usr.party)
P << "<b>[M] has joined the Party"
return
else
usr << "<B>[M]:</B> I don't want to join your Party"
M.considering = 0
else
if(usr.name == usr.party_leader && members > 5 && usr.key != null)
usr << "The party is full"
return

// -- NOTE: The Stat Panel below is Optional, but make's it easier to See how many people are in the Party

mob
Stat()
if(src.in_party == 1) // -- If the person is in a Party, it gives them the Stat Panel
statpanel("Party")
stat("Name:","")
for(var/mob/P in src.party)
stat(P) // -- Lists the Members of the Party

client
New()
..()
mob/players.Remove_Verbs() // -- Runs the Remove Verbs Proc (See above)

Del()
if(mob.in_party == 1 && mob.name != mob.party_leader) // -- When the person leaves the world
mob/players.Leave_Party_Proc() // -- it runs the 2 If statements below
if(mob.name == mob.party_leader)
mob/players.Leave_Party_Proc()
mob
var
tmp
party_leader
in_party = 0
party_count = 0
considering = 0

mob
var
tmp
list
party = list()


Problem description:
Party.dm:69:error:P:undefined var
Party.dm:71:error:M:undefined var
Party.dm:63:error:src.Update_Party:undefined proc
Party.dm:75:error:src.Leave_Party_Proc:undefined proc
Party.dm:108:error:usr.Update_Party:undefined proc

*pulls out the gun and gets ready to fire*
try turning the procs to:

mob/proc

//instead of

mob/players/proc


and as far as:

        Party_Chat(msg as text)
set category = "Party"
if(src.in_party == 1)(Party Members) of your Party can see the Chat
P << "<B>[src]</B> *Party* says: [msg]"
else
M << "<B>[src]</B> Your not part of a party!!!"

// try putting...
Party_Chat(msg as text)
set category = "Party"
if(src.in_party == 1)
for(var/mob/M in src.party)M << "<B>[src]</B> *Party* says: [msg]"
else
src << "<B>[src]</B> Your not part of a party!!!"
In response to VcentG
well i made those changes and this came up now (ALOT WORSE!)


Party.dm:102:error:party_limit :invalid proc definition
Party.dm:103:error:_block :invalid proc definition
Party.dm:105:error:if :invalid proc definition
Party.dm:106:error::invalid proc definition
Party.dm:114:error:else :invalid proc definition
Party.dm:121:error:-= :invalid proc definition
Party.dm:122:error:-= :invalid proc definition
Party.dm:123:error:-= :invalid proc definition
Party.dm:124:error:-= :invalid proc definition
Party.dm:127:error:_block :invalid proc definition
Party.dm:140:error::invalid proc definition
Party.dm:140:error:return :invalid proc definition
Party.dm:141:error:_block :invalid proc definition
Party.dm:143:error::invalid proc definition
Party.dm:126:error:Disband_Party_Proc :previous definition
Party.dm:144:error:else :invalid proc definition
Party.dm:104:error:party_limit:expected proc definition
Party.dm:8:error:src.Update_Party:undefined proc
Party.dm:20:error:src.Leave_Party_Proc:undefined proc
Party.dm:53:error:usr.Update_Party:undefined proc
In response to Narnia_Knight
I get no error and this is what I have:

mob
proc
Update_Party()
var/party_limit = 0
for(var/mob/players/P in party)
party_limit++
if(party_limit == 1) // -- If the Party was jsut created when the Update Proc was ran
P.party = src.party // it will assign the Following Verbs to the Party Leader
P.in_party = 1
P.party_leader = src.name
P.verbs -= /mob/Party/verb/Create_Party
P.verbs += /mob/Party/verb/Party_Chat
P.verbs += /mob/Party/verb/Leave_Party
P.verbs += /mob/Party_Leader/verb/Party_Invite
P.verbs += /mob/Party_Leader/verb/Boot_Party_Member
else
P.in_party += 1 // -- Else the Member verbs are assigned to those who join after the party is created
P.verbs -= /mob/Party/verb/Create_Party
P.verbs += /mob/Party/verb/Leave_Party
P.verbs += /mob/Party/verb/Party_Chat

Remove_Verbs() // -- Used when a Mob Joins. Removes any Verbs that may have been accidently Saved
src.verbs -= /mob/Party_Leader/verb/Party_Invite
src.verbs -= /mob/Party_Leader/verb/Boot_Party_Member
src.verbs -= /mob/Party/verb/Party_Chat
src.verbs -= /mob/Party/verb/Leave_Party

Disband_Party_Proc() // -- This proc is used for when the Leader leaves the Party
for(var/mob/players/P in party)
src.verbs -= /mob/Party_Leader/verb/Party_Invite // -- Removes the Party Leaders Verbs
src.verbs -= /mob/Party_Leader/verb/Boot_Party_Member
P.verbs += /mob/Party/verb/Create_Party // -- Then Add's the Default Party Creation verb
P.verbs -= /mob/Party/verb/Leave_Party // -- and removes the verbs when used in a Party
P.verbs -= /mob/Party/verb/Party_Chat
P << "<b>[src] Disbands the party."
P.party_leader = list()
P.party = list()
P.in_party = 0

Leave_Party_Proc() // -- This proc is used for when a Member of the Party Leaves
if(src.in_party == 0)
return
for(var/mob/players/P in party)
if(src.party_leader == src.name)
src.Disband_Party_Proc()
else
P << "<b>[src] Leaves's the party"
P.party.Remove(src)
src.party = list()
src.in_party = 0
src.party_leader = list()
src.verbs += /mob/Party/verb/Create_Party // -- Removes the Party Members Verbs
src.verbs -= /mob/Party/verb/Leave_Party
src.verbs -= /mob/Party/verb/Party_Chat

mob/Party
verb
Create_Party()
set category = "Party"
if(src.in_party == 1)return
party.Add(src) // -- Add's the Person to the Party's List
src.in_party = 1
src.Update_Party() // -- Runs the Update proc (See above)
src.party_leader = src.name // -- Sets the Party's Leader to src (One who Created the Party)

Party_Chat(msg as text)
set category = "Party"
if(src.in_party == 1)
for(var/mob/M in src.party)M << "<B>[src]</B> *Party* says: [msg]"
else
src << "<B>[src]</B> Your not part of a party!!!"
Leave_Party()
set category = "Party"
src.Leave_Party_Proc() // -- Runs the Leave Party Proc (See above)

mob/Party_Leader
verb
Boot_Party_Member(var/mob/players/M in src.party) // -- Used to Boot a Member of the Party
set category = "Party"
if(M == src)return // -- Prevents the Party Leader from Booting Themself!
switch(alert(usr,"Are you sure about Boot [M] from the Party?","","Yes","No"))
if("Yes")
alert(M,"You have been Booted from the Party") // -- Sends an Alert to the Member being Booted
M.Leave_Party_Proc() // -- Runs the Leave Party Proc (See above)
else
return

Party_Invite()
set category = "Party"
var/members = 0 // -- Members in the Party so Far
for(var/mob/players/M in get_step (src,src.dir)) // To invite someone, you must be facing them
if(M.in_party == 1)// -- Prevents the Leader from inviting someone already in a party
usr << "<B>They are already in a Party!"
return
if(M.considering == 1)// -- Prevents the Leader from inviting someone already being asked to Join a Party
usr << "<B>They are already Considering Joining a Party!"
return

if(usr.name == usr.party_leader && members < 8 && usr.key != null) // -- If the Person inviting someone to the Party is the Party leader
M.considering = 1 // -- And the Party count is less than 8 (Max Party Limit. Can be changed)
switch(alert(M,"Do you want to join [usr]'s Party?","","Yes","No")) // -- And the Party Leader's Key isn't null, then it asks
if("Yes") // -- The Person [M] if they want to join the party
members++ // -- If they accept, then the Party gains One member (members++)
usr.party += M // -- Add's [M] to the Party's list
M.party = usr.party // -- Set's [M]'s Party to the Leaders
M.considering = 0
usr.Update_Party() // -- Runs the Update Party Proc (See above)
for(var/mob/P in usr.party)
P << "<b>[M] has joined the Party"
return
else
usr << "<B>[M]:</B> I don't want to join your Party"
M.considering = 0
else
if(usr.name == usr.party_leader && members > 5 && usr.key != null)
usr << "The party is full"
return

// -- NOTE: The Stat Panel below is Optional, but make's it easier to See how many people are in the Party

mob
Stat()
if(src.in_party == 1) // -- If the person is in a Party, it gives them the Stat Panel
statpanel("Party")
stat("Name:","")
for(var/mob/P in src.party)
stat(P) // -- Lists the Members of the Party

client
New()
..()
mob/players.Remove_Verbs() // -- Runs the Remove Verbs Proc (See above)

Del()
if(mob.in_party == 1 && mob.name != mob.party_leader) // -- When the person leaves the world
mob/players.Leave_Party_Proc() // -- it runs the 2 If statements below
if(mob.name == mob.party_leader)
mob/players.Leave_Party_Proc()
mob
var
tmp
party_leader
in_party = 0
party_count = 0
considering = 0

mob
var
tmp
list
party = list()

players//I just added this so I could compile
In response to VcentG
Thank you very much, that did the trick...your the best mate!
In response to Narnia_Knight
You probably forgot a ) or a " or something. That tends to produce a lot of errors that make no sense.
In response to PirateHead
i honestly wouldn't doubt it, i do most of my coding after i get home from work, so i am pretty tired when i do it!, make a lot of common mistakes
In response to Narnia_Knight
Sorry, probably last time i'll bug ya guys!
(dm)runtime error: Cannot modify null.name.
proc name: CreateCharacter (/mob/creating_character/proc/CreateCharacter)
source file: SavingChars.dm,84
usr: Fili (/mob/creating_character)
src: Fili (/mob/creating_character)
call stack:
Fili (/mob/creating_character): CreateCharacter()
(/dm)

all that coding is is Create a name...
In response to Narnia_Knight
Weird thing being, we don't have the CreateCharacter proc.
In response to Mysame
Mysame wrote:
Weird thing being, we don't have the CreateCharacter proc.

sorry about that,
//this is commented out because my BYOND is messed up on this computer, and this stuff won't compile.  I don't have deadon's character handling code anymore that this runs.  It isn't commented out in the real game.

//#include <deadron/characterhandling>


client
base_num_characters_allowed = 5

world

mob = /mob/creating_character

mob/base_save_location = 0



mob/creating_character
base_save_allowed = 0 // If player quits before choosing, don't want to save this mob.

Login()
// Spawn here to avoid problems with calling prompts during login.
spawn()
src.CreateCharacter()

proc/CreateCharacter()

var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text
char_name = html_encode(char_name)
if(length(char_name)>20)
char_name = null
alert("Names must be under 21 characters long.")
if (!char_name)

client.base_ChooseCharacter()
return

// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return
var/char_class
switch(src.key)
if("Tanbi")
char_class = "special1"
if("Fili")
char_class = "special2"
if("")
char_class = "special3"
if("")
char_class = "special4"

else
var/list/classes = list("Warrior","Monk","Mage","Wizard")
help_text = "What class?"
default_value = "Warrior"
char_class = input(src, help_text, prompt_title, default_value) in classes


var/mob/new_mob



// Okay we have enough information, so it's time to create the character and switch the player to it.

switch(char_class)
if ("Warrior") new_mob = new /mob/players/Warrior()
if ("Monk") new_mob = new /mob/players/Monk()
if ("Mage") new_mob = new /mob/players/Mage()
if ("Wizard") new_mob = new /mob/players/Wizard()
if ("special1") new_mob = new /mob/players/Special1()
//if ("special2") new_mob = new /mob/players/Special2()
if ("special3") new_mob = new /mob/players/Special3()

// Set the attributes.
new_mob.name = char_name


// Now switch the player client over to the new mob and delete myself since I'm no longer needed.
src.client.mob = new_mob
var/turf/first_location = locate(/turf/start)
new_mob.Move(first_location)
del(src)

mob
Login()
..()

// This is just here for this sample, to make it clear which mob you've logged into.
switch(src.key)
if("Tanbi")
world << "\blue <b> [usr] has joined all; The Owner!"

// This is just here for this sample, to make it clear which mob you've logged into.


Write(savefile/F)
// This is sample code that keeps track of the player's last position on the map.
// Their last position is stored when the mob is saved, then reinstated when the mob
// is read in.

// First, call the default Write() behavior for mobs.
..()

// Now, if we have a map, remember their last location.
if (world.maxx)
F["last_x"] << x
F["last_y"] << y
F["last_z"] << z

Read(savefile/F)
// Call the default Read() behavior for mobs.
..()

// Now, if we have a map, put them back on the map in their last location.
if (world.maxx)
var/last_x
var/last_y
var/last_z
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> last_z
loc = locate(last_x, last_y, last_z)


have fun trying to solve THIS problem -_- im about ready to take a gun to my head! :-p
In response to Narnia_Knight
I knew what to look for, found it quickly, and I'll tell you what the problem is.

Usually, when it says "can't set null.whatever", it means you're trying to do something to something that doesn't exist. In your case, you say:

var/mob/new_mob

And then try to set new_mob's name. However, new_mob is just a variable of type /mob pointing to nothing! If you want to be able to set its name, you need to initialize the new_mob or point it to something. For example:

var/mob/new_mob = new
//or
var/mob/new_mob = new /mob (locate(1,13,4))
//etc

Always remember the difference between uninitalized instances fo things and actual objects. One exists in the game world, one just has the potential to exist. It's like a friggin' fetus that way.
In response to PirateHead
That worked Perfectly, thank you very much