ID:156718
 
on My new game im finaly making buildings and im wondering how to make portals for them to go to a new map when they walk in the door.

if someone can give me a tip without giving out the whole code.

iv tried using loc on turfs to make them spawn somwhere else but it didnt work.
To tell when someone has walked on a turf, you can override the turf/Entered() proc.

turf/portal/Entered(atom/movable/A)
if(istype(A, /mob)) // make sure that what walked on me is a mob
var/mob/M = A

DoStuffWith(M)


You can move stuff around by using locate() to find a target turf to send the object to, and then set the object's 'loc' variable to be that location.
In response to Skyspark
ok. So i tried and you mite as well help me lolz cause i feel dumb continuing. this is what i tried seeing how i didnt really understand. Sorry if this is easy and im not getting it.

turf/portal/Entered(atom/movable/A)
icon = 'Portal.dmi'
if(istype(A, /mob)) // make sure that what walked on me is a mob
var/mob/M = A
if(loc = 174,8,1)
set loc =(199,3,4)
In response to Bigj822
Look up locate and loc in the DM Reference.
If you don't know how to do something, the DM Reference is your best buddy.
In response to Bigj822
M.loc=locate(#,#,#) Locate is like the first thing in the dm guide.
In response to Bigj822
Well, you clearly don't know the syntax of the language, so you're going to need to read some tutorials.
In response to Bigj822
Might use this.
turf
Portal
density = 0
icon = 'Portal.dmi'
Enter(A)
if(ismob(A))
var/mob/M = A
if(M.client)
M.loc = locate(199,3,4)
else
if(istype(A,/obj/)) del(A)


This should help you out.
In response to Raimo
Enter is the wrong event hook to use when you want to process some action. It should be used to determine accessibility of movement. What you want is Entered.
And a hard-coded locate call is rather ugly when you want to change the map later on. Why not use a tag instead?
In response to Schnitzelnagler
Hey thanks all i havnt really figured it out yet but i'm still trying if you can explain a lil more in detail it would help alot thx.
In response to Raimo
Why do people do Enter(ed)(A) then go through the hassle of doing var/mob/M = A (especially when you confirmed only mobs should be able to step on it)? As far as I know it's as efficient either way it's just a bit of a quirk to me.
In response to Moonlight Memento
Because it's technically correct. Writing Entered(var/mob/M) does not filter out non-mobs.
In response to Garthor
But neither does var/mob/M = A.
In response to Moonlight Memento
It is because some non-mobs can step on it, so we do not want to treat them as mobs until we have confirmed that they are indeed mobs.

In the example, if a mob enters the turf, then it will teleport. If an object does (such as an attack) it gets deleted.
In response to Pirion
Where did I say it did? That's what if(ismob(A)) is for.
In response to Garthor
turf/grass/Entered(mob/M)
if(ismob(M)) return 1
else return 0

That's what I meant. There's no need for a second variable if only mobs are permitted entry.
In response to Flame Sage
Flame Sage wrote:
Look up locate and loc in the DM Reference.
If you don't know how to do something, the DM Reference is your best buddy.

What if it is on a different map? lets say you have 3 maps, one is the main map, on is a shop, and one is a house, how would you make the portal, to go to the shop map?
In response to Wolfnova
When the game is compiled, it fuses all of the maps into a giant map, and just increases the z layer.
In response to Moonlight Memento
Regardless, it's technically incorrect as, until the ismob(M) line, you don't know that M is a mob.
In response to Wolfnova
Then you'd use tags instead of absolute coordinates.
In response to Flame Sage
Flame Sage wrote:
When the game is compiled, it fuses all of the maps into a giant map, and just increases the z layer.
Ah, so basically just put like

mob/pc
login()
..()
turf/store_door
verb(m as usr)
Enter(m)
loc = locate(1,1,2

Like that?
Page: 1 2