AGS: Can I Make an RPG with AGS?

Started by TerranRich, Mon 03/05/2004 05:56:47

Previous topic - Next topic

Mr Jake

There are non because no one has wrote one...

Ishmael

It seems that everybody want's to make an rpg, but no-one actually has done yet, or if someone has, they are not that experienced or motivated to write a tutorial about it. I've been coincidering making a comical, short, first person rpg, but I'd have to be really bored to write a tutorial baut it, because I'm not a tutorial writing type person.
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.

Kinoko

An RPG is a difficult thing to write a tutorial because there's no one centralized kind of RPG. I'd be happy to write a tutorial on the style of RPG I'm doing -after- I make my game. There's no way I'm writing one on all the different ways it could be done though.

ags_newbie

Suppose you wanted a realistic game. If your charachter were to die, how should you do it? One solution is just not to do it at all, just put them in a hospital or something. Another might be to restart the game, or restart the game with anothe charachter.
Don't confuse me with AGS Newbie!

Proud user of AGS 2.61... still!

Kinoko

You don't want to use the standard "Game over" after death? The hospital idea reminds me of 'It Came From The Desert' (great game!) and that worked quite well, allowing you to continue on in the game, albiet putting you in an annoying position, after you've screwed up or failed at something. Restarting the game with another character reminds me of Maniac Mansion or (and this is a far cry...) the Ninja Turtles game. In that, if you "died", you were actually captured by the enemy and the player got the pick a different character to play with. At one or two points fduring the game, you got the opportunity to 'rescue' your lost players which I always thought was a nice touch.

Still, I'm rambling. I'm not entirely sure what you mean, could you explain in more detail? In a typical RPG, if your character dies, it's just game over and you load one of your saved games.

Gord10

Quote from: Kinoko on Wed 01/09/2004 17:46:46
An RPG is a difficult thing to write a tutorial because there's no one centralized kind of RPG. I'd be happy to write a tutorial on the style of RPG I'm doing -after- I make my game. There's no way I'm writing one on all the different ways it could be done though.
A tutorial about making RPG's with AGS would be useful for the beginners. I'm thinkikng of developing a demo game with source code called "Quest for Blue Cup" which teaches the scripts for RPG's.
Games are art!
My horror game, Self

Abisso

Is there someone so kind and patient, to write me (or at least explain me) how to do something like: when you reach a certain amount of points (experience points, in the matter), it displays "level 2" then "level 3" etc.
Not only this, but a lot of other things, like the possibility to use some objects you couldn't, and other stuff.
The question is: how to make something change permanently, when you reach a certain amount of points (to change again when you reach an higher amount of those).

Thanks, to all who will answer (helpfully ;D)

Gord10

You need to set a GlobalInt for exp points. For example SetGlobalInt(10,0);  Then add this script to the repeatly_execute:

if (GetGlobalInt(10)>=60) {  //When you have 60 exp. points
   Display("You gained level and now you are Level 5.");
   AddInventory(11);  //A new weapon
   SetLabelText(0,7,"Level 1"); //Setting the text on the GUI.
    }

And let me tell you how to show the text on the GUI: First add a "GUI Label" on the GUI where you want to show the text. SetLabelText(0,7,"Level 1"); is the script for setting it. 0 is the number of GUI, and 7 is the number of the object.

Games are art!
My horror game, Self

poc301

Interesting reads..  I will be doing a RPG (began planning it out today), and I have pretty extensive experience in various programming languages, including C, so this isn't all that daunting.  However, I am unaware of any way to get back to the game after a fight...

For instance :

Meet a hostile creature and go to room 100 (the fight room)

room 100 has the fight script.  If the EGO loses, they go to screen 101 (the death script). 

But if they win, is there a command I can use to return them to the last place they just were in the game before they loaded room 100 for the fight?  I couldn't find anything on this in a search.

Thanks,

Bill Garrett

Moox

You could check what room the char is before they teleport and then go there using newroomex command

Ishmael

NewRoom(character[GetPlayerCharacter()].prevroom);

If you need to tweak the coordinates, check NewRoomEx...
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.

frederik

Generally RPG's require a lot more variables than adventure games. You will want to have different int-values for monster default hps, attack skills, mana levels, gold possession, current prices in the marketplace, character xp and stuff like 'current ventroliquism-skill success probability' to mention a few.

I'm making an adventure game that has traits of both strategy and rpg (you do space battles against pseudorandom spaceships and hex-tiled ground combat with troops when boarding), and needles to say I ran out of GlobalInts early on. So for those of you who plan to make a complicated RPG, remember that you can add new globals, and that arranging them in arrays make them fairly easy to work with.

Say you have a band of four adventurers in your RPG, and that each of them need at least 10 global ints to store their data, Ã, say :

max_hp
current_hp
max_mana
current_mana
current_xp
xp_to_next_level
melee_attack_skill
melee_damage_category
ranged_attack_skill
ranged_damage_category

In this case you could make an array of 40 ints (10 for each 4 players):

//------------------------syntax
int player_ints[MAX]; // typed at the very top of the global script

export player_ints; // typed at the very bottom of the global script

#define MAX 40 Ã, //no semicolon!
import int player_ints[MAX]; // both last typed in the script header
//------------------------

Now you can assign the values for each character to the ints in the array. Say you want to start out with default Ã, values, you can go:

player_ints[0] = 20; //player one starts out with 20 max hps
player_ints[1] = 20; //current hitpoints are also 20 by default
...
...
player_ints[39]=10; //player 4 ranged_damage_category

Ã, 0-9 now holds the same values, in the same order, for player 1 as
10-19 does for player 2,
11-29 for player 3, and
30-39 does for player 4.

The smart thing about arrays (as they pretty much have to substitute the idea of 'structs' or 'objects' used in other programming languages) is that you can access them Ã, easily, if you arrange them nicely (like above). This is handy, because somewhere in your game you're going to have a function called something like

function player_take_damage(int player, int damage)
//where player is player 1,2,3 or 4 and damage is expressed in hps
{
//this is the cryptic part
player_ints[(player * 10) - 9] -=damage;
}

The cryptic part, (but the smart one when you get it Ã, 8) ), is doing calculations inside the array-brackets. If the 'int player'-argument passed to this function was 1, you would get: Ã, 
Ã,  Ã,  player_ints[(1 * 10) - 9] -= damage;
The calculation is done inside the brackets and equals:
Ã,  Ã,  player_ints[1] -= damage;

As you will remember from above, player_ints[1] stores the current number of hps for player 1. If we had passed 2 as the 'int player'-argument to the function,we would have:
Ã,  Ã,  player_ints[(2 * 10) - 9] -= damage;
equals:
Ã,  Ã,  Ã, player_ints[11] -= damage;
11 being the array-index that stores player 2's current hps.

Thus the damage is subtracted from the right player's hps (as long as you pass the right argument t the function), without using hard-to-debrace if-statements or worse: separate functions for same calculations on different players.

In a RPG that uses many characters, monsters. treasures or random-rolls, you will want your functions to be able to do the same calculations for different entities, and structuring your arrays like this, which allows you to do calculations inside the array-index-brackets, can almost substitute features of more object-oriented programming languages. You can make different arrays to hold the values for monsters, randomly generated rooms, treasure-types, spells and so forth. You can even use the calculated indexes inside other calculated indexes' brackets eg.
int a = player_ints[ monster_ints[3+b] * 10 ];

Good luck making your RPGs, I'm sure it's possible this way, even without objects or structs (although they may soon become officially supported by ags), besides AGS comes with a bunch of graphics features that will give you a good headstart compared to coding your RPG A-Z in C, Java or C++.

Kinoko

#72
I thought I'd post this here in case anyone else was interested in a way to get that classic SNES RPG HP display. You know, the one where the damage appears atop the character's head and animates in some way? I've got it appearing above the damaged character's head and dropping down (with a little bounce) before disappearing. Of course, tweak this code to suit your own needs.

First of all, create a function like this:

Code: ags

function DamageChar (int hurtchar) {
  sit=0;
  int it=0; //running index, to check if there's a free slot for text
  while (it<10){
     if (damchar[it]==0){ //if a slot is available
        damchar[it]=hurtchar; //set it to "occupied"
        damoverid[it] = DisplaySpeechBackground (hurtchar, dmgreport); 
     if (sit == 0) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-30);
        it=20; //break out of loop
      } else it++;
    }  //end while
  }


Then, in repeatedly_execute (/_always):

--Put here whatever code you use for calculating the injury to a character at the time it is attacked--

Code: ags

	  StrFormat (dmgreport, "%d", mondmg);
 	  DamageChar (XXX);


** Replace XXX with the character's name, and "mondmg" is the integer my calculated damage went into. If you'd like a word, for example "YOU MISSED", just use " StrFormat (dmgreport, "YOU MISSED"); "

Then elsewhere in repeatedly_execute (/_always):

Code: ags

int it=0; //checks all slots for whether the speechs had expired
while (it<10){
  if (damchar[it]){ //if there was a message for this character
    if (IsOverlayValid(damoverid[it])) { //Is it still displayed?
         sit++;
         if (sit == 3) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-27); 
         else if (sit == 6) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-25); 
         else if (sit == 9) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-22); 
         else if (sit == 12) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-18); 
         else if (sit == 15) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-14);  
         else if (sit == 18) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-9);
         else if (sit == 21) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-4); 
         else if (sit == 24) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y); 
         else if (sit == 27) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-7); 
         else if (sit == 30) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-10); 
         else if (sit == 33) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-8); 
         else if (sit == 36) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y-5); 
         else if (sit == 39) MoveOverlay(damoverid[it],character[damchar[it]].x,character[damchar[it]].y);       
    } else damchar[it]=0; //Expired, mark it as "free"
  }
  it++;
}


As I said before, that's just my own action of the text falling. You can do anything you want here. In fact, the more creative, the better! I'd love to come up with a way to make the text perform a movement, then actually fade out, or "fold in on itself" as happens in some RPGs. There are all sorts of things you can do.

Big thanks to Gilbot, Strazer and others for helping a LOT with this.

Gord10

Games are art!
My horror game, Self

fred

Good job, CoolBlue - I've read your tutorial, and Im sure it's gonna be helpful to people making rpgs with ags.

A little c&c: perhaps you could include more illustrations, maybe a shot from the finished game as the player would see it - because rpgs can be so many different things. 

Also, you write that player health is set to 7, when it's actually set to 5 with GiveScore(5); if I'm not mistaken.

That's about it - good job. I like to see people sharing their experience.

Btw. Isn't somebody on the forums making a collection of ags tutorials? Did you contact him/her?

Gord10

Thanks Fred :) Yeah, you're right. Player's HP should have been 5. I'll fix it.
Haven't contacted such a person yet.
Games are art!
My horror game, Self

Wabbit

Quote from: Def on Mon 12/07/2004 18:43:59
http://home.quicknet.nl/qn/prive/jjj.dekker/rpg.rar Something me and Chrille made a long time ago. It's an rpg (just a start though) and it's a bit like those old console RPGs. You can walk around, and encounter random monsters and fight them. It just shows it is possible to make it in ags :)
Played your game. It was addicting. Will you release the source code? Thanks for the cool RPG game.

darkshadow

Could you make one work on clock ticks?

Kinoko

I think you're going to need to flesh out your question a little more.

Freydall

How do you make an second inventory for other things e.g. One inventory for your items and one 'inventory' for different attacks in fighting like thrust, slash, chop etc. that would only be available when fighting.
AEscplega is the best epic ever. Chapter I is finally finished and Chapter II is on it's way.

SMF spam blocked by CleanTalk