Announcement

Collapse
No announcement yet.

Picking one element from array?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Picking one element from array?

    Hello all,

    I have a game im making and have spells i want to cast, at certain levels more powers become available (Level 1=Fireball & Level 5=Hells Gate). Now I can do every thing calling individual boolean's and setting them but is alot of extra unnecessary work. What I want to do is make a array of boolean's or a structure containing each of my powers like this (Which one is best to use, An Array or Structure?)

    Click image for larger version

Name:	boolarrayorstructures.jpg
Views:	1
Size:	274.7 KB
ID:	1167823




    Then with the array/structure I want to scroll threw each power making one true and rest false if the right level is had in blueprint so I can determine what power is active.

    For example your level 8 and have 3 powers available, when you press the 1 key have it switch to the next power available to you. So if fireball is active you press 1 key now fireball is no longer active but hell's gate is active.

    How do I achieve this and which is best used a structure or array? Any help is appreciated, Thank You!

    Mike


    PS: I have read documentation and do not understand as it only covers basics.

    #2
    hey onimike, i've had a quick read through your post and tried to find you a solution, if this is not what you meant then simply ignore it

    here's one way i would do it using Enumerations, it's very quick and allows you a great amount of freedom and most importantly at least for myself it stays away from using too many booleans and turning them on and off all the time.
    then inside of the functions like cast fireball and cast hellgate you can do your fancy stuff of actually casting the spells. Now to advance to the next spell all you would have to do is increase the variable called "Skill to Cast" by one and it would call the next function in line. I've left out the part of increasing the variable by one, because it wasn't clear how you would want to do that from your post. If you need any more help or if I've misunderstood your post please say and i'can give it another shot

    Click image for larger version

Name:	ae25bb1438f2a2f49d98b8db47d2c323.png
Views:	1
Size:	181.4 KB
ID:	1094379
    Attached Files

    Comment


      #3
      For my spell system, which i gonna reveal in next 24h on marketplace forum (shameless plugin) i use actor based spells, which always exist if can be used/was learned and activate them by direct communication, which allow a lot more complex system then projectile, one time effect.

      Comment


        #4
        Originally posted by SixTwo View Post
        hey onimike, i've had a quick read through your post and tried to find you a solution, if this is not what you meant then simply ignore it

        here's one way i would do it using Enumerations, it's very quick and allows you a great amount of freedom and most importantly at least for myself it stays away from using too many booleans and turning them on and off all the time.
        then inside of the functions like cast fireball and cast hellgate you can do your fancy stuff of actually casting the spells. Now to advance to the next spell all you would have to do is increase the variable called "Skill to Cast" by one and it would call the next function in line. I've left out the part of increasing the variable by one, because it wasn't clear how you would want to do that from your post. If you need any more help or if I've misunderstood your post please say and i'can give it another shot

        [ATTACH=CONFIG]68490[/ATTACH]

        Wow thank you so much looks like that is exactly what i needed.

        Thanks again this is awesome!
        Last edited by onimike; 12-02-2015, 08:32 PM. Reason: Figured out problem

        Comment

        Working...
        X