Questing

Started by PrimitiveUser, Mon 15/12/2008 20:35:16

Previous topic - Next topic

PrimitiveUser

My rpg has quests for example.., Mary has lost her Ruby! She has asked you to find it!

Mary says: Can you find my Ruby, I'll reward you with 500 Tickets.

You try to look for it but fail..,

You talk to Mary once more.

But heres the problem I can't find out how to change the counter thingy.., when you talk to her again her speech changes.

Mary says: Have you found my Ruby yet?

You say: No I haven't so shutup MARY!

You find the Ruby and use it on mary (I know how to do that.)

She gives you 500 Tickets.., Then...

Mary says: Thanks for finding my Ruby you kind adventurer (She says that all the time now.)

It's probably RTFM you .... but hey, I can't find it and i'm pissed, can you tell me the code, use my Mary example in the code.


Dualnames

on let's consider the variable you need.

bool rubyfound=false,talkedtomary=false;

cMary_Talk {//can't recall how this is called. It's the cMary's talk interaction section
if (talkedtomary==false) {
cNarrator("Mary has lost her Ruby! She has asked you to find it!");
cMary.Say("Can you find my Ruby, I'll reward you with 500 Tickets.");
talkedtomary=true;
return;
}
if (rubyfound==false) {
cMary.Say("Have you found my Ruby yet?");
player.Say("No I haven't so shutup MARY);
return;
}
if (rubyfound==true) {
cMary.Say("Thanks for finding my Ruby you kind adventurer ");
return;
}


cMary_Useinv {//replace this as well..
if (player.ActiveInventory==iruby) {
player.LoseInventory(iruby);
player.AddInventory(i500tickets);
//or if tickets are money unit
//tickets+=500;
rubyfound=true;
return;
}
}

}
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

PrimitiveUser

First of all KhrisMUC, I told you to give me the *Code*.

Dualnames, Thanks for giving me the *Code* that *I* asked for.
It works perfectly, also thanks for adding at the bottom player.loseinv ruby.

DoUn2u

Sometimes it can be best not to just be given the answer, primitiveuser, you learn A LOT more by finding it out/working it out by yourself sometimes. It means you actually learn to understand what you are doing, rather than copying and pasting. Not that you can't learn from other's codes  ;)
The road to hell is paved with adjectives.

suicidal pencil

#5
DoUn2u is absolutely correct. (nice name, (Matthew 7:12))

You learn much more by solving problems yourself, rather than having someone else do it for you.

But, in response to your question, you simply need to use two Boolean variables, as Dualnames put it in the code.

A good example of it would be the code I used to put a character into a 'stealth' mode

Code: ags

if (keycode==83){
    if (STEALTH_S == false){
      STEALTH_S = true;
      if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        }
  }
    else if (STEALTH_S == true){
      STEALTH_S = false;
            if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        }
}
}


Notice the way I used the variable STEALTH_S (which stands for Stealth_switch). When it is equal to true, it immediately sets itself to false, and takes the player out of stealth mode. Same thing when it's false. It sets itself to true, and puts the player into stealth mode.

You can use the same idea and method to control almost everything in the game. Just use your imagination.

Note: just in case your confused, the mouseXloc and mouseYloc are variables that were declared that immediately saves the (x,y) coordinates of every click the player makes.

Khris

Just for reference, that code can be shortened considerably:
Code: ags
  if (keycode==83) {

    bool pm = player.Moving;
    if (pm) player.StopMoving();

    SPencil.ChangeView(3-SPencil.NormalView); 
    SPencil.SetWalkSpeed(9-player.WalkSpeedX, 9-player.WalkSpeedY);
    STEALTH_S = !STEALTH_S;

    if (pm) player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
  }

Dualnames

You can post your code and have Khris render it shorter for free!! I still can't figure out how you do that.. ;D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

PrimitiveUser

CAN YOU SHUTUP DUALNAMES ALREADY ANSWERED MY QUESTION, I SWEAR TO GOD YOU ARE PISSING ME OFF TO THE LIMIT!
I DON'T EVEN UNDERSTAND WHAT YOU JUST GAVE ME KHRISMUC AND SUICIDAL PENCIL, PLEASE!

I thank you for re-entering the code, and telling me the short form and whatknot. BUT I DONT SEE HOW THAT RELATES TO WHAT DUALNAMES TOLD ME WHAT HELL ARE YOU TRYING TO PULL?

Trent R

I just posted in your other thread (one of 87) that you're being retarded.

So why are you yelling at Dualnames? He already helped you out, and he was making an innocent reply---because that's what forums are all about. As for suicidal, he was just trying to help you out. If you read his post, he was agreeing that learning to write your own code it usually the best. He was kind enough to post his own code that he worked on, so that you could look at it and see how it works.

~Trent
PS-And please don't get pissed off back at me. I've posted in your other threads and have been as helpful as I could be. But remember that the only thing related between your fights with Dualnames, with Ghost, with Khris, with CJ, and most likely with me, is you.
PPS-
Quotefirst of all I'm 17 years old n second of all i type fast so i dont use proper grammer
I've been typing with better grammar than you since I was 12. And I'm fast too.
I also text with correct grammar. Fast.
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

Khris

#10
Trent, he didn't yell at dualnames; although I'm not surprised by that misunderstanding due to the complete lack of punctuation.

Primordialabuser, please understand that these forums don't exist for the sole purpose of posting code that solves your puny problems; they're also meant as reference for people who use a thing called 'forum search'.

You're behaving like a thoroughly spoiled brat, and people WILL stop helping you out if you continue to annoy them.

Dualnames

Just to set things straighter, because what scares me most in primitiveuser is that I see myself on him...so well, never respond if you are angry. Ever. Also please don;t think for any reason that we're arrogant. But well, you should try acting with manners. Not insult anyone and stuff like that.

As to sum up:
1)If you need a code about dialogs make a search first. It's always boring and tough searching through these forums, but you'll be surprised that we could built a Hitchhiker's Guide if we gathered all these questions.

2)Try searching at the manual. I'm still coding with it by my side. A trustworthy companion. Always know where your manual is.

3)Some forum members have wittyness but we're all bright lads. Khris might be sarcastic but at least he's telling the truth.

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Trent R

You're right Khris, sorry man.

~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

R4L

#13
Why is it that you think you can come here and get code handed to you for nothing and then you can bitch about it?

I guarantee you won't get anymore help.

EDIT: Nevermind, I see you apologized in your other thread.

PrimitiveUser

Don't give me that BULLSHIT dawg, listen, sorry everyone, I might be annoying, I might be a dumb@$#@, But the one thing I have is my Del Monte Quality Fruit Punch and my Butter Cookies(made with real butter), and maybe some beer on the side.

Reply to me back if we are all truce, and I'll promise not to Post retarded questions.

PrimitiveUser

I hate you all.., exept for the admins and mods. :=

R4L

Quote from: PrimitiveUser on Wed 17/12/2008 17:21:00
Don't give me that BULLSHIT dawg, listen, sorry everyone, I might be annoying, I might be a dumb@$#@, But the one thing I have is my Del Monte Quality Fruit Punch and my Butter Cookies(made with real butter), and maybe some beer on the side.

Reply to me back if we are all truce, and I'll promise not to Post retarded questions.

Hmm, let's see. You broke that promise, and not only that, you're breaking forum rules by double posting, and this isn't the first time.

Not to mention you're being a total asshole to everyone who's taken their own time to help you, and SUGGEST ways that you can do this yourself. You don't ask for someone to code things for you, you ask for help. If you have no idea how you're making this game, then why are you making it?

About my "bullshit" I'm giving you... it's true. Do you expect people to help you after you insult everyone that tries to help you? I tried that a long time ago, and I can tell you that it doesn't work. Would yelling at your boss get you a raise? Or a job for that matter? Of course it wouldn't, and it's not going to help you here.

Quote from: PrimitiveUser on Wed 17/12/2008 20:04:07
I hate you all.., exept for the admins and mods. :=

Nice first impression you're making here. Don't make the same mistake I made. You'll regret it. Or maybe you won't, because you probably won't stay here long.

SMF spam blocked by CleanTalk