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 - Khris

#561
First of all, it isn't necessary to use all that duplicate code, all you need to do is pass a negative value as the amount of damage.
Then you'll need an additional line after those two:
Code: ags
  ron_hp -= damage;
  if (ron_hp < 0) ron_hp = 0;

  if (ron_hp > 30) ron_hp = 30;   // add this


This should solve your other problem, too.
I'm not sure how it is caused exactly, though.
#562
No problem :)

Here's some adjusted code:
Code: ags
function ron_gets_hit(int damage) {
  ron_hp -= damage;
  if (ron_hp < 0) ron_hp = 0;
  ron_gauge = DynamicSprite.CreateFromExistingSprite(btnHealth.NormalGraphic);
  DrawingSurface*ds = ron_gauge.GetDrawingSurface();
  ds.DrawingColor = 16; // black
  ds.DrawRectangle(0, 0, 99, 15);  // clear gauge
  ds.DrawingColor = Game.GetColorFromRGB(0,255,0); // green
  if (ron_hp > 0) ds.DrawRectangle(0, 0, ron_hp, 15); // draw health        only draw health if > 0
  ds.Release(); // end drawing
  btnHealth.NormalGraphic = ron_gauge.Graphic;

  // kill ron
  if (ron_hp == 0) player.ChangeRoom(666);    // or play death animation, or ...
}
#563
Ok, alternatively you could make the button 60 pixels wide, then draw to ron_hp*2.

Regarding the second problem, I was already afraid that's gonna happen.
The problem is that the DynamicSprite is null, or nothing, an empty slot, if you will, so one can't call its .GetDrawingSurface() method.

Do this: draw a properly sized sprite, a green rectangle of 30x15. Import it, then assign it as the button's normal image.
Now directly above the error throwing line, add:
Code: ags
  ron_gauge = DynamicSprite.CreateFromExistingSprite(btnHealth.NormalGraphic);
#564
In the function, there this line:
Code: ags
else Display("10 HP damage given to Ron!");


Replace that with:
Code: ags
  else {
    Display("10 HP damage given to Ron!");
    ron_gets_hit(10);
  }

Now put this above the function:
Code: ags
function ron_gets_hit(int damage) {
  ...
}


Put in there what you want to happen.

Btw, as explained in my previous post, you can use a single button to display a health gauge. Four GUIs is overkill.
Familiarize yourself with the DynamicSprite and DrawingSurface functions.

You'd do something like:
Code: ags
int ron_hp = 100;
DynamicSprite*ron_gauge;

function ron_gets_hit(int damage) {
  ron_hp -= damage;
  if (ron_hp < 0) ron_hp = 0;
  ron_gauge = DynamicSprite.CreateFromExistingSprite(btnHealth.NormalGraphic);
  DrawingSurface*ds = ron_gauge.GetDrawingSurface();
  ds.DrawingColor = 16; // black
  ds.DrawRectangle(0, 0, 99, 15);  // clear gauge
  ds.DrawingColor = Game.GetColorFromRGB(0,255,0); // green
  ds.DrawRectangle(0, 0, ron_hp, 15); // draw health
  ds.Release(); // end drawing
  btnHealth.NormalGraphic = ron_gauge.Graphic;
}

EDIT: fixed code


Now create a button 100 pixels wide and 15 high called "btnHealth" on a GUI.
#566
I've uploaded 2.72:
http://www.savefile.com/files/1673905

The template won't work with 3.02, so yes, open it with 2.72, save the game, then copy/move the game folder to your 3.02 installation.
#567
You can't use different colors afaik.
However, you can use buttons and draw their images on the fly.
I'm too lazy right now to provide some code, basically you use a global DynamicSprite, draw the gauge image on its DrawingSurface, then set the DynSprite as the button's image.
#568
1. Use RPGMaker then ;)
#569
1. No. In my tile engine I use keyboard movement; as soon as the walking direction changes, the boundary of the actual (non-AGS) walkable area is calculated, then the char is moved using WalkStraight(end_x, end_y);
If your character's supposed to be sent around the usual point'n'click way, you have to calculate her path using one of the tons of A* tuts floating around in the net.

2. Why use a new AGS-room for every new game-room? You won't be using room-specific hotspots etc. anyway, right? Create a huge room by importing a, say, 1280 x 800 black pic (uniform black shouldn't waste too much space), then use it all the time.
#570
About the Mockup Blitz:

It's nice to see that it's relatively popular and there have been some really great entries already considering the short time it's running here.
I'm a bit disappointed though about the fact the there are many entries which don't exactly qualify as mockups. They look more like concept art, not actual in-game screenshots.
While the setting and theme are important, a mockup is all about showing an actual background and actual in-game sprites, together with a working GUI (and cursor), not just a general idea how a game is supposed to look.

It's primarily a graphical activity, not a conceptual one.

The same is more or less true about the Sprite Jam and Animation Competition.
People try to be funny, posting flash generated content or even animations using downscaled photos they got from google image search.
Both activities are meant to get people to draw stuff that can be used in a game immediately.

Am I the only one who sees it this way?
#571
You've got to use the name of the label, not the GUI itself. In the GUI editor, click on the label, you should now see the four corners marked with yellow dots. Now check the small properties window for the scriptname.

Btw, this is getting more or less off topic, so if you've got any other general technical questions (as opposed to AGS-RPG-questions), I guess it's better to open a new thread.
#572
You need global variables storing hp and xp. Then add a line in repeatedly_execute in the global script:
Code: ags
  status.Text=String.Format("Score: @SCORE@     HP: %d      XP: %d", hp, xp);

In the GUI editor, look up the name of the text label, then use that name instead of "status".

The tutorial is probably for AGS 2.62 and older. String.Format is new code.
If you're using a pre-2.8/3.0 version, uncheck "Enforce object-oriented scripting" in General settings.

You can't make two hotspots in one area, no. How's that supposed to work?
If you want to change the reaction to e.g. interacting the hotspot after the player has done something, use variables.

#573
Again, where did you put the code? More info needed.
#574
You're right, I thought tile-scrolling meant that the screen doesn't actually scroll but the tiles are replaced column by column.

Btw, real-time strategy can be done using AGS, there was a Cannon Fodder clone in Production (by foz) once, but sadly he didn't finish it.
#575
The Gameboy-Zelda might use tile-scrolling, the SNES game doesn't. The moving things just freeze and the screen scrolls smoothly to the adjacent one.
#576
By default, there's no SetMode function in AGS, nor does AGS know what GIVE means.
Exporting and importing a short bit of code from the template won't work at all, I'm afraid. You'd have to sort out exactly which portions are needed and copy over all of them.

Why don't you just use the complete template and alter it to fit your needs?
#577
Well, add characters if you wanna run dialogs with inanimate objects. Just assign the Object's sprite to all four loops.

You can set the width and height of an inventoy item by changing x.ItemWidth and x.ItemHeight. Look it up in the manual. (Scripting -> GuiInvWindow)

Open/Close/Push/Pull are handled seperately, please refer to the included readme for details.
#578
There an issue with NPC interactions not working properly due to a missing "return".

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=27613.msg350994#msg350994
#579
Damn, ice_sta, _that_ was helpful. ::)

DinghyDog: goto www.gamefaqs.com and look at the In-Depth FAQs of famous RPGs. Here's an example from ChronoTrigger.
EDIT: direct link doesn't work, so copy & paste it into a new browser window.

And you should familiarise yourself with structs, here's a short example from a half-finished fight engine I did:

Code: ags
struct fighterStruct {
Ã,  // Stats
Ã,  int hpm;Ã,  Ã,  Ã,  // health max (1-999)
Ã,  int hp;Ã,  Ã,  Ã,  Ã, // current health (0-hpm)
Ã,  int mpm;Ã,  Ã,  Ã,  // magic max (1-999)
Ã,  int mp;Ã,  Ã,  Ã,  Ã, // current magic (0-mpm)
Ã,  String name;Ã,  // name
Ã,  int lv;Ã,  Ã,  Ã,  Ã, // level (1-99)
Ã,  int atk;Ã,  Ã,  Ã,  // attack (1-99) inflict damage
Ã,  int def;Ã,  Ã,  Ã,  // defense (1-99) get damage
Ã,  int agi;Ã,  Ã,  Ã,  // agility (1-99) likelyness of hit
};


Put something like that into the global script header, or even better, into the header of a module.

In the module script, you'd use
Code: ags
fighterStruct party[4];
export party;
and thus you'll get three (4, I know) party members whose stats can be accessed by using e.g.
Code: ags
party[1].name="Cloud";
// or
party[1].agi=40;
#580
Just found this thread again, here's my two cents of incredible efficent scripting ;)

Code: ags
if (Maths.Sqrt((player.x-cEnemy.X)^2+(player.y-cEnemy.Y)^2)<=20) {
Ã,  ...
}


This only replaces the distance-if, of course.

EDIT:
Damn, ^ can't be used like that, true. I've confused it with another language.
This simply calculates the absolute distance in pixels, so the area is circular, correct.
SMF spam blocked by CleanTalk