Making an RPG with AGS: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 5: Line 5:
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.'''  
'''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.
''GiveScore(7); //Health. You can also use GlobalInt for this.''
SetGlobalInt(2,8); //Mana
 
SetGlobalInt(3,0); //Exp-weapons.
''SetGlobalInt(2,8); //Mana''
SetGlobalInt(4,0); //Exp-mage. This is what I used for Asporia. You can use only one variable for exp. if you want.''
 
''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 37: Line 39:
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 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.''


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

edits

Navigation menu