ID:819052
 
(See the best response by LordAndrew.)
Code:
    QuestGiver
icon='NPCs.dmi'
icon_state="QuestGiver"
Name = "QuestGiver"
verb
Quest()
set src in oview(1)
switch(input("What Quest Do You Choose","Quest")in list("Alien","Completed","Cancel"))
if("Alien")
if(usr.Quest == 0)
usr<<"QuestGiver: The Alien Quest there is a alien suit around this place just i don't know where it is"
sleep(10)
usr<<"QuestGiver: Your Duty is to find it"
Quest = 1
AlienQuest = 1
if("Completed")
if(usr.AlienQuest == 1)
if(usr.contents == /obj/AlienSuit)
AlienQuest = "Done"
Quest = 0
usr<<"QuestGiver: Nice Work"
if("Cancel")
return


Problem description:
Well i expect my users to press complete and get the word from the QuestGiver which is not happening mind giving me the things that are making this stop

usr.contents == /obj/AlienSuit is not proper syntax. usr.contents is (and I believe is always) a list.

You would need to actually locate() in usr.
What do you mean like
a
usr.locate /obj/AlienSuit
if so it will just locate the object i think
In response to Dr.Penguin (#2)
There's a few problems with your utilization of the syntax. locate() is not a mob procedure, but rather a global procedure. In this particular scenario, we want to look at the format locate(Type) in Container.

Type would be your /obj/AlienSuit and Container can be either usr or usr.contents, which is the same thing for the most part (contents is a list of things within something, and is applied to all atoms.)

Here, you would want to create a variable that attempts to locate the alien suit within the user. If it finds one, continue on with the procedure as normal. If not, tell the player to go find the suit.
    QuestGiver
icon='NPCs.dmi'
icon_state="QuestGiver"
Name = "QuestGiver"
verb
Quest()
set src in oview(1)
switch(input("What Quest Do You Choose","Quest")in list("Alien","Completed","Cancel"))
if("Alien")
if(usr.Quest == 0)
usr<<"QuestGiver: The Alien Quest there is a alien suit around this place just i don't know where it is"
sleep(10)
usr<<"QuestGiver: Your Duty is to find it"
Quest = 1
AlienQuest = 1
if("Completed")
var/obj/AlienSuit/A = locate(usr)
if(usr.AlienQuest == 1)
if(A >= 1)
AlienQuest = "Done"
Quest = 0
usr<<"QuestGiver: Nice Work"
if("Cancel")
return

Tried this but didn't work
You're getting closer!

Let's look at this example:

obj
suit
desc = "It's real snazzy."

mob
verb
getSuit()
// Create a new suit in the usr's inventory.
new /obj/suit(usr)

// Create a new variable, suit, of the type /obj/suit. locate() it within usr.
var/obj/suit/suit = locate() in usr

// In the event the usr doesn't have a suit, relay to them their horrible fashion sense and stop the procedure.
if(!suit)
usr << "Ain't got no style."

return

// If the usr does have a suit in their contents, then we'll make it this far.
usr << "Dirty dancin' in a suave black tuxedo for you!"

// The variable suit holds a reference to the particular one it located, so we can call upon some of the suit's variables.
usr << "You look at the suit. [suit.desc]"


This is an example of how to use locate() to find something in your inventory. To further test it, try commenting out the line new /obj/suit(usr) and clicking the verb to see what happens.

Using this same example, let's look at something you did wrong that would come to yell at you:

mob
verb
getSuit()
new /obj/suit(usr)

var/obj/suit/suit = locate() in usr

if(!suit) return

// The below line will give you the following runtime error:
// runtime error: type mismatch: cannot compare the suit (/obj/suit) to 1
// This is because suit is a reference to the /obj/suit it located in your inventory, and therefore isn't a number. You cannot compare an object against an integer.
if(suit >= 1)
// This line will never be reached.
usr << "You have one or more suits."
    QuestGiver
icon='NPCs.dmi'
icon_state="QuestGiver"
Name = "QuestGiver"
verb
Quest()
set src in oview(1)
switch(input("What Quest Do You Choose","Quest")in list("Alien","Completed","Cancel"))
if("Alien")
if(usr.Quest == 0)
usr<<"QuestGiver: The Alien Quest there is a alien suit around this place just i don't know where it is"
sleep(10)
usr<<"QuestGiver: Your Duty is to find it"
Quest = 1
AlienQuest = 1
if("Completed")
var/obj/AlienSuit/A = locate() in usr
if(usr.AlienQuest == 1)
if(A == 1)
AlienQuest = "Done"
Quest = 0
usr<<"QuestGiver: Nice Work"
if("Cancel")
return

Not working
Best response
if(A == 1) isn't technically wrong but you shouldn't be using it like that. In this case, 1 is equivalent to TRUE, so you could simply do if(A) to verify whether or not A is TRUE.

Under the part of the switch() for the case "Alien", you're setting AlienQuest = 1 for the src, rather than the usr. But then, you test to see if usr.AlienQuest is true in "Completed". I believe this is the cause of your problems.
Thanks now i can start working on new kind of quest but one more question how do i make enemies drop items
In response to Dr.Penguin (#8)
There are quite a number of ways to handle this. Could you be more specific as to how you'd want it handled?

The easiest way would just be to do something like this when an enemy dies:

mob
enemy
die()
for(var/obj/item/item in src)
item.Move(loc)

..()
    Enemies
DeathCheck(mob/attacker)
if(src.HP <= 0)
attacker<<"<b><font color=red>You killed [src] for [src.Exp] exp and for [src.Gold] Gold" // Enemy dies
attacker.Exp += src.Exp
attacker.LevelCheck()
isDead = TRUE
attacker.Gold += src.Gold
src.Respawn()

i want my enemy to drop like a alien suit when it dies but only for One Enemy
And how do i make it random
    Enemies
DeathCheck(mob/attacker)
if(src.HP <= 0)
attacker<<"<b><font color=red>You killed [src] for [src.Exp] exp and for [src.Gold] Gold" // Enemy dies
attacker.Exp += src.Exp
attacker.LevelCheck()
if(src.Name == "Alien")
for(var/obj/AlienSuit/Alien in src)
Alien.Move(loc)
isDead = TRUE
attacker.Gold += src.Gold
src.Respawn()

loading Story.dme
loading Skin.dmf
Attack.dm:61:error: Alien.Move: undefined var

Story.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
In response to Dr.Penguin (#10)
Going off of my last example:

mob
enemy
alien
desc = "Mean green probin' martian!"

New()
// Create a new suit for the alien. Somehow I don't think it fits him though.
new /obj/suit(src)

die()
// Add a bit if randomness to it. Should drop it half the time. This is a rigid way of doing this though, so you'd probably want some sort of variable determining the probability of an enemy dropping their things.
if(prob(50))
for(var/obj/o in src)
o.Move(loc)

..()
loading Story.dme
loading Skin.dmf
Enemies.dm:24:error: /obj/AlienSuit: duplicate definition
Enemies.dm:24:error: src: duplicate definition
Enemies.dm:24:error: new: instruction not allowed here

Story.dmb - 3 errors, 0 warnings (double-click on an error to jump to it)
    Alien
icon='alien.dmi'
icon_state=""
Name = "Alien"
Level=20
Exp=60
MaxHP=100
Str=20
Def=10
Gold=50
Side = "Evil"
new /obj/AlienSuit(src)
In response to Dr.Penguin (#13)
You need to create it in the alien's New() procedure.
i found a problem with this it messes with the combatai of the alien and when i kill it it's still density = 1
In response to Dr.Penguin (#15)
If you're initializing some sort of AI procedures in the alien's New() procedure, make sure to call ..() in one of them (or just merge them).
Now the enemies that respawn cant move D:
mob
enemy
alien
desc = "Mean green probin' martian!"

die()
if(prob(50)) new/obj/suit(loc)
..()


Return to your own New() code. Lord Andrew was correct, however as you probably have something inside your new proc that is getting overridden, it's probably a better idea to avoid messing with it at all.
This was done.