ID:264722
 
Code:
    Light
icon = 'LightYagami.dmi'
icon_state = "Light NPC"
Endurance = 1000
verb
Talk()
set src in oview (1)
set category = "Yagami, Raito"
if(usr.DeathNote == 1)
usr << "Hey, you must be [usr.Alias]...also one of the seven Kira's...correct? Allow me to explain how it works. First, go to your inventory."
else
usr << "Go Away no or else!"


Problem description:
i need help with getting my NPC to do say what i want it to
ok i have a Light Yagami NPC and i want it to tell who ever it talks to certain things but it depends on if you have a death note. if you have a death note then he is supposed to tell you about it and how to use it but if you dont i want him to say Go Away! but it doent work it tells you to go away nomatter what even if i do have a death note

could you put this
world << "DEBUG: usr=[usr.name],src=[src.name]"
world << "DEBUG: DN check, usr=[usr.DeathNote] src=[src.DeathNote]";
// the 2nd line "MIGHT" create a unknown value error,

just before
if(usr.DeathNote == 1)
In response to ZeroLion
No that didnt work :(
In response to Uchiha Legacy
Code:
    Light
icon = 'LightYagami.dmi'
icon_state = "Light NPC"
Endurance = 1000
verb
Talk()
set src in oview (1)
set category = "Yagami, Raito"
if(usr.DeathNote == 1)
usr << "Hey, you must be [usr.Alias]...also one of the seven Kira's...correct? Allow me to explain how it works. First, go to your inventory."
else
usr << "Go Away now or else!"


Problem description:

i need help getting my npc to say what i want it to say.
i want it to explain the Deth Note if the person has it But if they dont have one i want him to say something else but right now it doesnt do that it says something else even if they dont have a death note please how do i fix this??
In response to Uchiha Legacy
Help vampire! [link] [link] [link] [link]
Begone. Also the best thing you could do is not use ripped code. Learn to code yourself.
http://www.byond.com/developer/ and
http://www.byond.com/developer/articles/start
In response to Leur
i did not rip this code i mad eit myself >.>
In response to Uchiha Legacy
Then why do you not know what is wrong with it? It's quite obvious actually if you just look at it.
In response to Leur
well i have and anything i tried has not worked i am trying to make it so that if the usr has a death note in their inventory i want the npc to explain it but if they dont i want the NPC to tell them different.

i changed the coding a little more and it still didnt work it is now like this

    Light
icon = 'LightYagami.dmi'
icon_state = "Light NPC"
Endurance = 1000
verb
Talk()
set src in oview (1)
set category = "Yagami, Raito"
switch(input("What would you possibly want with me?....wait let me guess you want have a Death Note and want to know about the Death Note?") in list ("Yes","No","Get Lost"))
if("Yes")
if(usr.DeathNote == 1)
usr<< "Oh Ok, you must be [usr.Alias]...also one of the seven Kira's...correct? Allow me to explain how it works. First, go to your inventory."
else
usr<<"How dare you lie to me you do not have the Death Note so therefore I shall tell you nothing, Leave my presence Now!"
return
if("No")
usr<<"Well ok then leave me alone."
return
if("Get Lost")
usr<<"You dare tell me to get lost that is a bad idea."
return


can u explain what i am doing wrong please.
In response to Uchiha Legacy
Chapter 02 of the DM Guide which you have not bothered to even glance through, explains your problem.
In response to Leur
If there was an indentation issue then the code would not compile in the first place.

The real issue is that the usr's DeathNote variable is not equal to 1. Which is the rather obvious answer to "Why is the body of this if() statement not executed?"
In response to Garthor
Quoted:
        verb
Talk()
set src in oview (1)
set category = "Yagami, Raito"
if(usr.DeathNote == 1)
usr << "Hey, you must be [usr.Alias]...also one of the seven Kira's...correct? Allow me to explain how it works. First, go to your inventory."
else
usr << "Go Away now or else!"


Oh yea, You're right, but how does that even compile as he has it?
In response to Leur
It compiles because it was transcribed improperly to the forum.
In response to Garthor
ok well i have edited the code some more and still have the same problem i even read the Chapter2 of the DM Guide and i still didnt get the answer this is my code now and there is no errors it just isnt doing what i want can u please just help me and explain what i have done wrong in this code

mob
var
DeathNote = 0

Light
icon = 'LightYagami.dmi'
icon_state = "Light NPC"
Endurance = 1000
verb
Talk()
set src in oview (1)
set category = "Yagami, Raito"
switch(input("What would you possibly want with me? ...Wait let me guess you have a Death Note and want to know about the Death Note?") in list ("Yes","No","Get Lost"))
if("Yes")
if(usr.contents == DeathNote)
usr<< "Oh Ok, you must be [usr.Alias]...also one of the seven Kira's...correct? Allow me to explain how it works. First, go to your inventory."
else
usr<<"How dare you lie to me you do not have the Death Note so therefore I shall tell you nothing, Leave my presence Now!"
return
if("No")
usr<<"Well ok then leave me alone."
return
if("Get Lost")
usr<<"You dare tell me to get lost that is a bad idea."
return

In response to Uchiha Legacy
The == operator is used to test for equality. The contents list of a mob is not going to equal a number.
In response to Garthor
ok so what i need to do is not check for it to be equal? but then im not sure how to make it check to see if the player has a death note or if it doesnt?
In response to Uchiha Legacy
You want to locate the first instance of an object type in a container, then check if the result is null, or not.

In order to prevent your next question, since you're not going to learn by reading the reference article I linked you to (given your desire to be spoon-fed):

var/type_of_your_deathnote/dn = locate() in container_to_search
if(dn)
world << "[container_to_search.name] contains a death note."
else
world << "[container_to_search.name] doesn't contain a death note."