Making an RPG with AGS: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 23: Line 23:


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.''




Line 40: Line 40:


''string mana;''
''string mana;''
''string expweapon;''
''string expweapon;''
''string expmagic;''
''string expmagic;''
''string enemyhp;  //this is the HP of your enemy. ignore it for now.''
''string enemyhp;  //this is the HP of your enemy. ignore it for now.''
''StrFormat (mana, "%d", GetGlobalInt (2));''
''StrFormat (mana, "%d", GetGlobalInt (2));''
''StrFormat (expweapon, "%d", GetGlobalInt (3));''
''StrFormat (expweapon, "%d", GetGlobalInt (3));''
''StrFormat (expmagic, "%d", GetGlobalInt (4));''
''StrFormat (expmagic, "%d", GetGlobalInt (4));''
''StrFormat (dusmanhp, "%d", GetGlobalInt (5));''
''StrFormat (dusmanhp, "%d", GetGlobalInt (5));''
''SetLabelText (0, 1, mana); //so the mana points will be shown in the GUI 0, Label 1)''
''SetLabelText (0, 1, mana); //so the mana points will be shown in the GUI 0, Label 1)''
''SetLabelText (0, 2, exp);''
''SetLabelText (0, 2, exp);''
''SetLabelText (0, 9, expbuyu);''
''SetLabelText (0, 9, expbuyu);''
''SetLabelText (4, 1, dusmanhp); //this code isn't too necessary for now. it is about another GUI, number 4.''
''SetLabelText (4, 1, dusmanhp); //this code isn't too necessary for now. it is about another GUI, number 4.''


Line 84: Line 95:
''if (GetGlobalInt(5) <= 0) {
''if (GetGlobalInt(5) <= 0) {


GUIOff(4);
''GUIOff(4);''
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.


}
''PlaySound(9);''
else {
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.
''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 {''
 
''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.''
''}''




Line 103: Line 120:
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);


}''
''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.
0

edits