ID:174991
 
I'm trying to figure out how to get a creature to drop a chest (randomly) and then when a player dblclicks on the chest it would choose items randomly from a set list and deposit them directly into the person's inventory.

The problem I'm having is how do I get a list for the chest to choose from, and how do I add it into the persons inventory...





Also, would anyone know how I make my game open a specific url in the browser window when they join my game? :)
SophusVir wrote:
I'm trying to figure out how to get a creature to drop a chest (randomly)

<code>mob/creature proc/die() view(src) << "[src] dies a horrible death" if (prob(20)) new/obj/chest(loc) del src</code>

and then when a player dblclicks on the chest it would choose items randomly from a set list and deposit them directly into the person's inventory.

<code>obj/chest/DblClick() var/possibleitemtypes=list(/obj/item/sword, /obj/item/cheese, /obj/item/voodoochicken) var/itemtype=pick(possibleitemtypes) new itemtype(usr) del src </code>

If you want to make the list of items dependant on the creature, you'll need to make the "possibleitemtypes" var belong to the chest, and set it from within die().

Also, would anyone know how I make my game open a specific url in the browser window when they join my game? :)

Look up link().
Well, Cripy seems to have answered your other problem, so I won't bother...not to mention that I couldn't have in the first place, so, lets get that browser window, eh?

//The first step would be to create a new webpage with
//your editor, and save it to your game directory, then...

mob/Login()
browse('Webpage.html')

//If you would want to make it a popup window,
//you can do that, along with a bunch of
//other stuff if you look up browse()
// in the refrence...
//but it doesn't it explain it to newbs
//that you have to
//have the file, and the stuff too:

mob/Login()
browse('Webpage.html',"window=webpage.html;size=300x500")

Hope that helped, you might have to put ' ' around webpage.html in the window= part, but whatever...I'm a bit rusty.
In response to Dragon of Ice
Dragon of Ice wrote:
You might have to put ' ' around webpage.html in the window= part, but whatever...I'm a bit rusty.

Nope, it won't make any difference. =) SophusVir's question was about displaying specific URLs, not browser windows in general. Although admittedly he might have meant browser windows in general. =)
In response to Crispy
O, guess I gotta read more carefully next time...sorry SophusVir.
In response to Dragon of Ice
oh no not at all, no need to be sorry. In fact the information you shared will be quite useful to me. After all what if I want to for instance show who won a contest or who was part of a successful roleplaying event.. new features and important info? why popup windows of course :) so you see you just gave me even more useful information and I'm glad you took the time to share your knowledge with me.. heck, I'm just glad there are so many helpful and willing people on this forum, otherwise I'd probably have a breakdown with all the problems I have :) lol. anyways, thanks for the info all of you!
In response to Crispy
how would this work though if all npcs follow the same death function. How would I make them drop seperate types of loot?
In response to SophusVir
It's not hard at all, actually:

mob
monster
var
loot_type

goblin
loot_type = /obj/items/dagger

orge
loot_type = /obj/items/axe

proc
Death()
//check if they're dead here
if(prob(50)) //a 50% chance
new src.loot_type(src.loc) //drop some loot!



Don't forget to only use type-paths you've already defined under "loot_type".
In response to Nadrew
ok. well I got that working but.. how do I make the object something I can pick up? lol
In response to SophusVir
Give it a get or pick up verb. =P
In response to Crispy
/obj/items/small_pile_gold
verb/Get()
var Amount = 1
Gold
icon = 'gold coins.dmi'
var/obj/Money/Gold/O


This is what I have so far, for some reason it still wont let me pick it up. I know its probably something real simple but ugh it isnt working out for me lol
In response to SophusVir
you need to set the location of the object into the location of the user. E.g.
M.loc = src.loc

Oh and you really should use the
<dm> tags around your code, that code makes no sense at all :)
In response to Maz
if(prob(100))
new src.loot_type(src.loc)



I did that here :) in the death proc, the item itself drops fine and in the right location, I just cant get it to let me pick it up lol
In response to SophusVir
Well, you need to make the get verb actually DO something. =)

<code>obj/items/goldpile/small verb/get() set src in oview(1) Move(usr) //Move into usr's inventory</code>