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

#1
TextBoxFont is just the name of the font I imported to use in the game.  In my globalscript.asc I have this code in there to set the default font for GUI 11 (the custom textbox):

Code: ags
function game_start()
{
  Game.NormalFont = 4;  // Large font for textboxes
  
}

Looks like I missed game.speechfont setting.  I added that in, and it works great!

Thanks for helping point me in the right direction!

Bill
#2
Sure, it's below:



Thanks,

Bill
#3
I have a high res game I'm making.  Part of it is a custom textbox GUI and a custom high res font.  I've disabled outline on the font setting.  When dialogs happen (using Sierra with background style), the speech has the large font that I want, but also the generic dialog font showing up very tiny at the top of the box, essentially having 2 instances of the same speech text, looking weird and sloppy.  How do I remove this and just have the normal font size used for everything?

Plain old textboxes are fine, no issue, but speech has this double print as seen in the pic below:




Any thoughts or assistance is greatly appreciated.

Thanks,

Bill

#4
Got it, I will just revamp and use characters instead.  No use reinventing the wheel on this kind of thing.

Thanks again for the advice and info.

Bill
#5
I'm having a hard time with a fairly simple script I'm trying to implement, and would greatly appreciate any assistance in getting this thing ironed out.

I am developing an RPG, and have a battle room set up.  I have a function call that passes the monster name to the room, so when the player enters battle, it does: EnterBattle(##) where ## is the monster number.  Upon entering the room, it grabs the health, armor, etc from the monster list I have.  The battle screen is similar to the old Quest for Glory games where the player is on one side and monster is on the other.  I have a GUI that I named gBattleGUI that pops up in that room.  On that GUI are buttons for different attack types and spells the player can use depending on their class and spells currently known. 

I am not using the character for this, instead I have a different set of animations for this battle room that I have set to objects.  So I have a oHero object and an oMonster object.  The oHero, upon room load, changes to a different sprite depending on weapon equipped, etc, so it matches the player's class, equipped weapon, etc.

I want the btnMelee button in gBattleGUI to change the oHero.Graphic to 123, then run a mobHP = mobHP - 5 script to reduce the monster's HP by 5 (this will be replaced with an actual script later based on monster armor, player weapon use, type of weapon, etc.  But for now I'm having a hard time passing whatever variables I need for this to even work.

In the gBattleGUI I have an on-click event for the btnMelee button:
Code: ags
function btnMelee_Click() {
  
MeleeAttack();

  }


At the very top of GlobalScript.ash, I have the import:
Code: ags
import function MeleeAttack();


Then in my room299.asc (the battle Room) I have a function set up:

Code: ags
function MeleeAttack() {
  
if (equippedWeapon.ID == 1){  // If character is wielding a sword,  change image to depict sword attack.  
    Wait(20);
    oHero.Graphic = 228;  // Swing Sword
    
  }
  
  else if (equippedWeapon.ID == 2){ // If character is wielding a dagger,  change image to depict stabbing with a dagger.
    oHero.Graphic = 219;

  }
  
  else {
    oHero.Graphic = 230;
   }  
}


I will be tweaking everything, but for now I'm just trying to get it to run.  If I do the changes manually in the room code, it works fine.  But when I try to invoke the image changes from the GUI button, the game compiles and runs, but as it tries to launch, I get a crash and an error popup window:

Loading game failed with error:
Script link failed.
Error (line unknown): in GlobalScript.ash: 1 unresolved imports (last: MeleeAttack).
The game files may be incomplete, corrupt or from an unsupported version of AGS.

I did try recompiling, to no avail.  The issue persists.

Is there a better way to call a function, or a more practical way for me to change room object graphics and run calculations against both local and global variables from a GUI button?

Thanks in advance!

Bill


#6
That's great to know moving forward, thanks so much for the insight.  That was so much simpler to implement and works great.  A few tweaks, and it'll be exactly what I need. 

Thanks again for the assistance!

Bill
#7
Hello everyone,

I've recently gotten back into AGS after many years away, and am working on a new RPG.  I thought I had a workable idea for item equipping.  The player has base stats, but can equip 1 weapon, 1 armor piece and 1 jewelry piece for stat increases and aesthetics.  I decided my main inventory screen will have an "Equip" button, and also a section with equipped items.  There are 3 dummy characters I created, and on the Inventory GUI I assigned 3 separate inventories to these 3 characters.  There is a cEquippedWeapon, cEquippedArmor and cEquippedJewelry character that I'm referencing with my script.  The idea is that the player selects the item they want to equip, so it becomes the ActiveInventory object.  They then click the "Equip" button on the GUI, which runs the on_click code.  The code should take note of Inventory Item #, with 1 and 2 being weapons, 3 and 4 being armor, 5 and 6 being jewely.  It should allow each of the 2 to be equipped (which player.LoseInventory and cEquipped___.AddInventory are used), but only if there isn't already an item equipped / in that secondary character inventory already.  Once working, I'm going to add the stat boosts, view changes, etc. 

The problem is that I am getting an error on the line of code at :
Code: ags
        if (cEquippedWeapon.InventoryQuantity > 0)

The error thrown when I try to run the game is:

GlobalScript.asc(2131): Error (line 2131): Expected array index after 'Character::InventoryQuantity'

For reference, the entire on_click event script for the Equip Button is:

Code: ags
function btnInvEquip_OnClick(GUIControl *control, MouseButton button)
{
  
    InventoryItem* selectedItem = player.ActiveInventory; // Get the currently selected inventory item

    if (selectedItem == null)
    {
        Display("You must select an item first");
        return;
    }

    // Check if the item is a weapon (IDs 1-2)
    if (selectedItem.ID == 1 || selectedItem.ID == 2)
    {
        if (cEquippedWeapon.InventoryQuantity > 0)
        {
            Display("You already have a weapon equipped.");
        }
        else
        {
            cEquippedWeapon.AddInventory(selectedItem);
            player.LoseInventory(selectedItem);
            Display("You've equipped the weapon.");
        }
    }
    // Check if the item is armor (IDs 3-4)
    else if (selectedItem.ID == 3 || selectedItem.ID == 4)
    {
        if (cEquippedArmor.InventoryQuantity > 0)
        {
            Display("You already have armor equipped.");
        }
        else
        {
            cEquippedArmor.AddInventory(selectedItem);
            player.LoseInventory(selectedItem);
            Display("Armor equipped!");
        }
    }
    // Check if the item is jewelry (IDs 5-6)
    else if (selectedItem.ID == 5 || selectedItem.ID == 6)
    {
        if (cEquippedJewelry.InventoryQuantity > 0)
        {
            Display("You already have jewelry equipped.");
        }
        else
        {
            cEquippedJewelry.AddInventory(selectedItem);
            player.LoseInventory(selectedItem);
            Display("Jewelry equipped!");
        }
    }
    // If the item doesn't belong to any category for testing
    else
    {
        Display("This item cannot be equipped.");
    }

}


If anyone has any insight into this, I'd greatly appreciate it.  I didn't think it was too complicated of a script, and I can't seem to find anything on the forum with those keywords.

Thanks!

Bill

SMF spam blocked by CleanTalk