Armor and weapons for my RPG

Started by aventurero, Mon 04/01/2010 23:59:20

Previous topic - Next topic

Crimson Wizard

Quote from: aventurero on Thu 07/01/2010 01:22:01
Quote from: KhrisOk, I tested this. Everything worked absolutely fine, the only thing I forgot to mention is: since I'm using the buttons' TextColor to store the current defense of the item it has to be set to 0 (or the defense modifier of the item initially equipped).

How do I do that?

1. Select button on your GUI.
2. In the bottom-right you'll see properties table (property - value).
3. Find "TextColor" line and type in corresponding value (0).

aventurero

It's already set to 0, and still doesn't work...
Code: ags
function iToxicWaste_Talk()
{
Display ("You eat the toxic waste. Obviously, you die.");
QuitGame (0);}

Khris

Did you set the inv_type property correctly? 1 for weapons, 2 for armor, 3 for shields, 4 for helmets.
Also, instead of "doesn't work", please tell us what happens.

Crimson Wizard

#23
Khris, aventurero sent me game, and from what I see, he just did not do it correctly GUI-wise  ;). Unfortunately, project he uses is a mess at this point, inventory is on one Gui, "equipped" part is on separate gui; and he's got some extra "inventory" guis created for unknown purposes; I suggested he plan how inventory should look first and redo everything from scratch.


EDIT: Owww, just noticed that - he mess up with inventory types, as you guessed ;D
He uses 1 for armor and 2 for weapons.
After I fixed that it worked well.

Khris

Cool, glad you got it sorted out.

I was thinking about a way how to best realize a nice equipment screen, but it's hard to work on such a vague basis. For quite a while now I'm playing with the idea of creating a full-fledged RPG template, complete with map editor and fight mechanics.
The only problem is that ideally it should be highly customizable, without requiring too much in-depth work on the game designer's part.
Well, maybe next year ;)

Ryan Timothy B

#25
From reading this thread, sounds like aventurero is a little too ambitious with this project, expecting too much from his understanding of programming and AGS.
You should really work on smaller test games and such (that never get released, only to understand the complete workings of AGS) just to advance your knowledge.  That way none of your errors will make it into the actual game.  And everything you don't understand, read it in the index/manual--that thing is a bible, or search it up in the forums.  Khris and Crimson really shouldn't be relied upon to program your wishes.  This is here for assistance.
:P (that's just my opinion)

aventurero

Well Ryan, this is actually a test game... And is not so easy to program everything if you speak spanish and the manuals are written in english. Thanks everyone for the help :)
Code: ags
function iToxicWaste_Talk()
{
Display ("You eat the toxic waste. Obviously, you die.");
QuitGame (0);}

Crimson Wizard

There's a terribly weird thing that spoils this.

I just found that if you set TextColour to 0 for GUI buttons, on game start these TextColours became 16.
So, you have to make this function:

Code: ags

function init_equipped()
{
  int i = 1;
  Button*b;
  while (i < 4) {
    b = gEquipment.Controls[i].AsButton;
    b.TextColor = 0;
    i++;
  }
}


I never knew AGS can do this thing.  :-\

aventurero

Well, that solves everything. Crimson and I tried it, and it works perfectly.  8)
Code: ags
function iToxicWaste_Talk()
{
Display ("You eat the toxic waste. Obviously, you die.");
QuitGame (0);}

Khris

Ouch!
Guess that's what happens when going for a quick'n'dirty, untested solution ;)

suicidal pencil

#30
here, try this. I did a little testing, and it should work

Code: ags

InventoryItem* Armor;
InventoryItem* Weapon;

function RemoveArmor()
{
  if(Inventory_Armor.Graphic != g_70x70_ButtonTran)//this obscure variable is just pointing to the sprite I used for transparency
  {
    Inventory_Armor.NormalGraphic = g_70x70_ButtonTran;
    Inventory_Armor.Text = String.Format("Armor");
    player.AddInventory(Armor);
    DefenseModifier = 0;
    Armor = null;
    return 0;
  }
}

function RemoveWeapon()
{
  if(Inventory_Weapon.Graphic != g_70x70_ButtonTran)
  {
    Inventory_Weapon.NormalGraphic = g_70x70_ButtonTran;
    Inventory_Weapon.Text = String.Format("Weapon");
    player.AddInventory(Weapon);
    AttackModifier = 0;
    Weapon = null;
    return 0;
  }
}

function SetArmor(int DefenseValue, InventoryItem* ItemName)
{
  if(Armor != null) RemoveArmor(); //if the slot is already taken, remove it! :)
  DefenseModifier = DefenseValue;
  Armor = ItemName; //Just so I have a reference to the inventory item
  Inventory_Armor.NormalGraphic = ItemName.Graphic;
  Inventory_Armor.Text = String.Format(""); //remove the label text
  player.LoseInventory(ItemName);
  return 0;
}

function SetWeapon(int AttackValue, InventoryItem* ItemName)
{
  if(Weapon != null) RemoveWeapon();
  AttackModifier = AttackValue;
  Weapon = ItemName;
  Inventory_Weapon.NormalGraphic = ItemName.Graphic;
  Inventory_Weapon.Text = String.Format("");
  player.LoseInventory(ItemName);
  return 0;
}


SMF spam blocked by CleanTalk