How to create a power list?

I’m completely new to choicescript … and programming in general … and I may have hit the ground running a little too hard :sweat_smile: trying to make my first game. But I’m determined to complete it and therefore I need to figure out something that seems rather complicated and full of moving parts. I want to make a power list, like what you might see on say Hero or Villain: Genesis, with points to distribute on a number of pre-decided choices, based on a choice that defined the group of powers you could choose from. In essence, what kinda format would that take? Commands, organization, etc. Any suggestions?

Anyone? Please? I can’t seem to make it work :weary: I can’t seem to find a guide or helpful post in this area, and my custom solutions have only worked halfway or not at all. Here’s an example of what I’m trying to do. I’m making a game where you’re a mage, and you get to choose from a class of magic at the start (fire, water, etc) and then you choose from a starting list of spells. Some of my list making has worked out, but I’m trying to make different levels of a chosen skill, and if you choose one you lose the option to pick the other. As with this down here, I have two tiers for healing magic. You choose one tier, you can’t stack it with the other. So I assigned a temp point value ‘Healingchoice’, and once you pick one the other becomes unavailable. HOWEVER I can’t seem to make it work with another variable for the cost of mana to buy the spell! I guess two selectable_if commands can’t occupy the same space? But when I tried to use the if statement with two variables, that produced the same failure! Anyone know what command or correction to make?

You have 500 mana points to spend.
*label Holy
Holy Spells
*choice
*hide_reuse *selectable_if (Healingchoice = 1) and *selectable_if (mana >= 75) #Basic Healing Magic [+5 Healing][25]
*set Healing + 5
*set mana - 25
*set Healingchoice - 1
*gosub Holy
*hide_reuse *selectable_if (Healingchoice = 1) and *selectable_if (mana >= 75) #Advanced Healing Magic [+10 Healing][75]

Let me see if I can help…

Welcome Mage! It is time to choose which spells will aid you on your quest.

*if spell_type=1
    *temp healing_open true
    *temp healing_type 1
    *temp smite false
    *label Holy
    [b]Holy Spells[/b]
    
    Please select which spells you'd like to learn.
    *fake_choice
        *selectable_if ((healing_open) and (mana>=75)) #Basic Healing Magic [+5 Healing; costs 25 mana]
            *label healing_magic
            You have chosen @{(healing_type) Basic|Advanced} Healing Magic. This adds @{(healing_type) +5|+10} to your healing and costs @{healing_type 25|75} mana. Are you sure this is what you want to do?
            *fake_choice
                #Yes, I'm sure.
                    *temp mana_cost "@{(healing_type) 25|75}"
                    *temp healing_boost "@{(healing_type) 5|10}"
                    *set healing_open false
                    *set mana -(mana_cost)
                    *set healing +(healing_boost)
                    You feel a warm power run through your veins. You still have ${mana} mana left. Do you wish to learn more spells?

                    Your healing power is now ${healing}.
                    *fake_choice
                        #Yes, I do.
                            *page_break
                            *gosub Holy
                        #No, I'm done.
                            *finish
                #No, I'm not.
                    Very well. Please review the spells carefully.
                    *page_break
                    *gosub Holy
        *selectable_if ((healing_open) and (mana>75)) #Advanced Healing Magic [+10 Healing; costs 75 mana]
            *set healing_type 2
            *gosub healing_magic
        *selectable_if ((mana>75) and (smite=false)) #Holy Smite [+10 Ranged Attack; costs 75 mana]
            You have chosen Holy Smite. This adds +10 to your Ranged Attack and costs 75 mana. Are you sure this is what you want to do?
            *fake_choice
                #Yes, I'm sure.
                    *set mana -75
                    *set ranged +10
                    *set smite true
                    Power crackles down your arms and into your hands. You still have ${mana} left. Your Ranged Attack is now ${ranged}. 

                    Do you wish to learn more spells?

                    *fake_choice
                        #Yes, I do.
                            *page_break
                            *gosub Holy
                        #No, I'm done.
                            *finish
                #No, I'm not.
                    Very well. Please review the spells carefully.
                    *page_break
                    *gosub Holy
        #I'm done learning spells. 
            *finish
            
*finish

I removed the hide_reuse as it was causing issues if people decided against a spell. You don’t have temp variables for basic and advanced magic individually because those are combined under the healing_open variable.

This is from startup, btw.

*create spell_type 1
*comment 1=holy 2=earth 3=air 4=water
*create healing 10
*create mana 500
*create ranged 10

Looking at this there is some repetition. I trimmed it down on the advanced/basic healing bit, but I bet you could write it with some multireplaces so that you only need that list of choices once and every spell has a gosub to them.

Anyway. I hope this is helpful. I tested it out in CSIDE and it looks like it works.

Here is another way you can set it up. This might be even easier to handle.

Welcome Mage! It is time to choose which spells will aid you on your quest.

*if spell_type=1
    *temp healing_spells false
    *temp healing_type 1
    *temp smite false
    *temp spell_name ""
    *temp cost 0
    *temp boost 0
    *temp descr ""
    *label Holy
    *set spell_name ""
    *set cost 0
    *set boost 0
    *set descr ""
    [b]Holy Spells[/b]
    
    Please select which spells you'd like to learn.
    *fake_choice
        *selectable_if ((healing_spells=false) and (mana>=75)) #Basic Healing Magic [+5 Healing; costs 25 mana]
            *set spell_name "Basic Healing Magic"
            *set cost 25
            *set boost 5
            *set descr "Healing Skill"
            *gosub spell_choice
            Your ${descr} is now ${healing}.
            *set healing +(boost)
            *set healing_spells true
            *gosub spell_choice_two
        *selectable_if ((healing_spells=false) and (mana>75)) #Advanced Healing Magic [+10 Healing; costs 75 mana]
            *set spell_name "Advanced Healing Magic"
            *set cost 75
            *set boost 10
            *set descr "Healing Skill"
            *gosub spell_choice
            Your ${descr} is now ${healing}.
            *set healing +(boost)
            *set healing_spells true
            *gosub spell_choice_two
        *selectable_if ((mana>75) and (smite=false)) #Holy Smite [+10 Ranged Attack; costs 75 mana]
            *set spell_name "Holy Smite"
            *set cost 75
            *set boost 10
            *set descr "Ranged Attack"
            *gosub spell_choice
            Your ${descr} is now ${ranged}.
            *set smite true
            *set ranged +(boost)
            *gosub spell_choice_two
        #I'm done learning spells. 
            *finish

*label spell_choice
You have chosen ${spell_name}. This spell adds +${boost} to your ${descr} and costs ${cost} mana. 

Are you sure this is what you want to do?
*fake_choice
    #Yes, I'm sure.
        *set mana -(cost)
        Your body warms with power and knowledge.
        *return
        *label spell_choice_two
        You still have ${mana} mana left. Do you wish to learn more spells?
        *fake_choice
            #Yes, I do.
                *page_break
                *gosub Holy
            #No, I'm done.
                *finish
    #No, I'm not.
        Very well. Please review the spells carefully.
        *page_break
        *gosub Holy
*finish

thanks a ton! Either of these two setups should work great for my game :slight_smile: actually trimmed down even further since I don’t plan to have an ‘are you sure this is what you want?’ choice available

I put in the ‘are you sure’ because I know I’ve accidentally hit the wrong choice when reading a game on the bus/etc. But if you don’t need it, then you don’t need it. If you have questions about how/why I coded something, just hit me up and I’ll do my best to explain. Happy writing!