ID:161758
 
I remember back when I first came to byond and attempted to make a game in the text-based area. I asked on here about placing mobs and objs in rooms via Zilal's tutorial number 3. And after about hour of searching. I can't seem to find it, so does anyone mind refreshing my memory?
Lundex wrote:
I remember back when I first came to byond and attempted to make a game in the text-based area. I asked on here about placing mobs and objs in rooms via Zilal's tutorial number 3. And after about hour of searching. I can't seem to find it, so does anyone mind refreshing my memory?

Although there are probably better ways to do this (I never really looked into it), you can directly hard code them in like this:

area/forest_sanctuary
New()
new/mob/wookie(src)

var/mob/wookie/W = new(src)
W.name = "Chewwy"


You might also try giving areas a params list (see params2list and list2params) of object types that you want created in that area when the game starts up, like this:

area
var
create_params

forest_sanctuary
create_params = "/mob/wookie;/mob/wookie;/obj/blaster"

New()
if(src.create_params)
var/list/L = params2list(src.create_params)
for(var/T in L)
new T (L)


It also depends on how your text-based game is arranged in the first place. I prefer to make text-based games that still use turf maps, so placing objects is pretty easy.
In response to Foomer
Foomer wrote:
Lundex wrote:
I remember back when I first came to byond and attempted to make a game in the text-based area. I asked on here about placing mobs and objs in rooms via Zilal's tutorial number 3. And after about hour of searching. I can't seem to find it, so does anyone mind refreshing my memory?

Although there are probably better ways to do this (I never really looked into it), you can directly hard code them in like this:

area/forest_sanctuary
> New()
> new/mob/wookie(src)
>
> var/mob/wookie/W = new(src)
> W.name = "Chewwy"

You might also try giving areas a params list (see params2list and list2params) of object types that you want created in that area when the game starts up, like this:

area
> var
> create_params
>
> forest_sanctuary
> create_params = "/mob/wookie;/mob/wookie;/obj/blaster"
>
> New()
> if(src.create_params)
> var/list/L = params2list(src.create_params)
> for(var/T in L)
> new T (L)

It also depends on how your text-based game is arranged in the first place. I prefer to make text-based games that still use turf maps, so placing objects is pretty easy.


Well, I remember using Move() and locate() to place them..
In response to Lundex
Yeah. For example, O.Move(usr.loc) drops object O into usr's room's contents. O.Move(usr) drops object O into usr's inventory. Think of locate() as a search function.
In response to Foomer
You can just set contents at compile-time (it is possible), you don't need to parse a text var or anything.
area/palace
contents = list(new /mob/king,new /mob/queen)
//can use newlist() shorthand
In response to Kaioken
Heh, this works perfectly...