lionz's Forum Posts

  • You wouldn't need to use arrays if you already have the inventory working without as it would be the same logic. For item rarity you could generate a number from 1-100 and if it is 1-10 then you spawn legendary, something like that. For the item selection and spawning, do you have that already with an inventory? You would spawn the items in the same way, create object by name on top of the slot if you are not using arrays.

  • I edited the response above, try this. The problem is that you don't know what object will be created so you can't apply actions. If you use Family in the actions then it'll change the one that was created, not the new one. If the above doesn't work then you might have to do logic for individual Shadow objects rather than Family, which isn't that bad.

  • That looks ok, is that not working? What has gone wrong?

    edit: I see, you can't choose the object in the actions.

    Try this, if you store the animation and frame in a global variable. Then use 'family on last created' and set the animation and frame to the variables. Maybe...

  • Nice, that should be easy then. So if you say 'Create object Shadow', you can then set animation to Family.animation and frame to Family.animationframe, as the Family was picked in the condition. If you picked the actual object in the condition i.e. pick Shadow A then created Shadow A then it will be a bit more diffiult. Should work though with Family object 'Shadows' in condition and then 'create object Shadow'.

  • If it's that kind of design then for a start you create several of the same slots for the loot bag and spawn a random item to them which I imagine would be setting a random slot.itemname or creating an object on the slot itself, however you have done it earlier. You can copy all logic from the inventory, then you should be able to move items from those slots to your inventory in the same way that you move items around the inventory.

    For the loot you can have all items in an array and pick a random row for example and then create this object or set itemname on the slot, or in a more simple form you can set slot.itemname to choose('sword','armour','potion') for example which picks one at random. Then you expand the logic as you go based on what loot can spawn, if enemy that died=goblin then set loot to choose(A,B,C)).

    To run it for each slot you could give the lootbag slots a variable to differentiate them from the inventory ones and say for each slot, where variable=loot, run the spawn item logic.

  • You didn't pick a signpost so your events mean text will be spawned at every sign post in the level (unless tutorialsign and signpost are in a container) then when you step away destroy them all, this could be any number of objects. Then I notice your number of objects increasing just from walking to and from the sign post which raises another potential problem.

  • I should've asked if you used array for the inventory. Because the loot bag would just be another mini inventory that you generate. You can push random items to the array and they appear in slots the same way they would in an inventory. Deciding if the enemy will drop loot is just a variable like for example set to choose(0,1) if it was a 50% chance.

  • Ok I chopped it down and made something that works. Probably you are overthinking arrays, you've been here a while asking for help. Just relax and think about what you are doing, arrays are easy and all the logic is there for you to use. Trial and error will not help you with getting a working crafting system, you need to have control and understand the arrays. dropbox.com/s/u27mn3dovc9b5ya/addtoinv.c3p

  • It's possible, there just might be problems with picking. Did you first manage to create the copy because if you are using a family this wouldn't normally work as it would create a random object from the family, or are you using create object by name?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Did you already make the main inventory? Which bit are you having trouble with in particular? If you mean that you have none of the above then there's a lot to do here.

  • Probably something like 'for each button, creature is overlapping button' > set button.variable to creature.pickedcount might work.

  • You are pushing to the top of the array, is that intentional? Usually you would push to the back of an array tbh. The animation logic doesn't relate to the array and the item objects themselves don't relate to the array. Better if you give the items a variable int that is their position X in the array so you can relate. Then the items that are created will have a co-ord position and you can use the animation name that you added to the array, something like set animation to array.at(self.var,0)

  • Great :)

  • Deleting the X should delete the entire row so all the data. On second thoughts it may not find the other column data using indexof so maybe don't use that and use the loop that you had, then for the action delete 'array.curx' for the row.

  • You've used IID in the action which is different to the UID. Also you don't really need the loop if the outcome is to delete the row containing the UID, you can add the action to the '=dead' condition and if it finds the value it will delete the row.