rooms

Started by viktor, Sun 16/05/2004 11:09:25

Previous topic - Next topic

viktor

I'll try to explain my situaction.
I've got four rooms and an item in my invetory (for example)
one room is acsesed by looking at the item. I  when I exit the room from the inventory item I want the character to be teleported in to the room where he looked at the item.

Please help me.  This is realy buging me. And is there any other way than scriptin couse I'm bot that good at it. I only know how to script dialogs.  :P
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

..

So when you  look at the invenotry it takes you to a new room? Is this room just a close up of the item?

If it is just a close up view of the item you could just use a new GUI thats shows the closeup. Set it to pop up modal than when you look at the Inventory item use

Game - Show GUI

viktor

yeah but with guis you have to script.
I have a closeup to a MP3 player. And when you hit a certain button a mesage pops up. I made butons like hotspots. I repeat. I'm a very clumsy when it comes to scripting and making things like guis and animations so please be patient with me...   ;)
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

..

KK Step by step...

Open up the Gui Editor
Click Create New Gui
On the pop up box where it says Visable Souble click and select Popup Modal
Set the Dimensions to 320x240 (Or whateveryour game resolution is)
Then double click on
Background Image in the little pop up box
Import the player bground and then double click on it
Now click on the button near the top with a picture of a button on it
Click and drag over the button on the hifi
Now you should have a grey box over the button
Change the Button Text to nothing (leave it blank)
now it should be transparent
Click Edit Script at the bottom of the Gui Editor
Now go to the bottom of whatever code is in there and type something like..

if (interface==3); // 3 Is the number of you player GUI
{
  if (button==0)
        {
DisplayMessage(500); // 500 is the number of the message
}
}

Then close and save the script
Go to the Global Messages pane and in the slot that you choose (500 in my example) Type in the message to be displayed.

Hope you understand this...


viktor

#4
OHH DAMN IT !!!!
Thanks for the help but I just cant get it to work. :'(  I downloaded AGS becouse I thought It didnt require any scripting. When I noticed  it did I was already so hooked with it that I didn't care. Isn't there any othere way. I mean there isn't any point in making scripts if you don't understadnd it. Then I'll just be posting posts on the forum for every script that I need.  >:(
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ishmael

when returning to the room:

NewRoom(character[GetPlayerCharacter()].prevroom);
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

..

Oh yeh, didnt think of that

viktor

Quote from: TK on Sun 16/05/2004 13:39:09
when returning to the room:

NewRoom(character[GetPlayerCharacter()].prevroom);
what!?
Can you explain what that means please...
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

..

All you have to do is on the room with the closeup of the mp3 player when you click on whatever it is that makes you close it use the Run Script option and put in that line of script.

viktor

yeah but now that thats over I have a new problem. When I exit the player is teleported to the top left croner of the screen how do I fixe that
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Ginny

You need to change:
NewRoom(character[GetPlayerCharacter()].prevroom);
into:
NewRoomEx(character[GetPlayerCharacter()].prevroom, charx, chary);
This was you coose where the player character appears. Change charx and chary to the coordinates on the screen you want for the character. Most likely you'll want to set this to whereever the player was standing before, or you could just set it 160 and 260, that's in the center. In the room editor, you can put your mouse over the place in the room you want the char to appear, and check above the image to see the coordinates, written in this form: (x,y).

I suggest that if you want to get along well with the program, you should carefully examine the manual, and try to grasp the basics of how the engine works. Don't forget the tutorials! :)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

viktor

I try to keep up with the manual but I only understand english when it comes to casual talk. I learned from a TV and not in school. Still. I'm the best in my class  ;D
Only my spelling sux. So i don't realy understand the manual some times. So please forgive me if i'm anoying some times...
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

viktor

Quote from: Ginny on Sun 16/05/2004 19:56:07
You need to change:
NewRoom(character[GetPlayerCharacter()].prevroom);
into:
NewRoomEx(character[GetPlayerCharacter()].prevroom, charx, chary);
This was you coose where the player character appears. Change charx and chary to the coordinates on the screen you want for the character. Most likely you'll want to set this to whereever the player was standing before, or you could just set it 160 and 260, that's in the center. In the room editor, you can put your mouse over the place in the room you want the char to appear, and check above the image to see the coordinates, written in this form: (x,y).

I suggest that if you want to get along well with the program, you should carefully examine the manual, and try to grasp the basics of how the engine works. Don't forget the tutorials! :)
That's no good. I need the character to be in exactly the same spot where he looked at the item. That's becouse the item is going to be available in every room and not every room has a walkable area exactly in the midle.
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

strazer

Unless you somehow moved the character or manually set the x and y coordinates (placing him outside the screen for example),
NewRoom(character[GetPlayerCharacter()].prevroom);
should work.
The x and y coordinates are not reset when the character is hidden, so he remains at the same position as when you left.

Ginny

#14
In that case, here's what you need to do:
First, since this is going to be avaialble in all rooms, you need to use global variables, which store number values (ints). Use SetGlobalInt(number, value); and GetGlobalInt(number); like so:

//when player clicks on item
SetGlobalInt(0, character[GetPlayerCharacter()].x);
//this sets the first free space you have to the player characters x position
SetGlobalInt(1, character[GetPlayerCharacter()].y);
//this sets the second free space you have to the player characters y position

Then, use this to return to the room (assuming you used a room, not the gui, as I didn't understand what you chose to use in the end):
NewRoomEx(character[GetPlayerCharacter()].prevroom, GetGlobalInt(0);, GetGlobalInt(1););

Hope this works for you :)

edit: strazer's post reminded me of something I wanted to mention: since the room is a closeup of an item, the player is hidden, and to make the game hide the player character, there's a checkbox in the room editor that says something like "Player character is hidden", and just thought I'd mention it in case you didn't tick it.
strazer is right, this should have worked without all these globalints. ;)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

viktor

strazer:
I tryed that and its still the same problem. All rooms don't have the same walkable areas. So that's out. sorry.

Ginny:
DAMN IT!
Sorry but I'm just so angry (not with you don't worry).
I'm angry becouse I don't get what your trying to tell me. The more I look in to those scripts the more confused I get. Maybee im slow or something but i realy hoped that there would be an easier way to do this.
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Scorpiorus

Quote from: viktor on Sun 16/05/2004 19:25:32
yeah but now that thats over I have a new problem. When I exit the player is teleported to the top left croner of the screen how do I fixe that
As Strazer pointed out, player character's coordinates are not altered if you just change a room. When the player is looking at the inventory item, what action have you put? Player - goto a different room or Player - goto a different room (at specific co-ordinates) ? Ensure it is just Player - goto a different room.

TheSaint

'scuse me but while i was reading your answers to viktor i noticed a phrase i dont understand "item closeup" and mp3 closeup. Care to explain please?

greetZ,
TheSaint

Scorpiorus

Quote from: TheSaint on Sun 16/05/2004 23:33:11
'scuse me but while i was reading your answers to viktor i noticed a phrase i dont understand "item closeup" and mp3 closeup. Care to explain please?
It is just a room with a zoomed-in view of the inventory item - MP3 music player.

viktor

I got a simple solution. I used the script from TK. And then i set the coordinates in the closeup room to 0,0.  Then im gona set every room like this: When player stands on coordinates 0,0 move to same room but to diferent coordinates.
The only problem with this is that I have to set every room seperate.
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

SMF spam blocked by CleanTalk