Anonymous user
Making an RPG with AGS: Difference between revisions
no edit summary
*>Monkey 05 06 No edit summary |
|||
(11 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{deprecated}} | |||
{{non-OOP}} | |||
It is possible to make RPG's with AGS; but you will need some coding experience. | It is possible to make RPG's with AGS; but you will need some coding experience. | ||
Line 5: | Line 9: | ||
Firstly, I should say that there are many ways to script RPG's with AGS. I will tell the way I use while I was developing Asporia: Hidden Threat in this tutorial (all the screenshots are from the source code of the game.) | Firstly, I should say that there are many ways to script RPG's with AGS. I will tell the way I use while I was developing Asporia: Hidden Threat in this tutorial (all the screenshots are from the source code of the game.) | ||
== | ==The Variables Like Health, Mana and Exp.== | ||
We need these variables to develop our RPG game. Add this script to game_start section. | We need these variables to develop our RPG game. Add this script to game_start section. | ||
GiveScore(7); //Health. You can also use GlobalInt for this. | |||
SetGlobalInt(2,8); //Mana | |||
SetGlobalInt(3,0); //Exp-weapons. | |||
SetGlobalInt(4,0); //Exp-mage. | |||
This is what I used for Asporia. You can use only one variable for exp. if you want. | |||
also if you want, | also if you want, | ||
Line 21: | Line 25: | ||
So our health is 7 and mana is 8 units. We haven't got experience points yet. To decrease the mana points, use this script: | So our health is 7 and mana is 8 units. We haven't got experience points yet. To decrease the mana points, use this script: | ||
'' | |||
SetGlobalInt (2, GetGlobalInt(2)-1); //We lost 1 mana point.'' | ''SetGlobalInt (2, GetGlobalInt(2)-1); //We lost 1 mana point.'' | ||
==The GUI Which Shows The Health, Mana and EXP. Status== | |||
Let's prepare our GUI where we can learn how many health, mana and exp. we have. | Let's prepare our GUI where we can learn how many health, mana and exp. we have. | ||
Line 37: | Line 41: | ||
After preparing the labels with texts and the other labels with blanks, write this code to repeatedly_execute section: | After preparing the labels with texts and the other labels with blanks, write this code to repeatedly_execute section: | ||
''string mana; | ''string mana;'' | ||
string expweapon; | |||
string expmagic; | ''string expweapon;'' | ||
string enemyhp; //this is the HP of your enemy. ignore it for now. | |||
StrFormat (mana, "%d", GetGlobalInt (2)); | ''string expmagic;'' | ||
StrFormat (expweapon, "%d", GetGlobalInt (3)); | |||
StrFormat (expmagic, "%d", GetGlobalInt (4)); | ''string enemyhp; //this is the HP of your enemy. ignore it for now.'' | ||
StrFormat (dusmanhp, "%d", GetGlobalInt (5)); | |||
SetLabelText (0, 1, mana); //so the mana points will be shown in the GUI 0, Label 1) | ''StrFormat (mana, "%d", GetGlobalInt (2));'' | ||
SetLabelText (0, 2, exp); | |||
SetLabelText (0, 9, expbuyu); | ''StrFormat (expweapon, "%d", GetGlobalInt (3));'' | ||
SetLabelText (4, 1, dusmanhp); //this code isn't too necessary for now. it is about another GUI, number 4.'' | |||
''StrFormat (expmagic, "%d", GetGlobalInt (4));'' | |||
''StrFormat (dusmanhp, "%d", GetGlobalInt (5));'' | |||
''SetLabelText (0, 1, mana); //so the mana points will be shown in the GUI 0, Label 1)'' | |||
''SetLabelText (0, 2, exp);'' | |||
''SetLabelText (0, 9, expbuyu);'' | |||
''SetLabelText (4, 1, dusmanhp); //this code isn't too necessary for now. it is about another GUI, number 4.'' | |||
So the variables in the game should have been displayed in the GUI. | So the variables in the game should have been displayed in the GUI. | ||
Line 82: | Line 97: | ||
''if (GetGlobalInt(5) <= 0) { | ''if (GetGlobalInt(5) <= 0) { | ||
GUIOff(4); | ''GUIOff(4);'' | ||
PlaySound(9); | |||
''PlaySound(9);'' | |||
''NewRoom(30); //if the undead's HP is equal, or lesser than 0; then he dies and we go to another room in | |||
Asporia:Hidden Threat. You can use your own fight ending scripts.'' | |||
''}'' | |||
}'' | |||
''else {'' | |||
'''How to die in the game: | ''GiveScore(-3);'' | ||
''PlaySound(1);'' | |||
''Wait(20);'' | |||
''Display("Undead hit you"); //if you couldn't kill the enemy, it will attack you and you will lose 3 HP.'' | |||
''}'' | |||
==How to die in the game:== | |||
If an enemy can attack you, then you should be able to die in the game. Type this scripts in the repeatedly_execute section: | If an enemy can attack you, then you should be able to die in the game. Type this scripts in the repeatedly_execute section: | ||
''if (game.score < 1) { | ''if (game.score < 1) {'' | ||
StopMusic(); | ''StopMusic();'' | ||
}'' | ''Wait(40);'' | ||
''NewRoom(28);'' | |||
''}'' | |||
The room 28 is the "Game Over" screen. You should also use the scripts in Players Enters Screen (before fadein) | The room 28 is the "Game Over" screen. You should also use the scripts in Players Enters Screen (before fadein) | ||
''PlaySound(4); // the sound which says the game is over | ''PlaySound(4); // the sound which says the game is over'' | ||
GUIOff(0); | |||
GUIOff(4); | ''GUIOff(0);'' | ||
'' | |||
''GUIOff(4);'' | |||
And these codes in Players Enters Screen (after fadein): | And these codes in Players Enters Screen (after fadein): | ||
''Wait(240); | ''Wait(240);'' | ||
RestartGame(); | |||
'' | ''RestartGame();'' | ||
So the game will be restarted. | So the game will be restarted. | ||
==Level Up:== | |||
You can level up in the game after you have a definite exp. points. For example in the repeatedly_execute section: | You can level up in the game after you have a definite exp. points. For example in the repeatedly_execute section: | ||
''if (GetGlobalInt(4)>=60) { | ''if (GetGlobalInt(4)>=60) {'' | ||
Display("You leveled up and gained the magics of Cure +2, Fireball +2 and 6 mana points ."); | |||
''Display("You leveled up and gained the magics of Cure +2, Fireball +2 and 6 mana points .");'' | |||
''AddInventory(10);'' | |||
''AddInventory(11);'' | |||
AddInventory(11); | |||
SetGlobalInt(2,GetGlobalInt(2)+6); | ''LoseInventory(4); //losing the old Cure +1 magic'' | ||
}'' | |||
''SetGlobalInt(2,GetGlobalInt(2)+6);'' | |||
''}'' | |||
The player will gain some new magics. Sure, you can use your own scripts for level up. | The player will gain some new magics. Sure, you can use your own scripts for level up. | ||
==Different Endings:== | |||
You may also want to add different endings which is according on the player's decision in the game. For this, add this code to game_start: | You may also want to add different endings which is according on the player's decision in the game. For this, add this code to game_start: | ||
'' | '' | ||
Line 154: | Line 182: | ||
''Wait(120);'' | ''Wait(120);'' | ||
''if (GetGlobalInt(12)>=3) {'' | ''if (GetGlobalInt(12)>=3) {'' | ||
''Wait(40);'' | ''Wait(40);'' | ||
''NewRoom(62);'' | ''NewRoom(62);'' | ||
''}'' | ''}'' | ||
''if (GetGlobalInt(12)<3) {'' | ''if (GetGlobalInt(12)<3) {'' | ||
''Wait(40);'' | ''Wait(40);'' | ||
''NewRoom(57);'' | ''NewRoom(57);'' | ||
''}'' | ''}'' | ||
The room 62 leads you to the good ending in the game. And the room 57 is to another ending which isn't good... | The room 62 leads you to the good ending in the game. And the room 57 is to another ending which isn't good... | ||
==And....cheats :)== | |||
If you think your game may be found too hard by some players, then you can add some cheats. To on_key_press; | If you think your game may be found too hard by some players, then you can add some cheats. To on_key_press; | ||
Line 178: | Line 214: | ||
ahmetkeles_16@hotmail.com (MSN Messenger) | ahmetkeles_16@hotmail.com (MSN Messenger) | ||
[[Category:Intermediate Tutorials]]</pre> |