GPProd's Forum Posts

  • It makes some sense if it says +0, +0, +3, -1 in my opinion but you can choose to display whatever you want. Yes you can assign it to an instance variable on the weapon when it is created if you want.

    No i mean the text display to the player when hovering over the item with the mouse.

    If it said;

    Str+3

    Dex+0

    Vit+0

    It seems weird xD - better it says

    Str+3

    Dex+1

    -Done-

  • There are different ways to do it. You could have the weapon choose(1,2,3), if 1 is chosen then it is a +strength item, if it is a +strength item then you pick a random value for the strength variable of the weapon i.e. strength=random(1,5), then if 3 is chosen its strength is 3, hence a +3 strength item. Then when the player equips this weapon, wherever the equip logic is, you add weapon.strength to player.strength so it'll be player.strength+3. You could actually put logic in to cover all values for all weapons at this point, since dex and vit will be +0.

    So on any equip weapon:

    player.str = player.str+weapon.str = player.str+3

    player.vit = player.vit+weapon.vit = player.vit+0

    player.dex = player.dex+weapon.dex = player.dex+0

    You can advance this further later on by choosing multiple initial numbers and assigning negative values so you can gain strength and lose vitality on weapon equip.

    Correct, was my first idea - BUT since we have item stats display, then its bad if it displays 'dex 0, vit 0, str 3' Makes no sense :/

    However, choose 1,2,3 how is that done? Varaible on the weapon or?

  • I guess you could do :

    On item created choose (1,2,3)

    if 1, s=true, v=true, d=false

    if 2, s=true, v=false, d=true

    if 3, s=true, v=false, d=false

    The true or false doesn't really relate to anything though unless you have some other logic setup. Rather than use bools you can have s=random value i guess.

    How would that go? Basically I want a weapon to give either str or vit or dex, - which takes place when u equip it. (Adds to the same stat) - If strength would be 5 and dexterity would be 3 then when u equip it, those same stats are added to the heroes str and dex.

    If the weapon should give vitality instead of dex, then thats whats supposed to be added.

    But for now we need a random stat on weapon on created.

  • Do you mean give a random value to strength, dexterity and vitality? Or do you mean choose either s, d or v to increase?

    I mean to give a random stat, so when an item drop;

    It can have Strength and Vitality

    Or Strength and Dexterity

    Or just Strength.

  • Yes take a look at this https://www.scirra.com/tutorials/583/ea ... g-an-array

    Hehe thanks alot - but i didnt understand how i can give a weapon a random stat of either Strength/Dexterity/Vitality, just 1 out of these 3? All 3 variable instances are already on the weapon sprite

  • It's hard to tell without seeing your events, but basically you need to figure out a way to assign those values at the time the new item is created.

    It is 'On created' -> But the older items on the ground changes value too.

    If on new item created, set Dexterity to = 0, then the old item on the ground will also be 0 Dexterity

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Greetings there! ^_^

    So - with some help i created an item drop system simmilar to Borderlands and Diablo 3. When an item is dropped, (on created)

    Set (all of the ID Below) To random (3) On each. Now it works fine - as it looks that all stats are random. I made a display text for each one of the stats to show when character is overlapping the item.

    Now the problem is, when a weapon is created and all of the ID sets to randomly - it displays the item text just fine.

    However when ANOTHER item drops, it overrides the last items stats too, it changes, how come? O.o

    I want it to keep the value it had *when* it dropped/was created.

    I gave the Item instace variables;

    ItemLevelID

    ItemStrengthID

    ItemDexterityD

    ItemVitalityID

  • You are probably looking to use an array inventory, complex at first but useful once you know how. Check out the manual and some tutorials on how to create an inventory from arrays. If you pick up an item that's on the ground you would then add it to a slot in the array. The array can store the stats of the item etc

    So these stats created on drop on the item can be stored into the array?

  • On weapon created, weapon.strength = choose(a,b,c) will give strength a value of a or b or c. The stats will just be instance variables, you add them to the object in the creator. You could create a family 'weapons' and add family instance variables such as name, level, strength, damage etc

    Hehe hey thanks alot for this response! ^_^

    How would that work if i need to 'pick up' or 'equip' that item, i must destroy it and create an equal in bag? How would i transfer those stats to the new items?

  • That's just for display purposes in a menu but yes I guess so, text can display broadsword.level. The variables will be whatever you need for the gameplay, if the damage and strength both matter to the gameplay then you will need them. The text can be displayed in one or separate textboxes depending on how you want your inventory to look.

    How about if i want a random stat on the weapon? Like strength or dexterity or vitality, 1 or 2 randomly??

    Can that be done?

  • Broadsword has a 'level' instance variable. Character has a 'level' instance variable. On Broadsword created, Broadsword.level = Character.level.

    Loool ur a smart one xD hoho -

    And then an ItemText base for the weapon??

    If Item lvl X = set text to X ?

    Should i btw have same text for displaying dmg/stregth etc on the item, or 1 text for each variable?

  • Hey there! ^_^

    So bascially an item system like Diablo 3 or Borderlands - where when an item drops, its stats/dmg is based on the character

    level WHEN it was dropped -> Lets say;

    Hero is lvl 5 and a Broadsword drops, - then its stats are dependant on the Hero's level, in this case level 5.

    But now the Hero gains lvl 6 or 7 - however the item stats should stay the same stats it was when it dropped (Hero lvl 5) -

    Is it possible to do that? And in that case, how is it done?

  • Same concept.

    Start at 0 width for black bar, add the damage points to your blackbar "health" attribute instead of subtracting from life bar. Now I would think the glowing "Halo" around your life bar should decrease proportionally but we'll never know unless we test it.

    What is the code for that? To increase it by adding points depending on how much health is lost?

  • Hey there! ^_^

    So, i have looked through all the health bar tutorials i can find, and they all are about width /* with the current life and max life -

    Basically it sets the width of the healthbar to the % of hp.

    Now since we have a glowing health bar, then that looks strange, that its width decreases, so i thought about

    making instead a 'black' bar that cover the health instead to make it look better! ^_^

    Does anyone have a tutorial capx for this?

    Currently its - lerp(Self.Width,(HeroX.HeroCurrentHealth/HeroMaximumHealth)*Healthbar.ImageWidth, 5*dt)

    But how to do a black bar that covers the health bar instead? I dont get the / and * to make a black bar grow backwards on the bar depending on health loss?

  • GPProd not if you know how to set it up properly. I've done it both ways. Like I said I prefer doing it with layers, but mainly because I like the look better.

    What do u mean by 'set it up' properly? ^_^

    When i go back and forth to a layout, the character starts at the entrance again, all enemies have full hp, all enemies have respawned lol xD