Linking GUI's to GUI's and character selecting, and anything else

Started by , Fri 30/01/2009 01:37:51

Previous topic - Next topic

Khris

You don't need an else, the three conditions are exclusive of eachother.
Do you want to display the whole sentence at once?

Code: ags
function oRock1_Look()
{
  String s = "That big damn boulder is blocking the path";
  if (player.NormalView == 11 || player.NormalView == 35) player.Say(s.Append(", wonder if i could push it out the way?"));
  if (player.NormalView == 45 || player.NormalView == 69) player.Say(s.Append(", wonder if I could climb over it?"));
  if (player.NormalView == 57 || player.NormalView == 21) player.Say(s.Append(". I think I could probably smash that rock into pieces."));
}

ShadowRifter666

ok, well i need to have the first speech as a Display dialog so could i code it as

Code: ags

function oRock1_Look()
{
   Display ("That big damn boulder is blocking the path")
  String s = "";
  if (player.NormalView == 11 || player.NormalView == 35) player.Say(s.Append(", wonder if i could push it out the way?"));
  if (player.NormalView == 45 || player.NormalView == 69) player.Say(s.Append(", wonder if I could climb over it?"));
  if (player.NormalView == 57 || player.NormalView == 21) player.Say(s.Append(". I think I could probably smash that rock into pieces."));
}

Khris

What's wrong then with your original code? What doesn't work? It looks just fine for what you want.

Trent R

You have a total possibility of 6 characters right? 3 classes and two genders. Why not use a global variable (or 4) to check which the player has chosen? I'd find that easier and cleaner to code and read, rather than a ton of NormalView checks.

You could probably use extender functions and enums creatively, and make a player.Class which you can easily check.

BTW, I'm just speaking generically about your game and code here, not your specific problems. Also, I haven't read through the beginning of the thread recently either..


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

ShadowRifter666

To KhrisMUC the code looks alright, but when trying to use it it only shows the Display text onscreen, the player.Say text doesn't appear, I have added on player.Say(s) at the end of the code just to be sure it does appear but still nothing


To Trent R, I haven't got a clue how to use global variables, and the way that I am learning at the moment everything seems to be working out alright using the player.NormalView apart from recent areas shown in previous posts

Khris

In the Global variables pane, create two vars, type int, name gender/class, initial value 0, done.
You'd have to remove the declaration lines from the global script then, of course (e.g. "int class;").

Then you could add an enum def in the global header:
Code: ags
enum Class {   // note the capital C in Class! class isn't available anymore, it's the var used to store the class
  eClassBeast = 1,
  eClassWarrior = 2,
  eClassThief = 3
};


In the code, you can now use
Code: ags
  if (class == eClassBeast) player.Say("blah");

ShadowRifter666

For now I think I will stick with NormalView, rather than Global Variables, I just got the first one working so keep on that path for now, maybe look at changing other bits though

Khris

Well, of course you can continue on that rocky path with all the thorny bushes, but why don't you climb up a bit and use the nice, scenic one?

If you're going to have a lot of these in the game, you can do:
Code: ags
// add this to header
import void Say(String beast, String warrior, String thief);

// global script, below all the class selection GUI code
void Say(String beast, String warrior, String thief) {
  if (class == 1) player.Say(beast);
  if (class == 2) player.Say(warrior);
  if (class == 3) player.Say(thief);
}


Now you can use
Say("I think I could probably smash that rock into pieces", "wonder if i could push it out the way?", "wonder if I could Climb over it?");

ShadowRifter666

managed to get a fair bit of code working now, just was over complicating it

Code: ags

function oObject0_Look()
{
  player.Say("Now that is a big stasis tube");
  Display("Yup, there is the creature inside");
  
  if (player.NormalView < 4) s = "The creatures looks like it is sounds asleep";
  else 
         { 
            player.Say("Strange looking creature");
            Display ("Looks nearly human");
            player.Say ("Wonder if the named it yet?");
          }

  if (player.NormalView == 3 || player.NormalView == 6) player.Say("Though something about that creature seems rather familiar");

}


Guess i was looking for something too complicated, and the other code

Code: ags

function oRock1_Look()
{
   Display ("That big damn boulder is blocking the path")
  
  if (player.NormalView == 1 || player.NormalView == 4) player.Say("wonder if i could push it out the way?");
  if (player.NormalView == 2 || player.NormalView == 5) player.Sayd("wonder if I could climb over it?");
  if (player.NormalView == 3 || player.NormalView == 6) player.Say("I think I could probably smash that rock into pieces.");
}


The only problem was that I had the wrong values in for NormalView
guess that was the rocky path KhrisMUC mentioned

Khris

Just out of curiosity, why are using Display and player.Say?
Looking at the strings called with Display, they don't seem to fit the white text boxes used for narration (Display's default behavior), but rather utterances of the player.
So if you've set "display all text as speech" in gen settings, why don't you stick to one of the commands?

ShadowRifter666

I am using both Display and player.Say since i started to use the Display text as a random voice that occurs now and again during play, kinda like a disembodied voice.

ShadowRifter666

easy question and maybe the last to finish the game, how to set an object so that the character walks infront of it all the time instead of moving behind it after the baseline.

to elaborate, I have a boulder blocking a path then the character interacts with it and walks over it (climbs) to the over side, at that point i have made the boulder not solid and i just need to make it appear behind the character, i don't know if the merge with background would work or if it remove object completely

Khris


ShadowRifter666

that simple, ok thanks.

one final thing to finish the game, credits, i have looked at othe people asking about it and i understand that I may need to make a new room for it then Display the text I want.

What i need to try and do is have a slow fade from the last playable room after the character has finished talking and then a slow fade into the last room with the text there. I guess that character.visible = false

I'm just not quite sure how to set it up right

so i need to find: a wait function, how to slow the fade in/out of a room, Display text onscreen (Display/New Character?), End the game

Khris

You can fade in/out using the FadeIn/Out command.
So use:
Code: ags
  SetNextScreenTransition(eTransitionInstant);  // disable auto-fading
  FadeOut(3);   // try a few low values
  player.ChangeRoom(x);


In the next room's after fadein, use FadeIn(3);


Trent R

PS-I believe there's a few modules for credits, including a Stars Wars styled one.


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

ShadowRifter666

Thanks khrisMUC for that code just trying it out now

Trent R, i don't know how to use the modules, though i prefer to program the code myself so i can see what is happening first hand as i go

SMF spam blocked by CleanTalk