Well im making this game with a map, and when you clik on it it takes you to another room, sort of a closeup of the map.But the problem is if you view the map from another room, it takes you back to the first room.What i want to do is tell the game to take the character to the room he was in . But i dont know how ;D . Can anyone help me :'( ?
Eek.. Double post :O
Never mind...
See this thread :
http://www.agsforums.com/yabb/index.php?topic=13954.msg169143#msg169143
And scroll down a bit, this person had the same problem, kind of.
Yeah, use the following script code to return to the previous room:
NewRoom(character[GetPlayerCharacter()].prevroom);
Thanks a lot i fixed it ;) ! But how do you add a score box in the status bar that shows your current score?
Make a label and set its text to one of the following (whichever you want)
@SCORE@ The player's current score
@SCORETEXT@ The text "Score: X of XX" with the relevant numbers filled in.
@TOTALSCORE@ The maximum possible score, specified on the Game Settings pane
Hey can you make an enable region or a disble hotspot? Because im making a game, and when you enter a room the outside room darkens up. But i cant seem to do it right. Can you help me?
Well, you can disable/enable hotspots using these commands:
DisableHotspot (hotspotNum)
EnableHotspot (hotspotNum)
...and the regions:
DisableRegion (regionNum)
EnableRegion (regionNum)
Ok i fixed that but thanks anyway. Hey if i want to create a script for a dialog, like if you have an item and it enables an option, and i put it in the room script will it run on its own or only in the dialog when run script is written?
You don't put it in the room script but write a special function in the main global script and call it from the dialog script, for example:
dialog script: (option 2 is initially off)
@s
return
@1 // simple hello option
ego: hey hello
wizard: greetings stranger
run-script 1 // to check if the option 2 can be enabled
return
@2
wizard: have you brought the item?
ego: yeah, here it is!
wizard: good! now ask what do you want?
ego: I WANNA RULE THE WORLD!!!11!11!!
wizard: hahaha! poor man! No, you don't!
stop
main global script:
//main global script
function dialog_request(int value) {
if (value==1) {Ã, // if we have called this function with run-script 1
if (character[GetPlayerCharacter()].inv[SOME_ITEM_NUM] > 0) {
SetDialogOption (topic, 2, 1);
}
}
}
Hey thanks i did the code exactly like yours but i was writing it in the room script hanks a lot man. Listen to this.I am making a conversation with 2 guys and at the bigining they say a long conversation.How do i make it that if you talked to them already it just shows a simple message like "hello" or something?Thanks
You should set a GlobalInt when they have talked the first time and then check it when the player runs the conversation again. How did you make the conversation? With the DisplaySpeech command? Or running a dialog topic? Did you put it under @S token?
I wrote the code like this and its saying there is an error when i try to save, whats the problem?
function dialog_request(1) { <= Error in this line
if (value==1)
if (character[GetPlayerCharacter(2)].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
}
function dialog_request(int value) {
if (value==1) {
if (character[GetPlayerCharacter(2)].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
}
"int value" means that the value of the parameter (the "1" in "run-script 1") you pass to this function is stored in the integer variable named value.
With
if (value==1) {
you check if this variable is set 1 (i.e. "run-script 1" was used). The code enclosed in the brackets is then executed.
To check if "run-script 2" was used, you just have to check if value is 2. Thus you would do:
function dialog_request(int value) {
if (value==1) {
if (character[GetPlayerCharacter(2)].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
else // value is something else than the above
if (value==2) { // run-script 2 was used
// do stuff
}
// check for value==3 and so on
}
function dialog_request(int value) {
Ã, Ã, if (value==1)
Ã, Ã, Ã, if (character[GetPlayerCharacter(2)].inv[1] > 0) {
Ã, Ã, Ã, Ã, Ã, SetDialogOption (topic, 0, 7);
Ã, Ã, Ã, }
Ã, Ã, }
}
I wrote it like that and its saying there is something wrong with the get playercharacter command. Whats wrong?
Edit: how do ise game.bgspeech_stay_on_display ?
Oops, didn't see that:
function dialog_request(int value) {
if (value==1)
{ if (character[GetPlayerCharacter
() ].inv[1] > 0) {
SetDialogOption (topic, 0, 7);
}
}
}
And in the SetDialogOption function, you have to replace "topic" with the number of the dialog topic.
The second parameter has to be at least 1.
The last parameter can only be 0, 1 or 2.
Check the manual!
Quotehow do ise game.bgspeech_stay_on_display ?
Put this in your game_start function:
game.bgspeech_stay_on_display = 1;
Then background speech isn't removed when doing DisplaySpeech.
Hey thanks for all you help i really appritiate it. Im sort of a noob so i do need some help cos im making quite a complicated game for a first one. I know variables are very usefull but i dont know how to use them. Could you point to something that will help me or just tell me yourself? Thanks! ;D
You're welcome. :)
What is there to tell about variables? I wouldn't know where to begin.
Read this (http://www.rain-day.com/harbinger/faq/#coding01) and feel free to ask any specific questions.
Ok im getting the hang of variables. I was wondering did anyone ever produce a commercial game with this programm, cos i think it is possible. They should do a cd, named "The advantures return!" (sorry about the spelling) and put the best game donw by this programm in it. good idea huh but i think its a bit complicated to publish a game. With the display speech , you can show how many mesasges you want?
I think The Adventures of Fatman (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=5997) was the first game made with AGS that was being sold.
It's officially abandonware now, so you can legally download it.
With DisplaySpeech you can display as many sentences as you want, because you pass the text directly, like this:
DisplaySpeech(EGO, "This is simple text, not a message!");
Hey can you make a character play a view? Not a flik. Whats the code for it?
Jesus Christ, Tanker, most of your questions can be answered by reading the Beginners' FAQ. Please read it THOROUGHLY before asking anything else. Also read the manual THOROUGHLY, search through it, and the AGS web site has some good resources as well. So please ask questions that are NOT in any of these resources. Otherwise, this thread will be locked. Thanks.
As for your question, look up the manual. Search for "character" or "view". That's what it's there for. Thanks.
Oh sorry im quite the lazy ass.What happens is i have a problem, i post it and then before you answer it i fix it. ;D
Import int photo;
if (photo==0) {
Ã, Displayspeech ('I have a probelm with cursing.');
}
if (photo==1) {
Ã, Displayspeech ('I also have a problem with cursing.');
}
I tried this script in an inventry object and it wont let me import the integer so the script wont work. How can i do this in an inventry object?
Ã,Â
To import a variable put import int photo; at the very top of that room script.
Also, you have to export that variable from the main global script by putting the following line at the very bottom of the main global script:
export photo;
Of course, the variable itself has to be declared at the top of the main global script:
// main global script:
int photo;
Did you even read my question, i have a problem using it in an inventory item.
a) you probably don't have permission to hot link from The Legend of Monkey Island, so i would immediatly take those out of your signature.
b) Your signature is too big, please condense it.
c) If Scorp, who very nicely answers questions, didnt answer your question, then could you elaborate?
I just told him to read the question cos thats not what i wanted thats all. And there wasnt anything that said do not hot link on legend of mi.I removed
a gif so its smaller.
"To import a variable put import int photo; at the very top of that room script."
But you put it at the top of inventory item script. Btw, since it's an inventory item you can just remove the import int photo line at all. That's because all inventory item script functions are located within the main global script where the photo variable is actually declared.
hope that helps
its good internet etiqutte to not hot link without permission. save it to your own server, or use the uploader here: http://www.agsforums.com/yabb/index.php?topic=3584.0
OK thanks for the help. But i cant understand one thing. I have a global varieble and i imported it into 2 rooms.Now as you enter the first room it sets the int to 1.And in room 2 there is a script like this:
if (watever==1)
{ objecton (1); }
but it never seems to work .The object just stajs the same.Do i have to use a command that exports the int from room1 to room2?
Never mind i did it. But how do you make a boolean in the script. I cant find it anywhere.
You just use INTs:
int booleanVariable = 1; // means TRUE
...
if (booleanVariable == 0) {
// if boolean Variable is False
} else {
// if it's TRUE
}
Can i tell the game to stop at a point?
if (character[GetPlayerCharacter()].inv[24])
{ MoveCharacterToObject (2, 2);
DisplaySpeech (2, "Il just light it on.");
DisplaySpeech (2, "The lighter stopped working again! Piece of shit!");
LoseInventory (24);
SetObjectView (2,15);
AnimateObject (2,0,0,1);
candle=1;
}
<= stop here
if (character[GetPlayerCharacter()].inv[20])
{ if (candle==1)
{ MoveCharacterToObject (2,2);
Display ("You look at the index and find the spell Reversal on page 80.");
DisplaySpeech (2, "So lets se here..77...79...and here it is page 80!");
DisplaySpeech (2, "It says here to light a black candle near the place the spell was cast....");
DisplaySpeech (2, "Done.");
DisplaySpeech (2, "....and to read the following:");
DisplaySpeech (2, "Ade tu uja");
DisplaySpeech (2, "By the lord of darkness");
DisplaySpeech (2, "Give me the power i beg of you!");
Display ("You feel empowered, a beam of dark light emerges from your chest and breaks the barrier.");
DisplaySpeech (2, "Hey it worked.");
SetObjectGraphic (2, 348);
candle=2;
ObjectOff (1);
Because it runs the actions after each other for some unkown reason.
It runs the second part because you set candle = 1 at the end of the first one. Put "else" where "<= stop here" is:
if (character[GetPlayerCharacter()].inv[24])
{ MoveCharacterToObject (2, 2);
Ã, DisplaySpeech (2, "Il just light it on.");
Ã, DisplaySpeech (2, "The lighter stopped working again! Piece of shit!");
Ã, LoseInventory (24);
Ã, SetObjectView (2,15);
Ã, AnimateObject (2,0,0,1);
Ã, candle=1;
}
else if (character[GetPlayerCharacter()].inv[20])
{Ã, if (candle==1)
Ã, Ã, {Ã, MoveCharacterToObject (2,2);
Ã, Ã, Ã, Display ("You look at the index and find the spell Reversal on page 80.");
Ã, Ã, Ã, DisplaySpeech (2, "So lets se here..77...79...and here it is page 80!");
...
...
...
Problems with gui:
Ok so i made a gui with 2 buttons. It will be a death screen (when you die it appears).But there are 2 things i cannot do. Where do you write the script for the buttons because when you cvlick edit script it only shows the script for the first gui.And the second problem is that i want it to stop the game running and let you only press the load and save buttons (wich are on the gui).Thanks. ???
Edit:
Why is it giving me an error in this script?
if (character[GetPlayerCharacter()].activeinv[24])
{ MoveCharacterToObject (2, 2);
DisplaySpeech (2, "Il just light it on.");
DisplaySpeech (2, "The lighter stopped working again! Piece of shit!");
LoseInventory (24);
SetObjectView (2,15);
AnimateObject (2,0,0,1);
candle=1;
Quote from: Tanker on Sun 30/05/2004 10:44:39Where do you write the script for the buttons because when you cvlick edit script it only shows the script for the first gui.
Just add the code for the death GUI:
if (interface==DEATHGUI) {
if (button == 0) { ... }
if (button == 1) { ... }
}
QuoteAnd the second problem is that i want it to stop the game running and let you only press the load and save buttons (wich are on the gui).
Set that GUI's visible property to Popup Modal. Thus it will pause the game.
QuoteWhy is it giving me an error in this script?
Could you be more specific about the error you get, what's error message? Furthermore, does it display the error during saving of the script or at run-time?
Thanks a lot for your help. But tell me if you use Movecharactertopath , can you use it to make a guy patrol continuasly?
Yeah, you can loop it by checking a character[].walking variable within the room's repeatedly execute:
room's repeatedly execute:
if (character[PATROL].walking == 0) {
MoveCharacterPath(PATROL, x1, y1);
MoveCharacterPath(PATROL, x2, y2);
MoveCharacterPath(PATROL, x3, y3);
MoveCharacterPath(PATROL, x4, y4);
}
Is there a command that tells the player to always be on top of objects in a room?
Simply set his baseline a value equal to room's height:
SetCharacterBaseline (GetPlayerCharacter(), game.room_height);
Ok thanks a lot.
But im making an area in my game that there are 2 rooms in one room.
Sirt of like this:
/ / /
/ / /
/ / /
/ / /
And im making it that if you look at an object from inside the second room it says "I cant see from here.". But he still walks to the hotspot and i dont know how to make it enable and disable walk to points.
Quotei dont know how to make it enable and disable walk to points
Use
game.auto_use_walkto_points = 0;
or
game.auto_use_walkto_points = 1;
What you mean i do sort of like this:
if (bla==0) {
game.auto_use_walkto_points = 0;
displayspeech ("I cant see from here.");
}
if (bla==1) {
game.auto_use_walkto_points = 1;
displayspeech ("Its a box.");
}
It probably doesn't work because I assume he walks there before executing the event. Don't know though.
Test it and let me know. :)
You could disable auto-walking in general for your game, you would then have to move your character manually:
Game_start
game.auto_use_walkto_points = 0;
Look at hotspot
if (curroom == 2) DisplaySpeech ("I can't see from here.");
else {
MoveCharacterBlocking(GetPlayerCharacter(), GetHotspotPointX(GetHotspotAt(mouse.x, mouse.y)), GetHotspotPointX(GetHotspotAt(mouse.x, mouse.y)), 0);
DisplaySpeech (GetPlayerCharacter(), "Its a box.");
}
Or i could just use MovecharactertohotspotÃ, ;D .
Heh, yes. :)