Customizable characters (+giving clothes stat changing elements)

Started by Anshinin, Fri 13/02/2015 19:27:14

Previous topic - Next topic

Anshinin

So not to bombard you guys with question threads but I had this idea and I want an idea as to how it'd be possible.

Basically I want to have some sort of way to have customizable/equippable clothes for the character. Both my characters run the same body template so making clothes wouldn't be hard. My idea is this.

Make each outfit a different player and change the player to that one when the clothes are equipped somehow (probably through a specific location for changing clothes)
--> Question with this: How could I transfer the players inventory to the next "character" they're using? Also, how can I make these clothes have the ability to make you stronger, or more defensive? I use the SetGlobalInt method to make stats, however I don't have a defense stat. I rather wanted the clothes you where to increase your resistance to attacks, how could this be done?

The last thing is kind of a side thing, but I figured I'd tackle it in this thread. I want my character to also have a second inventory that they can access via their main one (like a button of some sort) that holds their spells, weapons, etc. How could I specify what type of item goes to what, and also the process of both of those inventories going into different clothes.

Cassiebsg

Quote from: Anshinin on Fri 13/02/2015 19:27:14
--> Question with this: How could I transfer the players inventory to the next "character" they're using?
If your "character" is the same, meaning the player, you don't need to do anything. Just make sure that in script you add and remove inventory to the player, and not cEGO or cPlayerA, etc.
If you want to actually change characters, like you changing cPlayerA to cPlayerB, then you can just use the AddInventory and LoseInventory normally. in his case cPlayerA loses Inventory and cPlayerB adds.

Quote from: Anshinin on Fri 13/02/2015 19:27:14
Also, how can I make these clothes have the ability to make you stronger, or more defensive?

just create a Global Variable for the Clothes...

Quote
The last thing is kind of a side thing, but I figured I'd tackle it in this thread. I want my character to also have a second inventory that they can access via their main one (like a button of some sort) that holds their spells, weapons, etc. How could I specify what type of item goes to what, and also the process of both of those inventories going into different clothes.

You need to create an invisible dummy character to carry those items in it's inventory. Then you just add the items to cDummy's inventory. I have the same, only I've made a backpack on mine. :)
And again, use Global Variables to control what goes where if need be. Though, you already know what type of objects you want on the second inventory, so you can add them directly to the dummy... or you can use a global variable, and then determine with if/else condition where it should go.

Here's a thread that might help you out in the right direction:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=50570.msg636490186#msg636490186
There are those who believe that life here began out there...

Vincent

Well Cassiebsg has already answered to your questions as well.
If you have to somehow move inventory items to another character you could do something like this

Code: ags

//                    in GlobalScript.ash                   //

import void GiveAllInventory(this Character*, Character *other); 



Code: ags

//                    in GlobalScript.asc                  //

void GiveAllInventory(this Character*, Character *other) 
{
  int a = 1;
  while (a <= Game.InventoryItemCount) 
  {
    other.InventoryQuantity[a] += this.InventoryQuantity[a];
    this.InventoryQuantity[a] = 0;
    a ++;
  }
   UpdateInventory();
 }
} 


You can use it in this way then
player.GiveAllInventory(cDummy); Or cDummy.GiveAllInventory(player);


Regarding the cloths ability I suggest you to enumerate them all first..
After that need to create a structure and assign it to an array for example.

Code: ags

struct cloths 
{
  String name;
  int ability, defense, level;
  // etc etc
}; 

cloths type[4];
export type; 



Then you can assign the necessary values to them
Code: ags

function game_start() 
{
  type[1].name = "Jacket";
  type[1].ability = 5;
  type[1].defense = 5;
  type[1].level = 1;

  type[2].name = "Armor Shield";
  // etc etc
} 



SMF spam blocked by CleanTalk