ID:145415
 
Code:
mob
Quest
icon = 'man.dmi'
verb/Talk()
set src in oview(2)
set category = "Commands"
if(usr.quest == 0)
switch(input("Would You Like A Quest?","Quest Guy",text) in list ("Yes","No"))
if("Yes")
given = 1
foundsword = 0
if("No") alert("Fine.")
if(usr.foundsword == 1) // this shows that you found the sword
usr << "Thanks for the sword!"
sleep(22)
obj
Sword
icon = 'sword.dmi'
name = "Flaming Sword"
verb
Get()
set src in oview(2)
set category = "Commands"
if (usr.given == 1)
usr.foundsword = 1
src << "you got the sword"
else if (usr.given == 0)
alert(usr,"Maybe You Should Get A Quest First."); return


mob
var
foundsword = 0
quest = 0
given = 0


Problem description:

I've tried and tried and tried but i cant make it so the mob cant get the sword till he gets a quest. When i use the code above though even when i get a quest it still wont let me get the sword.
given = 1 in that code defaults to the NPC, thus src. Change it to usr.given.

Also,
if(thingy==1)/if(thingy==0) = BAADDD!! If you want to check a true/false value, use if(thingy), and if(!thingy) for false.
In response to Mysame
i tried to define given but it keeps coming up as an undefined var
In response to Mxjerrett
Mxjerrett wrote:
i tried to define given but it keeps coming up as an undefined var
mob
Quest
icon = 'man.dmi'
verb/Talk()
set src in oview(2)
set category = "Commands"
if(usr.quest == 0)
switch(input("Would You Like A Quest?","Quest Guy",text) in list ("Yes","No"))
if("Yes")
USR.given = 1
USR.foundsword = 0
if("No") alert("Fine.")
if(usr.foundsword == 1) // this shows that you found the sword
usr << "Thanks for the sword!"
sleep(22)

mob
var
foundsword = 0
quest = 0
given = 0


obj
Sword
icon = 'sword.dmi'
name = "Flaming Sword"
verb
Get()
set src in oview(2)
set category = "Commands"
if (usr.given == 1)
usr.foundsword = 1
src << "you got the sword"
if (usr.given == 0)
alert(usr,"Maybe You Should Get A Quest First."); return

Without the else? Does that work? Also try to delete save files if you are using them. They tend to screw up your testing. Another thing, try putting usr.given=1 instead of given=1.

Not sure, since I am @ school, but I can fix tonight if you can't get it working. You also may want to make a variable in the stat panel for testing to see if it changes. I do it all the time to help debug.
In response to King Gunnerblast
can u tell me what is wrong with this

client
proc
Load_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] >> src.mob
S["x"] >> src.mob.x
S["y"] >> src.mob.y
S["z"] >> src.mob.z
Save_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z




client
New()
if(src.mob=="Mxjerrett")
world <<"[src.mob], our god, has entered."
else
world <<"[src.mob] has entered."
Del()
world << "[src.mob] has left us."
src.mob.client.Save_Char()
del(src.mob)




//Do not touch this, this is the char creation








mob/Choosechar
Login()
spawn()
src.Choose_Char()
proc//we start with the procs
Choose_Char()
var/list/char_menu = newlist()
var/Create = "Create New Character"
var/Load = "Load Character"
var/Quit = "Exit"
if(fexists("Player/[src.client.ckey]"))
char_menu.Add(Create,Load,Quit)
var/choice = input("What do you want to do?","Welcome back to [world.name]") in char_menu

if(choice == Create)
switch(alert("Creating a New Character will delete your existing character. Continue?","Warning","Yes","No"))
if("Yes")
Create_Char()
if("No")
Choose_Char()
return
if(choice == Load)
src.client.Load_Char()
if(choice == Quit)
del(src)
else
char_menu.Add(Create,Quit)
var/choice = input("What do you want to do?","Welcome to [world.name]!") in char_menu

if(choice == Create)
Create_Char()
if(choice == Load)
del(src)

..()
//You shouldn't have touched the code above, and if you did, and the saving breaks, do not complain to me.
//However, you will need to custumize the code below to suite your game. Have any questions, don't be scared
//to ask

Create_Char()
var/mob/mob_created
var/world_name = "[world.name]"
var/value = key
var/text = "What would you like your name to be?"
var/name = input(src, text, world_name, value)as text
if(!name)
src.Create_Char()
return

var/choose_char = input("What would you like to be?")in list("Human","Monster")
switch(choose_char)
if("Human")
mob_created = new/mob/man()
mob_created <<"You are a human."
if("Monster")
mob_created = new/mob/mob()
mob_created <<"You are a monster."

mob_created.loc = locate(1,1,1)
mob_created.name = name
src.client.mob = mob_created


world
mob = /mob/Choosechar


mob
verb
Save()
src.client.Save_Char()
src << "\blue You have been saved."

mob
man
icon = 'man.dmi'
mob
icon = 'mob.dmi'





i get this error when i run the game

runtime error: Cannot read null.client
proc name: Del (/client/Del)
usr: null
src: Mxjerrett (/client)
call stack:
Mxjerrett (/client): Del()



and then nothing else appears
In response to Mxjerrett
Don't mess with Deadron's library unless you know what you're doing...
In response to Mysame
this isnt deadron but can u tell me how to fix it