ID:175061
 
i was wondering how to make a enemy drop a head.
Nave wrote:
i was wondering how to make a enemy drop a head.

You should try to be more specific with your questions, but I think I get the idea of what you mean. First, create an object called a head.

obj/head
icon = 'head.dmi'


This will obviously largely depend on your game. You will probably want to make sure the player can pick it up an such. Next, create a procedure for "dropping heads."

mob/proc/DropHead()
new /obj/head (loc)
view() << "[src] drops a head!"


That will create a /obj/head on the ground where the mob stands. The next step is to call DropHead when the mob dies. I am going to assume that this is called Die() for the example.

mob/Die()
..()
DropHead()


More than likely, you will want different mobs to drop different types of parts when they die.

mob
var/corpse_type
proc/DropCorpse()
if(!corpse_type) return 0
new corpse_type (loc)
Die()
..()
DropCorpse()

That would allow you to specify a corpse type. So, suppose the player is questing for The Head of Medusa.
mob
Medusa
corpse_type = /obj/corpse/medusahead
obj/corpse/medusahead
name = "head of Medusa"
icon = 'head.dmi'


All that's left is making the NPC who gives out the quest.
mob/NPC/medusa_seeker
verb/GetQuest()
set src in view()
usr << "The treacherous Medusa has stolen the life of my child! Avenge his death and I shall reward thee!"
verb/GiveHead() // Please, not funny remarks.
set src in view()
var/obj/corpse/medusahead/head
for(head in usr) // The empty for list here will automatically find a medusa head in the user's inventory
if(!head)
usr << "You do not possess the head I seek!"
return
del(head)
usr << "Thank you. Have a nice day!"
// Reward the player here.
In response to Ebonshadow
Ebonshadow wrote:
verb/GiveHead() // Please, not funny remarks.

You want some non-funny remarks? Well, if you insist. =P

Heh, heh... he said give... heh, heh...
In response to Crispy
what if the king wanted 100 heads?
In response to Nave
Nave wrote:
what if the king wanted 100 heads?
then you have to count the number of heads first.

mob/proc/CountItem(Type)
var/count
var/Item
for(Item in src) if(istype(Item, Type)) count ++
return count


That will return the number of a specified item type.

So, instead of checking to see if you quester has a head, use CountItem to check if he has 100.
In response to Ebonshadow
where do i put 100?
In response to Nave
???