Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - DarkMasterOz

#1
Thanks for all the help, it works fine. I did change the player.say, to the name of the character though for good reasons brought up about the speech thing.  :smiley:
#2
My game features 3 playable characters, who you can control anytime you want and will say different things when interacting with people/objects.

What i'm having trouble with, is having different dialogs for each object, depending on who's in the room with you.

For example:
if BARRY is in the room on his own and looks at a car, he'll say "Nice Car".
But if JOHN is in the room with him, he'll say something else like "Can I drive your car?" and JOHN replies with "No."

Whenever i try to do that, it'll always say the "Nice Car" bit first, regardless if he's on his own or not.
This is the code i have.

function hCar_Look()
{
if (player == cBarry) {
  cBarry.Say("Nice car.");
}
  if (player.Room == cLee.Room)
  if (player == cBarry) {
  cBarry.Say("I like his car?.");
  if (player.Room == cLee.Room) cLee.Say("We should take it for a drive.");
  if (player.Room == cBarry.Room) cBarry.Say("I'll get John's permission first.");
}
if (player.Room == cJohn.Room)
if (player == cBarry) {
  cBarry.Say("Can I drive your car John?.");
  if (player.Room == cJohn.Room) cJohn.Say("No, no you can't.")


I'm not sure if that makes any sense or not, if it doesn't i'll try to explain a bit more clearly when i'm less tired.   :smiley:
#3
Cheers, i've got it working now 1 last question, how can i make it so that if i pickup an object, look at an object, talk to a non playerable character etc... it does that dialog change thing when i talk to my playeble characters.

Example "Baz" reads a book which is a hotspot, its part of the plot and leaves a clue.
How can i make that trigger the next dialog so when my players talk they talk about and keep talking about it until i solve the clue and get another one which activates the next lot of dialog.
#4
Thanks the first bit works fine, sorry i've been away so i couldn't say thank you.
I'm not sure how to do this bit though, where do i put it and what do i need to change:

if (GetGlobalInt(1)==0) {
Ã,  // first dialog
Ã,  SetGlobalInt(1,1);
}
else if (GetGlobalInt(1)==1) {
Ã,  // second dialog
Ã,  SetGlobalInt(1,2);
}
else if (GetGlobalInt(1)==2) {
Ã,  // third dialog
Ã,  SetGlobalInt(1,3);
}


Do i make new dialogs like "dialog 39, dialog 40, dialog 41"
and add the speech there or can i add speech in the runscript which i use for my playerable characters when they interact with each other?
#5
Thanks that worked, But is there anyway to tweak it so that if the player is Baz only certain people will talk, while if the player was Bob, other certain people will speak. At the moment i've done this:

if (player == cBaz) { cBaz.Say("Is that a dog?."); }
if (player.Room == cBrian.Room) cBrian.Say("Yes, yes it is.");
if (player.Room == cBob.Room) cBob.Say("Wow you're clever arent you wonderboy.");
if (player == cBrian) { cBrian.Say("That's a dog."); }
if (player.Room == cBob.Room) cBob.Say("Correct.");
if (player == cBob) { cBob.Say("That is one big evil dog."); }
if (player.Room == cBilly.Room) cBilly.Say("How do you know it's evil?.");


But when Baz talks to the dog, it'll do this:
Baz: "Is that a dog?."
Brain: "Yes, yes it is."
Bob: "Wow you're clever arent you wonderboy."
Bob: "Correct."
Billy: "How do you know it's evil?."


anyway to make it stop at <Bob: "Wow you're clever arent you wonderboy."> and when another person looks interacts with the object/hotspot/character it'll say the rest?



can i add another question to this it's similar in away.
I've got my characters interacting with each other, an example from Talk runscript for my Baz character:

Ã,  Ã,  // script for Character 6 (Baz): Talk to character
if (player == cBaz) { cBaz.Say("I'll talk to myself later, busy thinking at moment!."); }
if (player == cBrian) { cBrian.Say("Yo Baz.");
cBaz.Say("Yo Bad Boy B."); }
if (player == cBob) { cBob.Say("How ya doing sparky?.");
cBaz.Say("Fine, Great, couldn't be better.");
cBob.Say("..Ok."); }
if (player == cBarry) { cBarry.Say("Any luck Baz?.");
cBaz.Say("Not quite yet.");
cBaz.Say("Keep us up-to-date.");
cBaz.Say("Will do."); }
if (player == cBilly) { cBilly.Say("Now then numpty.");
cBaz.Say("What?.");
cBilly.Say("What you upto?.");
cBaz.Say("Adventuring, doing Adventure type things.");
cBilly.Say("Just like me.");
cBaz.Say("Yup, just like you, you man of wisdom you.");
cBilly.Say("Quite true."); }Ã, 


But i want them to say different stuff each time and leave the old lines of talking behind when they progress with new information, mainly when i've collected an item or spoken to somebody and got some information for plot. Any ideas?
#6
Sorry i can't think of how to describe my problem in short for the topic title, I've got 5 characters:
* Character 1: Baz
* Character 2: Brian
* Character 3: Bob
* Character 4: Barry
* Character 5: Billy
and I want to make it so if a character is in a room with any one of the other characters and looks at something like an item or a hotspot, that other character will interact as well. Like this for example:

1) Bob looks at a window and says "It's a window"
2) If Baz is in the room with him, Baz will say "yes you're right"
3) If Brian is in the room with him he'll say "correct, that is a window" etc...
also
if any of the other characters interacts with an object, Bob will join in too.

I know how to make all 5 interact with each other by using this inside a "runscript" for example:

if (player == cBaz) { cBaz.Say("I don't know how to work it."); }
if (player == cBrian) { cBrian.Say("I've tried, it still doesn't work.");
cBob.Say("Well make it work"); }
if (player == cBob) { cBob.Say("If I did that, i'd kill everyone."); }
if (player == cBarry) { cBarry.Say("I am unable to comply."); }
if (player == cBilly) { cBilly.Say("You do it Bob.");
cBob.Say("No");
cBilly.Say("Brian?.");
cBrian.Say("No too.");
cBilly.Say("Barry?.");
cBarry.Say("I can't do that Dave.");
cBilly.Say("Baz?.");
cBaz.Say("Yeh I don't think so.");
cBilly.Say("Don't blame me if you beam into a brick wall covered with poo.");
cBob.Say("We bloody well will bottom gag, now do your stuff.");   }


But that will make them talk even if they arent in the room

If somebody can help me solve this, i've got one more problem which i cant seem to find answer to on forums or manual properly. After that i'm pretty much set.
#7
Thanks, that's got it working. Cheers for coping with my problems, now ive got it working i can add more replay value to my game plus i have a chance to link a plot together now.
Thanks  :)
#8
I did all that, it still says same error, i'll tell you everything i've done to make sure:

1) Made a GUI called "TRANSPORTERCON" and the Script O-Name says: "gTransportercon"
2) I changed the it to "Popup Modal" and where it says "On Click" its called "gTransportercon_Cli" by default
3) I double clicked the GUI and added this to the script when it popped up:

function gTransportercon_Cli(GUI *theGui, MouseButton button) {
Ã,  gTransportercon.Visible=false;
Ã,  transport(7);
}


3) I made a button with the script name "Earth" and where it says "Click" i named it "Earth_Click"
4) I double clicked the button and entered this to the script:

function Earth_Click(GUIControl *control, MouseButton button) {
}


5) I then went to Room 10 which is where my Transporter room is and made 2 hotspots
* 1) hotspot where the characters stand on to transport
* 2) hotspot where one of the characters use the machine to activate the transporter hotspot to move them to a different room.

6) Hotspot number one i typed "Transporter" in both "Name" and "Script-O-Name" <-- This is the hotspot the characters need to stand on.
7) Hotspot number two i typed "Transport" in both "Name" and "Script-O-Name" <-- This is the machine which one of the characters needs to use to bring up the GUI to pick the room to transport to.
8.) Then i clicked "Interaction..." for Hotspot 2 and made a "Run Script" for when the player "Interacts" with the hotspot. Then i put this inside the script:

gTransportercon.Visible=true;

9) Then i went to "Script" menu and selected "Edit Global Script..." and entered this:

function transport(int roomnumber) {
Ã,  int c=3;Ã,  Ã, // replace 3 with the number of the first crew char
Ã,  Character*chr;

Ã,  while(c<=8) {Ã,  Ã, // replace 8 with the number of the last crew char
Ã,  Ã,  chr=character[c];
Ã,  Ã,  if (chr.Room==player.Room && Hotspot.GetAtScreenXY(chr.x, chr.y)==hTransporter) {
Ã,  Ã,  Ã,  chr.ChangeRoom(roomnumber);
Ã,  Ã,  }
Ã,  Ã,  c++;
Ã,  }
}


Then when i go to save it, i get this error:

Error (line 19): undefined symbol 'hTransporter'

I'm obviously doing something wrong, but i can't see what.
#9
I did all that, now when i go to save it says this:

Error (line 19): undefined symbol 'hTransporter'

It sends me to this line when i click fix:

if (chr.Room==player.Room && Hotspot.GetAtScreenXY(chr.x, chr.y)==hTransporter) {

I fixed the GUI bug though, "Transporterconsole" was too long, i had to rename it with other bits of code to "Transportercon"

I'm using v2.72 of AGS the latest version.
#10
yeh how do i add the script function "Hotspot.GetAtScreenXY" I looked in manual and it just says:

if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hDoor)
Ã,  Display("Mouse on the door");
else if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) != hotspot[0])
Ã,  Display("Mouse is on something (but not the door)!");
else
Ã,  Display("Mouse not on a hotspot");


Which im guessing for me is changed to this, but i don't know where to put it:

if (Hotspot.GetAtScreenXY(215, 209) == hTransporter)
Ã,  Display("Mouse on the Transporter");
else if (Hotspot.GetAtScreenXY(215, 209) != hotspot[0])
Ã,  Display("Mouse is on something (but not the transporter)!");
else
Ã,  Display("Mouse not on a hotspot");



215,209 = Where my hotspot is
hTransporter = Name of my hotspot for Transporter


My hotspot where i want them to stand on to teleport is called "Transporter"
Button that one of the characters has to press to activate it is called "Transport"
Room is called "StarTrekTransporter"

I should have said i have no coding experiance too, sorry
#11
My game has 5 controllable characters with weird random plots and scenes, but i was wondering if its possible to do a transporter type room where 1 character has to activate a button to transport any characters that are stood on a certain hotspot? I'll break it up to bullet points again to let you know what i want doing if possible ;)
I'll make names up for characters:
Character 1: Bob
Character 2: Barry
Character 3: Ben
Character 4: Barney
Character 5: Brian

* Bob or any of ther other characters stands at a button ready to press to transport the other(s)
* Whoever is stood on the hotspot which will act as the bit they stand on, gets transported to a certain location.

Thats what i want to know how to do if possible, a bonus would be if i could have a GUI pop up when i press the button to show an icon of different places to choose, to send the characters to.
#12
Yeh, it seems to work now. When i put an item into mailbox it automaticly sends it to other characters inventory. Thanks!

Took some doing, but all is well in the end. Cheers  :)
#13
Right ive done all that what you said, i've:
1) Put the first script into Main Global Scrip right at the top, just underneith
// main global script file which is on line1

2) Ive edited the newly 3rd GUI which has my character buttons on. An example of one of my buttons information are:

Script name:       BARRY
X-Position:      Ã,  Ã,  Ã,  Ã,  Ã, 0
Y-Position:      Ã,  Ã,  Ã,  Ã,  Ã, 0
Image:         118
Mouseover Image:   (None)
Pushed image:      (None)
Width:         32
Height:         27
Text:         Ã,  Ã,  Ã,  Ã,  Ã, New Button
Font:         Ã,  Ã,  Ã,  Ã,  Ã, 0
Text Color:      Ã,  Ã,  Ã,  Ã,  Ã, 16
Clip image:      Ã,  Ã,  Ã,  Ã,  Ã, No
Left click:      Ã,  Ã,  Ã,  Ã,  Ã, Run Script
New mode number:   N/A
Click:         Ã,  Ã,  Ã,  Ã,  Ã, BARRY_Click

I then double click the button to bring up the the editing script which reads this:

#sectionstart BARRY_Click // DO NOT EDIT OR REMOVE THIS LINE
function BARRY_Click(GUIControl *control, MouseButton button) {
TransferItem( player, cBarry, player.ActiveInventory );
control.OwningGUI.Visible = false; // close GUI
}
#sectionend BARRY_ClickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

But when i go to compile i get this error:

There was an error compiling your script. The problem was:
In: 'Internal character defines'


Error (line 73): Variable '6' is already defined

Do you want to fix the script now? (Your game has not been saved).

when i click "Yes"

This pops up:
The error occured in an internal AGS script. This should never happen; try re-installing the latest version of AGS.


Sorry to keep bugging you over this, I've not removed any of the previous code from what you told me before if that could be it?

Oh yeh, just to make sure i am using: Current Version: 2.71

I think it might have something to do with "Script Name" on the buttons bit, because i deleted all the code except for the buttons information and it still kept popping up, so i deleted the "BARRY_Click" bit and it still kept displaying compile error, but when i deleted BARRY from:

Script name:       BARRY

It seemed to compile.
#14
Thanks the mailbox thing works great now, i can carry on making my game. Without it, it would have been very short, easy and boring. Now it should be quite long, difficult puzzles and hopefully quite enjoyable.

If you do know how to do a Day of the Tenticle type method, i'd love to know if its no problem for you to tell me.
Like i've said, i've done this:
1) Made the GUI with the character pictures on the buttons
2) Made it so when you click the Mailbox the GUI opens

Only thing i think i need to do now is: (all my 5 characters will have their own mailbox's)
3) Make it so EGO can put an item in Mailbox1 to give to a specific character who has his own/her Mailbox.
4) For some strange reason, now i've got the mailbox working the GUI wont pop up at all when i use mailbox.


If its too much work though, it doesn't matter atleast i can still transfer inventory items. Thanks for your helpful... help.Ã,  :)
#15
Thanks for helping.
What i meant for first bit was: How can i make it so when i use an inventory item like a "key" on the mailbox i just made (or any object for that matter) so it brings up a newly made GUI with pictures of the 5 characters on so i can click one of the character pictures to send it to them. Like in Day of the Tenticle.

I've already done:
* The GUI which pops up when i use the mailbox
* Added the characters to the GUI

Need Doing:
* I cant close the GUI with the pictures of the characters in.
* Not sure how to send items to them.

(I can probably explain it more clearly but thats not important if i can get the script you told me about working, because i prefer that one)


I've added this to Room script
"InventoryItem* item_in_mailbox = null;"


I'm guessing i put this in "Use Inventory on Object" > "Run Script" event:

// put active inventory item into the box

if (item_in_mailbox)
{
Ã,  Ã, Display("There is not enough room in the mailbox!");
}
else
{
Ã,  Ã, item_in_mailbox = player.ActiveInventory;
Ã,  Ã, player.LoseInventory( player.ActiveInventory );
Ã,  Ã, player.ActiveInventory = null; // just in case
}



And ive added this into "Interact Object" > "Run Script" event:



if (item_in_mailbox)
{
Ã,  Ã, // take item back
Ã,  Ã, player.AddInventory( item_in_mailbox );
Ã,  Ã, item_in_mailbox = null;
}



(But this error comes up when i try to run it)

There was an error compiling your script. The problem was:
In: 'Room 1 script'

Error (line 2): cannot assign initial value to global pointer

Is there anything i'm missing?
#16
I know the topic is quite old now, but i was wondering seeing i know nothing about scripting, what is the full code to add this effect and where do i put it?
Also seeing im using 5 characters is it possible to make it so that:

1) EGO puts inventory item into a mailbox (object).
2) Any of the other 4 character that uses the mailbox can collect the item.

(also just for this, i'll call the other 4 characters: Barry, Gary, Harry & Larry)

Thanks!
SMF spam blocked by CleanTalk