A Flash Developer Resource Site

Page 2 of 5 FirstFirst 12345 LastLast
Results 21 to 40 of 84

Thread: Children of the Kingdom - RPG

  1. #21
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    what flash version you use I got caught up on some stuff
    I was born with a camera in my eyeball maybe

  2. #22
    Member
    Join Date
    Aug 2013
    Posts
    39
    actionscript 2 , flash CS6

  3. #23
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    Here you go, http://indocastles.com/play/xeno_inventory_system.fla

    The link will be deleted in 10 days, so make sure to archive a backup.

    If you enjoyed that system, feel free to buy me a pizza, paypal: giancarlo.quarta@yahoo.com
    Last edited by Alloy Bacon; 12-20-2015 at 06:35 PM.
    I was born with a camera in my eyeball maybe

  4. #24
    Member
    Join Date
    Aug 2013
    Posts
    39
    its actually pretty amazing, you do good work bacon. I'll have to get you a pizza when I get paid

  5. #25
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    Thanks man cool fk name
    I was born with a camera in my eyeball maybe

  6. #26
    Member
    Join Date
    Aug 2013
    Posts
    39
    Now while your system is amazing, I still don't think I'll be able to use it because the only way to add items to it is to add them one by one and even then i dont know if I can make the items actually do anything. Is there a way to make your system use different elements in an array rather than a premade string?

    this is the system I was working on before you made that one:
    Code:
    //ITEM SYSTEM
    //this array will hold all items, inside of it, hopefully to be called inside of itself
    
    //0.......1............2........3......4.... array element values
    //name, description, effect, price, item type
    _global.itemlist = [
    //CONSUMABLES
    ["Sweetroot", "Restores 50 HP", 50, 100, "consumable"],
    ["Sugarroot", "Restores 100 HP", 100, 500, "consumable"],
    ["Candyroot", "Fully restores HP", 9999, 5000, "consumable"],
    ["Bitterroot", "Restores 50 MP", 50, 200, "consumable"],
    ["Sourroot", "Restores 100 MP", 100, 600, "consumable"],
    ["Tartroot", "Fully restores MP", 9999, 10000, "consumable"]
    ];
    //0.......1............2....3....4...5....6.....7. array element values
    //name, description, user, str, sta, def, mst, item type
    _global.weaponlist = [
    //WEAPONS
    ["Secred", "A mysterious zanbato with seals on the blade", "azul", 50, 0, 25, 10, "weapon"],
    ["Illuminite", "A thin weapon with a diamond rod for focusing light", "aseru", 50, 10, 10, 50, "weapon"],
    ["Fists", "A bare handed attack", "malforn", 50, 0, 55, 0, "weapon"],
    ["Kazeshini", "An oddly shaped blade for quick attacks ", "vayle", 20, 10, 25, 10, "weapon"],
    ["Yamato", "A katana with a blue hilt and a lightweight blade", "aoizi", 50, 20, 35, 50, "weapon"],
    ["Saleria", "A heavy scythe made from chenre absorbing crystal", "laava", 50, 20, 35, 50, "weapon"]
    ];
    //0.......1............2....3....4...5....6...7 array element values
    //name, description, str, sta, def, mst, price, item type
    _global.armorlist = [
    ["Clothes", "light clothing", 0, 10, 10, 0, 500, "armor"],
    ["Armor", "plated armor", 0, 20, 20, 0, 5000,"armor"],
    ["Chain", "a thick chain for attack or defense", 20, 10, 10, 0, 500,"armor"],
    ["Shawl", "thin fabric worn by women", 0, 0, 5, 10, 7000,"armor"],
    ["Bodysuit", "a thick full body suit", 10, 20, 20, 0, 7500,"armor"],
    ["Spiked Araments", "armor covered in spikes, increases attack strength", 30, 0, 20, 0, 8000,"armor"]
    
    ];
    
    //0.......1............2....3....4...5....6...7 array element values
    //name, description, str, sta, def, mst, price, item type
    _global.acclist = [
    ["Blade Ring", "raises attack", 30, 0, 0, 0, 500,"accesory"],
    ["Vigor Ring", "raises stamina", 0, 30, 0, 0, 500,"accesory"],
    ["Shield Ring", "raises defense", 0, 0, 30, 0, 500,"accesory"],
    ["Chenre Ring", "raises mental", 0, 0, 0, 30, 500,"accesory"],
    ["Knife Ring", "greatly raises attack", 120, 0, 0, 0, 50000,"accesory"],
    ["Vehemence Ring", "greatly raises stamina", 0, 120, 0, 0, 50000,"accesory"],
    ["Aegis Ring", "greatly raises defense", 0, 0, 120, 0, 50000,"accesory"],
    ["Aura Ring", "greatly raises mental", 0, 0, 0, 120, 50000,"accesory"]
    ];
    
    //call the items in this array like this:
    //call item name with item[0][0];
    //call item desc with item[0][1];
    //call item effect with item[0][2];
    //the first array element is the item being addressed
    //(item[0] = Secred. item [1] = Fists
    //the second array element is the item being addressed
    
    
    //trace(item[0][4]); //should trace the name Sweetroot

  7. #27
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    So you want the items in an array.. And a button option that says specify amount?
    I was born with a camera in my eyeball maybe

  8. #28
    Member
    Join Date
    Aug 2013
    Posts
    39
    yeah if you feel like taking a crack at it

  9. #29
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    Ok I will give you it friday or before that. No worries
    I was born with a camera in my eyeball maybe

  10. #30
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    http://indocastles.com/play/xeno_inventory_system.fla

    you can specify how many you want now, also the names are in an array
    I was born with a camera in my eyeball maybe

  11. #31
    Senior Member
    Join Date
    Aug 2012
    Posts
    124
    christmas alloys, you need check html for web site, make good, plus is no game thare, http://www.onlinewebcheck.com/

  12. #32
    Senior Member
    Join Date
    Aug 2012
    Posts
    124
    hey alloys, you still make file that is no useable.
    The aray is just one long string which is at best unworkable.

    the array xeno want is as he say

    _global.itemlist = [
    //CONSUMABLES
    ["Sweetroot", "Restores 50 HP", 50, 100, "consumable"],
    ["Sugarroot", "Restores 100 HP", 100, 500, "consumable"],
    ["Candyroot", "Fully restores HP", 9999, 5000, "consumable"],
    ["Bitterroot", "Restores 50 MP", 50, 200, "consumable"],
    ["Sourroot", "Restores 100 MP", 100, 600, "consumable"],
    ["Tartroot", "Fully restores MP", 9999, 10000, "consumable"]
    ];

    that is how you should use and work the arrays, you just make one similar to the invent system you use on game.
    That only make one long string of single array.

    you file full of holes, it not like when you remove more than zero, it not like when buy more than 1 each time, it say undefined when have none, very very need to use array correct alloy or you stick in bad bad code way.

    you try buy one chicken thenbuy 2 chicken, learn array alloy.

    merry christams

  13. #33
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    wow your right terrencing thats amazing array you got there
    I was born with a camera in my eyeball maybe

  14. #34
    Senior Member
    Join Date
    Aug 2012
    Posts
    124
    hello alloy, i have no array here , i qwote xeno post.
    first you say about encrypting potions and things, nothing to do with post at all plus bad encrypt too.
    then you say you help with file and give unuseable file that not code too good.
    then you say you change it by add button and make it worse.

    admit it , can you help this man or not, properly , i not so sure you can do, just try sound like can.

    sorry sound bad but is not help guy, new year

  15. #35
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    Quote Originally Posted by xenomaren View Post
    its actually pretty amazing, you do good work bacon. I'll have to get you a pizza when I get paid
    The way I see it, xeno is getting pretty happy, im also pretty proud your english typing is going up along with your post count
    I was born with a camera in my eyeball maybe

  16. #36
    Member
    Join Date
    Aug 2013
    Posts
    39
    Quote Originally Posted by Alloy Bacon View Post
    The way I see it, xeno is getting pretty happy, im also pretty proud your english typing is going up along with your post count
    well he's not totally wrong, your files do have those issues and are not useable, but I've been reading through the code and breaking it apart and learning from it. Nothing useable yet but its helping me understand arrays lol

    besides so far you're the only help ive gotten on this item system

  17. #37
    Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    1,090
    You dont need to declare actual arrays to combine strings xeno, here is a sample one line from my game that combines strings over 24 thousand different ways to specify colors in a movieclip without actually using a multi dimensional array:

    PHP Code:
    _root.colorTo(_root.local.dude.type[_root.my_selected_wear_4.split(":")[0]][_root.my_selected_wear_4.split(":")[1]],_root.color_lib[int(_root.my_shoes_color-1)]); 
    I was born with a camera in my eyeball maybe

  18. #38
    Member
    Join Date
    Aug 2013
    Posts
    39
    I want to be able to declare them in arrays though, especially if I want to make the items do things. I need to be able to equip items, use consumables, make items affect stats, attach them all to a specific price in the market, ect. Not to mention I don't want to have to write a specific item 3 times just to get it to show up, my game will have a LOT more items than just the ones shown in my array here. I need them to do more than just show up

    idk if you've looked at my game or my code yet, I still suggest you do, because my game isnt a tiny little 3 minute flash game, it's pretty extensive and it needs an item system that works well with the game itself

  19. #39
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,818
    So I was looking over your inventory code so far. In my opinion you're making the mistake of storing your inventory info in a difficult structure. I ran into this problem when I was trying to save stuff using local storage with flash in a single string. I could parse the string just fine but then if I changed the structure at all then it would take massive rewriting of the code. I would suggest you store them as objects instead in the array. Like this:
    var arr:Array = [];
    arr["Sweetroot"] = {description:"Restores 50 HP", effect:50, price:100, itemType:"consumable"};
    trace(arr["Sweetroot"].description);
    So this makes accessing the info you need a bit easier through variable names instead of position. e.g.:
    arr["Sweetroot"].description instead of item[?][?].
    Then for inventory order you would want to use a second array to keep track of that. Something like this:
    var inventory:Array = ["Sweetroot", "battlesword"]
    Then you could access inventory stuff like this: arr[inventory[0]].description. This would give you the description of the first item in the inventory.
    This way the array with the objects is like the database for all the item info and the inventory var is applying that. This makes it so you don't have to pay attention to the order of things unless it's necessary. In this case, the order of how items are listed. I suppose that the order could just become another property as well however.
    If you want to chat for further assistance I can join you on an irc room for real time assistance.
    Last edited by swak; 01-06-2016 at 01:17 AM.
    .

  20. #40
    Member
    Join Date
    Aug 2013
    Posts
    39
    That actually makes a lot of sense, the way I was calling them before was by using this code:

    Code:
    _global.itemlist = [
    //CONSUMABLES
    ["Sweetroot", "Restores 50 HP", 50, 100, "consumable"],
    ["Sugarroot", "Restores 100 HP", 100, 500, "consumable"],
    ["Candyroot", "Fully restores HP", 9999, 5000, "consumable"],
    ["Bitterroot", "Restores 50 MP", 50, 200, "consumable"],
    ["Sourroot", "Restores 100 MP", 100, 600, "consumable"],
    ["Tartroot", "Fully restores MP", 9999, 10000, "consumable"],
    //WEAPONS
    ["Secred", "A mysterious zanbato with seals on the blade", "azul",5000 ,"weapon"],
    ["Illuminite", "A thin weapon with a diamond rod for focusing light", "aseru",5000 ,"weapon"],
    ["Fists", "A bare handed attack", "malforn",5000 ,"weapon"],
    ["Kazeshini", "An oddly shaped blade for quick attacks ", "vayle",10000 ,"weapon"],
    ["Yamato", "A katana with a blue hilt and a lightweight blade", "aoizi",200000 ,"weapon"],
    ["Saleria", "A heavy scythe made from chenre absorbing crystal", "laava",300000 ,"weapon"]
    ];
    	//_global.gold=100
    		_global.items=[0,1,2,3,4,5,6,7,8,9,10]; //this is your actual inventory, if an item is picked up, it is pushed here
    //right now it's just listing one through ten so it properly displays the entire inventory in the fla file
    
    for (i=0;i<_global.items.length+3;i++){
    _root[i].removeMovieClip();	
    }
    youritem = "Inventory" + newline + newline;
    for (i=0;i<_global.items.length;i++){
    	youritem+=_global.itemlist[_global.items[i]][0]+ newline;
    	trace(_global.itemlist[_global.items[i]][0]);
    }
    itemdesc = "Description" + newline + newline;
    for (i=0;i<_global.items.length;i++){
    	itemdesc+=_global.itemlist[_global.items[i]][1]+ newline;
    	trace(_global.itemlist[_global.items[i]][1]);
    }
    pricetxt = "Price" + newline + newline;
    for (i=0;i<_global.items.length;i++){
    	pricetxt+=_global.itemlist[_global.items[i]][3]+ newline;
    	trace(_global.itemlist[_global.items[i]][3]);
    }
    itemtype ="Type" + newline + newline;
    for (i=0;i<_global.items.length;i++){
    	itemtype+=_global.itemlist[_global.items[i]][4]+ newline;
    	trace(_global.itemlist[_global.items[i]][4]);
    }

    http://www.mediafire.com/download/2p...ry_quickie.fla .fla
    http://www.mediafire.com/download/ry...ry_quickie.swf .swf

    ^those are so you can see it in action, both are tiny

    but I'll definitely look into displaying it the way you said swak. I might be able to make the items stack better that way anyway. I really liked Bacon's script though, I managed to organize it so it looks a little better,

    http://www.mediafire.com/download/h5...em_rework6.swf .swf

    but the code for it is a little beyond my understanding to be honest. I don't think I'd be able to make the items usable in the game, but it is an excellent way of displaying them
    Last edited by xenomaren; 01-06-2016 at 04:42 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center