Warp to different location than o_player's x,y

M

mamacato

Guest
I thought it would be easier to ask using a video. The gist is that I placed obj_player physically in the rooms. So when I warp from one room to another, I always warp to where I placed obj_player. I want to have more control over this.

In this example, I'm warping from an apartment to a balcony. Then I enter an apartment one floor above through a window, but I want to leave this other apartment through the balcony. It will of course bring me back to the balcony of the lower floor apartment because that is where obj_player has been placed in the room.

Thanks for the help!


EDIT: I forgot to mention, that I tried using
Code:
if room_previous(rm_3rd_floor_apartment)
{
      o_player.x = new_location;
      o_player.y = new_location;
}
but I think that might just mean the previous room in the tree? I don't know. Either way, that didn't work.
 
Last edited:

woods

Member
something like this...

in the obj_door
step event
Code:
if place_meeting(x,y,obj_player)
{
room_goto(rm_game)
obj_player.x=1120
obj_player.y=1024
}
 
That won't work. Going to the next room executes AFTER the current event has finished. So it would simply warp the player to those coordinates, then move on to the next room, where a new instance of the player is placed at the coordinates OP does NOT want. There's a few ways of doing this. One is to have a persistent controller object (my preferred way) and use THAT to spawn the player, instead of placing the player in the room. This way, you can have some variables that you spawn to (let's call them spawn_x and spawn_y) which are used when you create the player instance. Update these variables at the end of the room and spawn the player instance at those variables in the new room. Another way would simply be to remove the controller object and use global variables to hold the player's position. Then in the Create Event of the player, use x = global.spawn_x and y = global.spawn_y.
 
Don't set the room to persistent. That can potentially introduce a suite of problems later on (a few of the other topics on page 1 are dealing with problems that wouldn't have appeared if they weren't using persistent rooms).
 

Gzebra

Member
Don't set the room to persistent. That can potentially introduce a suite of problems later on (a few of the other topics on page 1 are dealing with problems that wouldn't have appeared if they weren't using persistent rooms).
I agree, hell, don't use multiply rooms, and don't use the room editor, and don't make objects using drag and drop. But we both know that that's not how the OP does things.
 

woods

Member
got mine in 09

since then its fell off a 4ft shelf to a concrete floor ...landed on the back corner.. which took out the DVD drive, 75% of the keyboard,both internal fans, and a spiderweb crack on the screen...

after 6 weeks of if sitting on an ice bucket with the dollar store fan pushing cold air around.. hooked up to a 15 yr old tv that i got from a buddy, and a junk monitor from my mum, with a $10keyboard from walmart ..external everything i can hook to it to make it functional...

ya kow, most people are happy when they over clock their machine.... boy was i happy when i turned it DOWN so it would run more than 30mins before overheating....

but as far as specs go.... i got a pretty brutal paperweight ;o)
Code:
Computer Information:
    Manufacturer:  ASUSTeK Computer Inc.
    Model:  G73Sw
    Form Factor: Laptop
    No Touch Input Detected

Processor Information:
    CPU Vendor:  GenuineIntel
    CPU Brand:        Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz
    CPU Family:  0x6
    CPU Model:  0x2a
    CPU Stepping:  0x7
    CPU Type:  0x0
    Speed:  1995 Mhz
    8 logical processors
    4 physical processors
    HyperThreading:  Supported
    FCMOV:  Supported
    SSE2:  Supported
    SSE3:  Supported
    SSSE3:  Supported
    SSE4a:  Unsupported
    SSE41:  Supported
    SSE42:  Supported
    AES:  Supported
    AVX:  Supported
    CMPXCHG16B:  Supported
    LAHF/SAHF:  Supported
    PrefetchW:  Unsupported

Operating System Version:
    Windows 10 (64 bit)
    NTFS:  Supported
    Crypto Provider Codes:  Supported 311 0x0 0x0 0x0

Video Card:
    Driver:  NVIDIA GeForce GTX 460M
    DirectX Driver Name:  nvldumd.dll
    Driver Version:  23.21.13.9135
    DirectX Driver Version:  23.21.13.9135
    Driver Date: 3 23 2018
    OpenGL Version: 4.6
    Desktop Color Depth: 32 bits per pixel
    Monitor Refresh Rate: 60 Hz
    DirectX Card: NVIDIA GeForce GTX 460M
    VendorID:  0x10de
    DeviceID:  0xdd1
    Revision:  0xa1
    Number of Monitors:  2
    Number of Logical Video Cards:  2
    No SLI or Crossfire Detected
    Primary Display Resolution:  1920 x 1080
    Desktop Resolution: 3280 x 1080
    Primary Display Size: 20.00" x 11.26" (22.91" diag)
                                            50.8cm x 28.6cm (58.2cm diag)
    Primary Bus: PCI Express 16x
    Primary VRAM: 1024 MB
    Supported MSAA Modes:  2x 4x 8x

Sound card:
    Audio device: SAMSUNG (NVIDIA High Definition

Memory:
    RAM:  8170 Mb

Miscellaneous:
    UI Language:  English
    Media Type:  DVD
    Total Hard Disk Space Available:  714397 Mb
    Largest Free Hard Disk Block:  378287 Mb
    OS Install Date: Dec 31 1969
    Game Controller: None detected
    VR Headset: None detected


sry for derailing the thread ;o)
 
M

mamacato

Guest
I agree, hell, don't use multiply rooms, and don't use the room editor, and don't make objects using drag and drop. But we both know that that's not how the OP does things.
what does this mean?
 

woods

Member
drag and drop... is very limited in what it can do ... compared to using scripts and code... tho for those of us that are not proficient with making our own scripts will find it easier to use.. not as scary if you will

dont use the room editor.... make everything happen in the scripts... im not sure exactly how to do this.. but the room editor gives us a visual feel of what is where and such...m not sure exactly what he means here

using multiple rooms... you will run into snags when switching rooms.. loosing locations and variables etc.. nasty can of worms... maybe storing all your info that you want to keep in global variables is the way to go... i donno... i have problems every now and again when to make things persistent or not or creating a second instance of my player when i come back to the room... maybe thats part of the dont use the room editor.. so you obly have X number of things in your room... and not loosing an invisible object somewhere..


shrugs
 
Top