Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Akumayo

#21
A nice little function that works as a replacement for Yes/No GUI's and such, and works much faster/easier.

In global script top:
Code: ags

function YesOrNo() {
  Display("Yes (y) or No (n)");
  if (IsKeyPressed(89) == 1 || IsKeyPressed(78) == 1) {
    if (IsKeyPressed(89) == 1) {
      return 1;
    }
    if (IsKeyPressed(78) == 1) {
      return 0;
    }
  }
  else {
    Display("You have to pick one!");
    YesOrNo();
  }
}


In global script header:
Code: ags

import function YesOrNo();


Example of use:
Code: ags

Display("Do you really want to steal that hat?");
int stealit = YesOrNo();
if (stealit == 1) {
  Display("You steal the hat.");
  player.AddInventory(ihat);
  karma --;
}
else {
  Display("You decide not to steal the hat, because your a good person.");
  karma ++;
}

Will ask the player if they want to steal the hat, make them click 'y' or 'n' to answer, and take action depending on that answer.

See?  It's a simple solution for idiot-proofing or double-checking.
#22
It was no problem.
#23
Thanks, I hadn't realized, still living in old v6  :P
#24
No, that code wasn't up to date, sorry...Ã,  Here's the best way to do it in 2.7:

Beginning of Global Script:
Code: ags

int health;
int maxhealth;
int magic;
export health, maxhealth, magic;


In script header:
Code: ags

import int health;
import int maxhealth;
import int magic;


Now create a label over your status GUI called Lstats.

In reapeatedly_execute:
Code: ags

string guihealth;
string guimaxhealth;
string guimagic;
string buffer;
StrFormat (guihealth, "Health: %dÃ,  /", health);
StrFormat (guimagic, " Magic: %d", magic);
StrFormat (guimaxhealth, " Max Health: %d /", maxhealth);
StrCopy (buffer, guihealth);
StrCat (buffer, guimaxhealth);
StrCat (buffer, guimagic);
Lstatus.SetText(YOU , 2, buffer);


I am almost positive that this script is up to date with 2.7, sorry for the earlier inconvinienceÃ,  :-[

This should again display something similar too:
Health: 20 / Max Health: 40 / Magic: 33

-Regards, Akumayo
#25
Hrm...Ã,  Experience is pretty easy, but depending on how you do the fighting system, the code changes.Ã,  Create Globaints for Current Exp and Target Exp.

Ex:

LetÃ,  MPC=MP Current Exp globalint
Ã,  Ã,  Ã,  Ã, MPT=MP Target Exp globalint
Ã,  Ã,  Ã,  Ã, MPL=Current MP Level globalint
Ã,  Ã,  Ã,  Ã, DAMAGE=The damage you just did to enemy globalint

GameStart:
Code: ags

SetGlobalInt((MPC), 0);


Repeatedly_Execute:
Code: ags

SetGlobalInt((MPT), (GetGlobalInt(MPL)*5);
if (GetGlobalInt(MPC)==GetGlobalInt(MPT)) {
 //code for leveling up
}


Then when you do damage:
Code: ags

SetGlobalInt(MPC, GetGlobalInt(MPC)+(GetGlobalInt(DAMAGE));


This is just an example, it would make a system where you had to collect 5 times your current level in experience, and got experience every time you did damage, Runescape uses a system similar to this.Ã,  I hope you get the idea, I know my coding was pretty sloppy this time.

-Regards, Akumayo
#26
I believe I have a pretty simple code for your turn based GUI's.Ã, 

-Make A GUI called...um...YOU
-Two buttons, button 0 is simply the image of your character's portrait.
-Button 1 is just going to sit there for the moment.
-Make a label and place it over button 1.
-Okay, here comes the code...

In repeatedly_execute:

Code: ags

string health;
string maxhealth;
string magic;
string buffer;
StrFormat (health, "Health: %dÃ,  /", GetGlobalInt (?));Ã,  //replace "?" with your health globalint
StrFormat (magic, " Magic: %d", GetGlobalInt (?));Ã,  //replace "?" with your magic globalint
StrFormat (maxhealth, " Max Health: %d", GetGlobalInt(?));Ã,  //replace "?" with your maxhealth globalinlt
StrCopy (buffer, health);
StrCat (buffer, maxhealth);
StrCat (buffer, magic);
SetLabelText (YOU , 2, buffer);



Also, if you don't want to mess with globalints, I believe you can also use 32-bit strings like this (but I'm not used to these)

At game start:

Code: ags

int health;
int maxhealth;
int magic;


In repeatedly_execute:

Code: ags

string guihealth;
string guimaxhealth;
string guimagic;
string buffer;
StrFormat (guihealth, "Health: %dÃ,  /", health);
StrFormat (guimagic, " Magic: %d", magic);
StrFormat (guimaxhealth, " Max Health: %d", maxhealth);
StrCopy (buffer, guihealth);
StrCat (buffer, guimaxhealth);
StrCat (buffer, guimagic);
SetLabelText (YOU , 2, buffer);


Either way, GUI YOU should come out something like this:

PORTRAIT HEREÃ,  Ã,  Ã,  Health: 20 / Max Health: 40 Magic: 33

Hope that helpsÃ,  :)

-Regards, Akumayo
#27
I'd suggest either comparing a speed stat for for determining the first player or always letting player go first, then using either a GUI or run-scipt X in dialogue commands so the player can choose his/her attack, then randomely choosing an attack for the monster (depending on which monster is out), and if all this is located in the room's repeatedly excetue,you could go ahead and put your "dead check's" after each monster/player turn and since it repeats it would go on until someone died!!!

can't breathe.....all one sentence!
#28
nonsense, if you set the object's baseline to the top of the sceen, and it is set as object 0, then everything will appear atop it, or if that wouldn't work (dunno I haven't actually tried it) you could have the objects default graphic set to 0 so it was transparent, then change it to the scrolling graphic when character stepped on region (again this would probably make everything dissapear during transition).  I think with CJ's next update he should add a transition function...
#29
I think you could do a room transition with an object, no?  You could change the default transition to "instant".  Then you make an object that is 320x200 or whatever your resolution is, then animate it starting with room1 graphics and scrolling into a room2.  You put said object in room1, then when player walks onto region that moves to room2, you animate the object using blocking, so when the animation is finished, the player is transported to room2.

Since the transition is instant, the only thing noticable is that the player character stays stationary.  (I'm assuming you've already made said object's baseline so character could be seen  ;D )  You could fix this by...well...I dunno maybe the character shouldn't be visable during the transition, either way you get my point.
#30
You want a GUI based shop system huh?

Create a GUI with buttons "Buy" and "Sell"
If "Sell" is clicked open the inventory window.  The player chooses an item, then click on the shopkeeper with the item.  Money is added to the players bank/wallet and inventory item is lost.
If "Buy" is clicked open new GUI with buttons labeled "Item Whatever", "Other Item" and so on.  Player clicks on button and is prompted with a text box "Buy this item?" Player types "Yes" or "No".
If "No" is typed, return to "Buy" "Sell" GUI.
If "Yes" is typed, lose money from Bank/Wallet and gain inventory item.  Return to "Buy" "Sell" GUI.


It doesn't get much simpler unless you use text boxes.
#31
i have succesfully completed a battle system in AGS.  I used an object that changes sprite slots to show your enemy.  And it is a one man RPG, so that makes things easier ;D.  I ran the attack commands through a GUI.  When the GUI is on, you chose your attack, and then the GUI script handles the damage, sounds, and overlays.
#32
You say you are working on a Pokemon style game eh?
How exactly do you script the attacks? Or do you simply compare the monsters HP, Defense, Attack, etc. and decide the winner???  I ask only because I would like to make a similar game and cannot figure it all out!  Why is this so time consuming!!!
SMF spam blocked by CleanTalk