Hello!
I thought I would share the code on how I manage my super power system. I am doing this for three reasons:
- Too many of us fumble through things and only ask how to do things when we have no choice. I am looking to be proactive and show how I do things in hopes people can learn from it.
- To let others that want to make a hero game that has custom powers to use mine as a template if they wish
- To kind of show it off. I’m proud of it and am always wanting feedback on how I can make it better.
I would be glad to show other systems if anyone wants me to. Or to answer questions if anyone has them. I know some of what I do is confusing and looks like madness.
If you have code you are proud of and wish to show off, feel free to here! I enjoy learning different techniques in hopes of improving. In the end I hope that we all can learn and get better at this.
For background: In my game having a power does not mean you can always use it. There are times when the power cannot be used depending on choices or how the power is defined; so it could be available for some readers but not for others. So there is a difference between HasFlight and Flight. HasFlight shows the system that the character has the power while Flight shows the system that the power is available.
I am going to break it down as full lines of code below. Note that I am only showing the variables that are important for the code. No need for spoilers. I have … whenever I am cutting between lines of code.
startup.txt
*create implicit_control_flow true
*create WorldID 0
*create HeroStats false
...
*create StoryFocus "Catherine"
*create P1Strength 12
*create P1Stamina 12
*create P1Toughness 12
*create P1Reflex 12
*create P1Speed 12
*create P1Acuity 12
*create P1Forcefield 0
*create P1TelStrength 0
*create P1BlastStrength 0
*create P1Flight 0
*create P1PowerArmorStamina 0
*create P1MentalStamina 0
*create P1MaxStrength 12
*create P1MaxStamina 12
*create P1MaxToughness 12
*create P1MaxReflex 12
*create P1MaxSpeed 12
*create P1MaxAcuity 12
*create P1MaxFlight 1
*create P1MaxForcefield 1
*create P1MaxTelStrength 1
*create P1MaxBlastStrength 1
*create P1MaxMentalStamina 1
*create P1MaxPowerArmorStamina 1
*create P1Hero false
*create P1HeroStrength 24
*create P1HeroStamina 24
*create P1HeroToughness 24
*create P1HeroReflex 24
*create P1HeroSpeed 24
*create P1HeroAcuity 24
*create P1HeroForcefield 0
*create P1HeroTelStrength 0
*create P1HeroBlastStrength 0
*create P1HeroFlight 0
*create P1NormalStrength 12
*create P1NormalStamina 12
*create P1NormalToughness 12
*create P1NormalReflex 12
*create P1NormalSpeed 12
*create P1NormalAcuity 12
*create P1NormalForcefield 0
*create P1NormalTelStrength 0
*create P1NormalBlastStrength 0
*create P1NormalFlight 0
*create P1BaseStrength 12
*create P1BaseToughness 12
*create P1BaseStamina 12
*create P1BaseReflex 12
*create P1BaseSpeed 12
*create P1BaseAcuity 12
*create MaxStat 100
*create P1Deception 0
*create P1Deduction 0
*create P1Recollection 0
*create P1Diplomacy 0
*create P1Intimidation 0
*create P1Observation 0
*create P1Recovery 1
...
*create BlastType "energy"
*create BlastName "energy blast"
*create Ranged1 "NA"
*create Ranged2 "NA"
*create HealingPowers false
*create HasPowerArmor false
*create HasArtifact false
*create HasSuperTech false
*create HasSpells false
*create BulletProof false
*create BulletProofBone false
...
*create NoPowers true
...
*create PowerLock false
*create HasFlight false
*create HasTeleportation false
*create HasSwinging false
*create HasAcceleration false
*create HasHyperHearing false
*create HasHyperSmell false
*create HasXRay false
*create HasTelescopic false
*create HasDangerSense false
*create HasMindReading false
*create HasNightVision false
*create HasFutureSight false
*create HasForcefield false
*create HasHyperReflexes false
*create HasDurable false
*create HasInstincts false
*create HasTelekinesis false
*create HasSuperStrength false
*create HasHealing false
*create HasRegeneration false
*create HasFlightSpell false
*create HasTeleportationSpell false
*create HasSwingingSpell false
*create HasAccelerationSpell false
*create HasHyperHearingSpell false
*create HasXRaySpell false
*create HasTelescopicSpell false
*create HasDangerSenseSpell false
*create HasMindReadingSpell false
*create HasForcefieldSpell false
*create HasHyperReflexesSpell false
*create HasDurableSpell false
*create HasInstinctsSpell false
*create HasTelekinesisSpell false
*create HasSuperStrengthSpell false
*create HasHealingSpell false
*create HasRegenerationSpell false
*create HasNightVisionSpell false
*create HasFlightArtifact false
*create HasTeleportationArtifact false
*create HasAccelerationArtifact false
*create HasHyperHearingArtifact false
*create HasHyperSmellArtifact false
*create HasXRayArtifact false
*create HasTelescopicArtifact false
*create HasDangerSenseArtifact false
*create HasMindReadingArtifact false
*create HasForcefieldArtifact false
*create HasHyperReflexesArtifact false
*create HasDurableArtifact false
*create HasInstinctsArtifact false
*create HasTelekinesisArtifact false
*create HasSuperStrengthArtifact false
*create HasHealingArtifact false
*create HasRegenerationArtifact false
*create HasNightVisionArtifact false
*create HasFlightPowerArmor false
*create HasTeleportationPowerArmor false
*create HasSwingingPowerArmor false
*create HasAccelerationPowerArmor false
*create HasHyperHearingPowerArmor false
*create HasXRayPowerArmor false
*create HasTelescopicPowerArmor false
*create HasDangerSensePowerArmor false
*create HasMindReadingPowerArmor false
*create HasForcefieldPowerArmor false
*create HasHyperReflexesPowerArmor false
*create HasDurablePowerArmor false
*create HasInstinctsPowerArmor false
*create HasTelekinesisPowerArmor false
*create HasSuperStrengthPowerArmor false
*create HasHealingPowerArmor false
*create HasRegenerationPowerArmor false
*create HasNightVisionPowerArmor false
*create HasFlightSuperTech false
*create HasTeleportationSuperTech false
*create HasAccelerationSuperTech false
*create HasHyperHearingSuperTech false
*create HasHyperSmellSuperTech false
*create HasXRaySuperTech false
*create HasTelescopicSuperTech false
*create HasDangerSenseSuperTech false
*create HasMindReadingSuperTech false
*create HasForcefieldSuperTech false
*create HasHyperReflexesSuperTech false
*create HasDurableSuperTech false
*create HasInstinctsSuperTech false
*create HasTelekinesisSuperTech false
*create HasSuperStrengthSuperTech false
*create HasHealingSuperTech false
*create HasRegenerationSuperTech false
*create HasNightVisionSuperTech false
*create HasFlightRequiresMetal false
*create HasFlightRequiresEarth false
*create HasFlightDamagesArea false
*create HasAccelerationEnhanceOnly false
*create HasDurableMetalBody false
*create HasDurableStoneBody false
*create HasHealingOthersOnly false
*create HasHealingSelfOnly false
*create HasTeleportationLineOfSight false
*create HasFlightUseableUnderwater false
*create HasFlightUseableInSpace false
*create HasTeleportationUseableOnOthers false
*create HasTeleportationUseableAgainstOthers false
*create HasForcefieldAutomated false
*create HasDurableImmoveable false
*create HasTelekinesisManiplulation false
*create HasEndurance false
*create HasEnduranceSuperTech false
*create HasEndurancePowerArmor false
*create HasEnduranceSpell false
*create HasEnduranceArtifact false
*create HasFlightOnlyHero false
*create HasTeleportationOnlyHero false
*create HasSwingingOnlyHero false
*create HasAccelerationOnlyHero false
*create HasHyperHearingOnlyHero false
*create HasHyperSmellOnlyHero false
*create HasXRayOnlyHero false
*create HasTelescopicOnlyHero false
*create HasDangerSenseOnlyHero false
*create HasMindReadingOnlyHero false
*create HasForcefieldOnlyHero false
*create HasHyperReflexesOnlyHero false
*create HasDurableOnlyHero false
*create HasInstinctsOnlyHero false
*create HasTelekinesisOnlyHero false
*create HasSuperStrengthOnlyHero false
*create HasHealingOnlyHero false
*create HasRegenerationOnlyHero false
*create HasEnduranceOnlyHero false
*create HasNightVisionOnlyHero false
*create HasTelekinesisMetalOnly false
*create HasForcefieldMetalOnly false
*create HasForcefieldOnOthers false
*create HasBlast false
*create HasBlastPowerArmor false
*create HasBlastSpell false
*create HasBlastArtifact false
*create HasBlastSuperTech false
*create HasBlastOnlyHero false
*create HasBlastExplosion false
*create HasBlastBeam false
*create HasBlastEnergy false
*create HasBlastFire false
*create HasBlastLight false
*create HasBlastEyes false
*create HasFlightMental false
*create HasTeleportationMental false
*create HasAccelerationMental false
*create HasHyperHearingMental false
*create HasXRayMental false
*create HasTelescopicMental false
*create HasDangerSenseMental false
*create HasMindReadingMental false
*create HasForcefieldMental false
*create HasHyperReflexesMental false
*create HasDurableMental false
*create HasInstinctsMental false
*create HasTelekinesisMental false
*create HasSuperStrengthMental false
*create HasHealingMental false
*create HasRegenerationMental false
*create HasEnduranceMental false
*create HasBlastMental false
*create HasNightVisionMental false
*create HasMagic false
*create HasDurableLevel 1
*create HasAccelerationLevel 1
*create HasSuperStrengthLevel 1
*create HasTelekinesisLevel 1
*create HasHealingLevel 1
*create HasForcefieldLevel 1
*create HasHyperReflexesLevel 1
*create HasEnduranceLevel 1
*create HasFlightLevel 1
*create HasBlastLevel 1
*create HasRegenerationLevel 1
*create ArtifactType "Magical Artifact"
*create PowerArmorType "Power Armor"
...
*create Acceleration false
*create HyperHearing false
*create XRay false
*create Telescopic false
*create DangerSense false
*create MindReading false
*create NightVision false
*create Forcefield false
*create HyperReflexes false
*create Durable false
*create Instincts false
*create Telekinesis false
*create SuperStrength false
*create Healing false
*create HealingOthers false
*create HealingSelf false
*create Regeneration false
*create Teleportation false
*create Endurance false
*create Flight false
*create EyeBeams false
*create HeatVision false
*create LaserVision false
*create GrappleGun false
*create BasicFlight false
*create EarthFlight false
*create WaterFlight false
*create SpaceFlight false
*create Immoveable false
*create StoneBody false
*create MetalBody false
*create TelekinesisMelee false
*create StandardTelekinesis false
*create Ferrokinesis false
*create AutomatedForcefield false
*create Blast false
*create Explosion false
*create Beam false
*create EnergyBlast false
*create FireBlast false
*create LightBlast false
*create ForcefieldOthers false
*create Magic false
10 Likes
My first post was too long for the system so I’m splitting this into parts.
The next is the actual power creation system.
CharacterCreation.txt
*temp LookingAt "None"
*temp Cati "NA"
*temp TestingNote ""
*temp PowerArmorOption false
*temp HasNone false
*temp HasNoneOnlyHero false
*temp HasNoneInherent false
*temp HasInherent false
*temp HasLevels false
*temp HasFlaws false
*temp HasStrengths false
*temp PowerName ""
*comment Some of these temp variables are just to make sure that QuickTest does not give errors.
*comment First step is for readers that want to add more powers then what was made available in the story. This allows a quick selection of powers without going into all of the details like later on.
*label Premades
[i]-What kind of hero is ${P1Name}?-
[i]-The following are power packs that can be used to quickly put a powerset together.-
*comment These options select the package name, later the code add the powers.
*fake_choice
#A Blaster
[i]A Blaster is ready to deal with enemies from a distance, shooting them with blasts of energy. Different energy types are selectable under [/i]Fully Customize Powers[i].
*set Premade "add Blaster"
#A Speedster
[i]Speed Heroes are known for doing things fast. Between enhanced reflexes and running speed few can catch them.
*set Premade "add Speed"
#A Strongman
[i]Strongmen are known for being strong and can punch like a truck.
*set Premade "add Strength"
#A Brick
[i]Bricks are known for taking a lot of damage before they will let their enemies take them down.
*set Premade "add Brick"
#A Mentist
[i]Mentists like to have everything under control. Using the power of their mind they are able to read surface thoughts, move objects, and generate psychic barriers. Mind over matter is the motto they live by.
*set Premade "add Mind"
#A Flier
[i]Flying heroes take to the air from either magic, power armors, or their natural gifts.
*set Premade "add Flight"
#A Survivor
[i]Suvivors continue living through some of the toughest punishment. They are often tough and have a healing factor.
*set Premade "add Survivior"
#A Combat Scion
[i]Combat Sions have inate abilities to understand the battlefield around them, often knowing of danager before it strikes.
*set Premade "add Scion"
#Clear all Powers
*set Premade "remove all"
*comment Fully customize allows for more details to be selected
#Fully Customize Powers
*set Premade "Custom"
*goto QuickTyping
*comment Send reader back to the story without going into more details.
#Continue the Story
*set Premade "Finish"
*goto QuickTyping
*comment The following applies actual packages.
*label ConfirmPremade
[i]Are you sure you want to ${Premade} powers for ${P1Name}?
*fake_choice
#Yes
*if Premade = "add Blaster"
*set HasBlast true
*if Premade = "add Speed"
*set HasAcceleration true
*set HasAccelerationLevel 2
*set HasHyperReflexes true
*set HasHyperReflexesLevel 2
*if Premade = "add Strength"
*set HasSuperStrength true
*set HasSuperStrengthLevel 2
*if Premade = "add Brick"
*set HasDurable true
*set HasDurableLevel 2
*if Premade = "add Mind"
*set HasFlight true
*set HasFlightUseableUnderwater true
*set HasFlightUseableInSpace true
*set HasFlightMental true
*set HasMindReading true
*set HasForcefield true
*set HasForcefieldLevel 2
*set HasForcefieldMental true
*set HasTelekinesis true
*set HasTelekinesisLevel 2
*set HasTelekinesisMental true
*if Premade = "add Flight"
*set HasFlight true
*set HasFlightLevel 2
*if Premade = "add Survivior"
*set HasRegeneration true
*set P1Recovery 3
*if Premade = "add Scion"
*set HasDangerSense true
*set HasInstincts true
*if Premade = "remove all"
*set HasDangerSense false
*set HasInstincts false
*set HasRegeneration false
*set P1Recovery 1
*set HasFlight false
*set HasFlightLevel 1
*set HasFlight false
*set HasFlightUseableUnderwater false
*set HasFlightUseableInSpace false
*set HasMindReading false
*set HasForcefield false
*set HasForcefieldLevel 1
*set HasTelekinesis false
*set HasTelekinesisLevel 1
*set HasDurable false
*set HasDurableLevel 1
*set HasSuperStrength false
*set HasSuperStrengthLevel 1
*set HasAcceleration false
*set HasAccelerationLevel 1
*set HasHyperReflexes false
*set HasHyperReflexesLevel 1
*set HasBlast false
*set HasBlastSpell false
#No
*set Premade "NA"
*goto Premades
*comment The following allows reader to quickly make all powers come from a power armor or magic
*label QuickTyping
*comment Redirects if the reader wants to go into more details
*if (Premade = "Custom")
*goto CustomizePowers
*comment Checks if the character has power armor as their costume. If not it skips power armor.
*if not(HasPowerArmor)
*goto PASkip
[i]-Are all of $!{P1Name}'s powers part of a power armor?
*fake_choice
#All abilities are part of a power armor
*set PowerArmorType "full body power armor"
*set HasDangerSensePowerArmor true
*set HasInstinctsPowerArmor true
*set HasRegenerationPowerArmor true
*set HasFlightPowerArmor true
*set HasMindReadingPowerArmor true
*set HasForcefieldPowerArmor true
*set HasTelekinesisPowerArmor true
*set HasDurablePowerArmor true
*set HasSuperStrengthPowerArmor true
*set HasAccelerationPowerArmor true
*set HasHyperReflexesPowerArmor true
*set HasBlastPowerArmor true
*set PowerArmorOption true
*goto Compile
#Abilities are not from a power armor
*comment Check if all powers are from magic.
*label PASkip
[i]-Are all of $!{P1Name}'s powers from magic?
*fake_choice
#All abilities are spells
*set HasSpells true
*set HasDangerSenseSpell true
*set HasInstinctsSpell true
*set HasRegenerationSpell true
*set HasFlightSpell true
*set HasMindReadingSpell true
*set HasForcefieldSpell true
*set HasTelekinesisSpell true
*set HasDurableSpell true
*set HasSuperStrengthSpell true
*set HasAccelerationSpell true
*set HasHyperReflexesSpell true
*set HasBlastSpell true
#The abilities are not from spells
*goto Compile
*comment ///////////////////////////////////////////////////////////////////
*comment ////////////Start of the power creation system/////////////////////
*label CustomizePowers
[i]-The character's powers are divided into four categories. Movement, Sensory, Offense, and Defense. You are free to maximize any power if it fits your vision of the character.
[i]If you have decided that some of your abilities come from a power armor or object, you need to change the power from Inherent to the desired power origin.-[/i]
*page_break To Power Creation
*label MainPage
*label MainMenu
*comment I have divided powers into different sections. All sections use the same modular menu as detailed below.
*comment Cati is the variable that is used to track which menu to move back to later after reader is done customizing a power.
Which powers would you like to select?
*choice
#Movement
*set Cati "Movement"
*goto MovementPowers
#Sensory
*set Cati "Sensory"
*goto SensoryPowers
#Defensive
*set Cati "Defense"
*goto DefensePowers
#Offensive
*set Cati "Offense"
*goto OffensePowers
#Miscellaneous
*set Cati "Misc"
*goto MiscPowers
#Done With Powers/Finalize Character
*goto Compile
*comment //////////////////////////////////////////////////////////////////////
*comment ////////////Entering hte customizing menu section.///////////////////
*label PowerSelection
[i]-$!{LookingAt}-[/i]
*line_break
[i]-How would you like to modify this power?-[/i]
*comment This step uses the variable 'LookingAt' to know which power we are specifically modifying.
*comment First give a description of the powers. All descriptions are here.
*if LookingAt = "Flight"
[i]-With flight you can take to the air making a lot of barriers non-issues.
*line_break
Commonly chosen Flaws could include:
*line_break
Propulsion Damages Area - for heroes that have thrusters that leave a lot of fiery damage in their wake.
*line_break
Only When Wearing Metal - meaning that your flight is caused by your ability to control ferromagnetic metals.
[i]Commonly chosen Strengths include:
*line_break
Useable Underwater – The force that allows for your flight allows you to move through water just as easily.
*line_break
Useable Without Atmosphere – Your ability to fly is not reliant on having air to provide thrust and is truly gravity defying.
*if LookingAt = "Acceleration"
[i]Often called Super Speed, Accelerated Movement allows the user to move faster than most would expect. At the current level your speed stat will increase ${HasAccelerationLevel+1} fold.
*if LookingAt = "HyperHearing"
[i]The character’s acute sense of hearing allows them to pick of near by faint noises or distant cries. They can hear twice as far as most people.
*if LookingAt = "XRay"
[i]The character can see through most objects as needed. Some materials may still show as opaque.
*if LookingAt = "Telescopic"
[i]All the character’s senses can reach out farther. Providing a 40/20 vision. This will stack with the benefits of other powers like hyper hearing or x-ray vision.
*if LookingAt = "DangerSense"
[i]A sixth sense that provides a warning that there is danger nearby. This ability is not always effective, and the user is not able to distinguish what the source of the danger is.
*if LookingAt = "MindReading"
[i]Mind reading allows for the reading of surface thoughts. The user can pick up on thoughts as their target thinks them, but they are unable to go deeper. They can not grab memories or thoughts that are not currently held or subconscious thoughts.
*if LookingAt = "Forcefield"
[i]Forcefield users can channel a near invisible barrier that goes about six inches from the body. The barrier’s toughness can range from leather toughness to small caliber bulletproof depending on different factors. It will protect held objects and can be used to hold oxygen.
*line_break
Common chosen Flaw(s) include:
*line_break
Only Works on Metal - With Flaw allows for a barrier that only works on magnetic metals.
[i]Common chosen Strength(s) include:
*line_break
Automatically Defends – Normally a forcefield needs to be actively turns one either through a spell incantation or active thought. With this Strength it will turn on and protect ${P1Name} once the body has identified a threat.
*line_break
Useable on Others - This allows forcefields to protect [/i]willing[i] targets in addition to ${P1Name}.
*if LookingAt = "HyperReflexes"
[i]The user’s reflexes are placed in overdrive. The character’s Reflex value will be lifted ${HasHyperReflexesLevel+1} fold at the current rank.
*if LookingAt = "Durable"
[i]The user has some force that adds defense making it harder to hard with force. This could be a natural tougher skin and bones, a magical field, or armor. High enough toughness may result in bulletproof defenses.
*line_break
Common chosen Flaw(s) include:
*line_break
Body Becomes A Ferromagnetic Metal – With this Flaw the skin is coated with a magnetic metal while the power is activated.
*line_break
Body Becomes Stone – With this Flaw the skin hardens to a mixture of dense carbon and granite. While it provides additional levels of protection it is brittle. Anything that breaks the defenses could result in heavier injuries.
[i]Common chosen Strength(s) include:
*line_break
Near Immoveable – This Strength make the user harder to move from impacts proportional to their Toughness value. Higher values make the user field line a brick wall on impact. This could cause enemies to injure themselves with attacking.
*if LookingAt = "Instincts"
[i]The user is a natural in combat. As if working on an extra sense they are better aware of their enemy’s moments and intentions. This allows some attacks to be better predicted and counters to be better placed.
*if LookingAt = "SuperStrength"
[i]Enhanced strength greatly increases lifting capacity and striking power. It does not affect the durability or stamina of the character. At the current rank the Strength score will be lifted ${HasSuperStrengthLevel + 1} fold.
*if LookingAt = "Telekinesis"
[i]Telekinesis, the ability to control objects with your mind.
*line_break
Common chosen Flaw(s) include:
*line_break
Can Only Move Metal– This limit turns their telekinesis into ferrokinesis. The power becomes limited to ferromagnetic metals but would otherwise function the same.
*if LookingAt = "Blast"
[i]The ability to shoot energy as if it is a physical force. Characters with blasts will often attack from a distance using their energy to defeat their enemies.
*line_break
Common chosen Flaw(s) include:
*line_break
Obtical Blast - This Flaw changes the origin from the hands to the eye sockets.
*if LookingAt = "Healing"
[i]The ability to quickly seal wounds and recover injury for yourself and others. This requires active concentration. The effectiveness to heal has diminished returns per injury. After several minutes improvement becomes increasingly negligible. Use of this power requires contact with the local area of the injury.
*line_break
Common chosen Flaw(s) include:
*line_break
Can Only Heal Others – This Flaw prevents the character from using their healing powers on their own injuries.
*line_break
Can Only Heal Self – This Flaw limits healing to only the character’s injuries. They are not able to heal others.
*if LookingAt = "Regeneration"
[i]Often called a 'Healing Factor', regeneration is the bodies ability to heal itself. While this does not allow for the regrowth of limbs, it does allow broken bones to mend relatively faster. Normally a minor sprained ankle would take approximately 14 days to heal. With this recovery time would be approximately ${round(14/(HasRegenerationLevel+1))} day(s).
*if LookingAt = "Endurance"
[i]Enhanced Endurance grants stamina to go longer periods of time without tiring.
*comment Next the code will check if the selected power has different aspects like 'Levels', 'strengths', and 'flaws'
*comment A techique I often do is to turn something off/on immidately and then later check for things to turn it back on/off. Saves lines of code instead of writing how each condition modifies things.
*set HasLevels false
*set HasFlaws false
*set HasStrengths false
*if LookingAt = "SuperStrength"
*set HasLevels true
*if LookingAt = "Blast"
*set HasLevels true
*set HasFlaws true
*if LookingAt = "Durable"
*set HasLevels true
*set HasFlaws true
*set HasStrengths true
*if LookingAt = "Regeneration"
*set HasLevels true
*if LookingAt = "Acceleration"
*set HasLevels true
*if LookingAt = "Telekinesis"
*set HasLevels true
*set HasFlaws true
*if LookingAt = "Healing"
*set HasLevels true
*set HasFlaws true
*if LookingAt = "Forcefield"
*set HasLevels true
*set HasStrengths true
*if LookingAt = "HyperReflexes"
*set HasLevels true
*if LookingAt = "Endurance"
*set HasLevels true
*if LookingAt = "Flight"
*set HasLevels true
*set HasStrengths true
*set HasFlaws true
*comment //////////////////////////////////////////////////////////
*comment ///////////// The Modular Menu for all powers ///////////
*label Details
*fake_choice
*comment This code checks if the power is turned on. Ex. If the character has flight HasFlight will be true.
*comment I make heavy use of { } to let the system know that I am turning a string into a variable name.
*comment Everything in the quotations are letters that never change in the string. Then the variable 'LookingAt' hold the next part of the variable name. The & tells the system to combine then into one name.
*comment Ex. If LookingAt = "Flight" then this first part reads HasFlight to be the variable to look up
*if not({"Has"&LookingAt})
#Aquire this power
*set {"Has"&LookingAt} true
*if {"Has"&LookingAt}
#Remove this power
*set {"Has"&LookingAt} false
*comment HasLevels is turned on in the section above
*if HasLevels
*selectable_if ({("Has"&LookingAt)&"Level"} <= 2) #Lift Rank (Rank: ${{("Has"&LookingAt)&"Level"}})
*set {("Has"&LookingAt)&"Level"} +1
*goto PowerSelection
*selectable_if ({("Has"&LookingAt)&"Level"} >= 2) #Lower Rank (Rank: ${{("Has"&LookingAt)&"Level"}})
*set {("Has"&LookingAt)&"Level"} -1
*goto PowerSelection
*comment This section looks at specific variables to see the power origin. Then it displays the stats of that origin and give the option to change it.
*comment Ex. Flight that is from a power armor would be HasFlightPowerArmor. Then would display the "#Power Comes From a Power Armor: Change" section
*if (not({("Has"&LookingAt)&"PowerArmor"}) and not({("Has"&LookingAt)&"Spell"})) and not({("Has"&LookingAt)&"Mental"})
#Power is Inherent: Change
*goto ChangeOrigin
*if {("Has"&LookingAt)&"Spell"}
#Power Comes From Magic: Change
*goto ChangeOrigin
*if {("Has"&LookingAt)&"PowerArmor"}
#Power Comes From a Power Armor: Change
*goto ChangeOrigin
*if {("Has"&LookingAt)&"Mental"}
#Power Is A Mental Ability: Change
*goto ChangeOrigin
*comment This part is only for the ability Blast
*if LookingAt = "Blast"
#Blast Type: $!{BlastType}: Change
What kind of blast does ${P1Name} have?
*fake_choice
#Energy
*set BlastType "energy"
*set HasBlastFire false
*set HasBlastEnergy true
*set HasBlastLight false
#Heat
*set BlastType "heat"
*set HasBlastFire true
*set HasBlastEnergy false
*set HasBlastLight false
#Light
*set BlastType "Light"
*set HasBlastFire false
*set HasBlastEnergy false
*set HasBlastLight true
*comment HasFlaws is defined in the section before the modular menu
*selectable_if (HasFlaws) #Set a Flaw
*label FlawLoop
*comment This section displays different options depending on which power the reader has selected
*fake_choice
*if LookingAt = "Flight"
#Only When Wearing Metal: @{(HasFlightRequiresMetal) On|Off}: Change
*if HasFlightRequiresMetal
*set HasFlightRequiresMetal false
*else
*set HasFlightRequiresMetal true
*goto FlawLoop
#Propulsion Damages Area: @{(HasFlightDamagesArea) On|Off}: Change
*if HasFlightDamagesArea
*set HasFlightDamagesArea false
*else
*set HasFlightDamagesArea true
*goto FlawLoop
*if LookingAt = "Durable"
*selectable_if (not(HasDurableStoneBody)) #Body Becomes A Ferromagnetic Metal: @{(HasDurableMetalBody) On|Off}: Change
*if HasDurableMetalBody
*set HasDurableMetalBody false
*else
*set HasDurableMetalBody true
*goto FlawLoop
*selectable_if (not(HasDurableMetalBody)) #Body Becomes Stone: @{(HasDurableStoneBody) On|Off}: Change
*if HasDurableStoneBody
*set HasDurableStoneBody false
*else
*set HasDurableStoneBody true
*goto FlawLoop
*if LookingAt = "Blast"
#Obtical Blast: @{(HasBlastEyes) On|Off}: Change
*if HasBlastEyes
*set HasBlastEyes false
*else
*set HasBlastEyes true
*goto FlawLoop
*if LookingAt = "Healing"
*selectable_if(not(HasHealingSelfOnly)) #Can Only Heal Others: @{(HasHealingOthersOnly) On|Off}: Change
*if HasHealingOthersOnly
*set HasHealingOthersOnly false
*else
*set HasHealingOthersOnly true
*goto FlawLoop
*selectable_if(not(HasHealingOthersOnly)) #Can Only Heal Self: @{(HasHealingSelfOnly) On|Off}: Change
*if HasHealingSelfOnly
*set HasHealingSelfOnly false
*else
*set HasHealingSelfOnly true
*goto FlawLoop
*if (LookingAt = "Telekinesis")
#Only Works on Metal: @{(HasTelekinesisMetalOnly) On|Off}: Change
*if HasTelekinesisMetalOnly
*set HasTelekinesisMetalOnly false
*else
HasTelekinesisMetalOnly true
*goto FlawLoop
#Done with flaws
*goto PowerSelection
*comment HasStrengths is defined before the modular menu
*selectable_if (HasStrengths) #Set a Strength
*label StrengthLoop
*fake_choice
*if LookingAt = "Flight"
#Useable Underwater: @{(HasFlightUseableUnderwater) On|Off}: Change
*if HasFlightUseableUnderwater
*set HasFlightUseableUnderwater false
*else
*set HasFlightUseableUnderwater true
*goto StrengthLoop
#Useable Without Atmosphere: @{(HasFlightUseableInSpace) On|Off}: Change
*if HasFlightUseableInSpace
*set HasFlightUseableInSpace false
*else
*set HasFlightUseableInSpace true
*goto StrengthLoop
*if LookingAt = "Forcefield"
#Automatically Defends: @{(HasForcefieldAutomated) On|Off}: Change
*if HasForcefieldAutomated
*set HasForcefieldAutomated false
*else
*set HasForcefieldAutomated true
#Useable on Others: @{(HasForcefieldOnOthers) On|Off}: Change
*if HasForcefieldOnOthers
*set HasForcefieldOnOthers false
*else
*set HasForcefieldOnOthers true
*goto StrengthLoop
*if LookingAt = "Durable"
#Near Immoveable: @{(HasDurableImmoveable) On|Off}: Change
*if HasDurableImmoveable
*set HasDurableImmoveable false
*else
*set HasDurableImmoveable true
*goto StrengthLoop
*if LookingAt = "Telekinesis"
#Acute Manipulation: @{(HasTelekinesisManiplulation) On|Off}: Change
*if HasTelekinesisManiplulation
*set HasTelekinesisManiplulation false
*else
*set HasTelekinesisManiplulation true
*goto StrengthLoop
#Done with Strengths
*goto PowerSelection
*comment Cati was defined when selecting which catigory of power. IE Offensive, Defensive, Movement, etc
#I am done with this power
*goto {Cati&"Powers"}
*goto PowerSelection
*comment The following is the coding for changing the source of the power.
*label ChangeOrigin
[i]-Powers can come from different sources.-
[i]-Inherent powers are natural to the character. They are as much a part of them as an arm.
[i]-Spells are powers that come from incantations and magic. Anything that disrupts magic, will stop these powers.
*if PowerArmorOption
[i]-Powers coming from power armors will not be available when ${P1Name} is not in their armor.
[i]-Mental powers are psychic based abilities. Anything that hampers the ability to focus or messes with psychic powers will stop these powers.
*fake_choice
#Set power to Inherent
*set {("Has"&LookingAt)&"PowerArmor"} false
*set {("Has"&LookingAt)&"Spell"} false
*set {("Has"&LookingAt)&"Mental"} false
*goto PowerSelection
#Set power to require a spell
*set {("Has"&LookingAt)&"PowerArmor"} false
*set {("Has"&LookingAt)&"Spell"} true
*set {("Has"&LookingAt)&"Mental"} false
*goto PowerSelection
*if PowerArmorOption
#Power comes from a Power Armor
*set {("Has"&LookingAt)&"PowerArmor"} true
*set {("Has"&LookingAt)&"Spell"} false
*set {("Has"&LookingAt)&"Mental"} false
*goto PowerSelection
#Is a mental ability
*set {("Has"&LookingAt)&"PowerArmor"} false
*set {("Has"&LookingAt)&"Spell"} false
*set {("Has"&LookingAt)&"Mental"} true
*goto PowerSelection
*comment ///////////////////////////////////////////////////////////////////////////////
*comment ////////////// Entering the Power Catigory menus /////////////////////////////
*comment The following are the sub menus that powers are divided into. All of them define what 'LookingAt' is before moving to the Modular Menu above.
*label MovementPowers
[i]-Movement powers will dictate how your character travels around most often.
*fake_choice
#Super Speed: @{HasAcceleration Aquired|Does not have}: Change
*set LookingAt "Acceleration"
*selectable_if (not(P1Fear = "Heights")) #Flight: @{HasFlight Aquired|Does not have}: Change
*set LookingAt "Flight"
#Done With Movement
*goto MainPage
*goto PowerSelection
*label SensoryPowers
[i]-Your character's ability to be aware of the world around them. Enhanced senses may cause your character to be aware of things others are not.-[/i]
*fake_choice
#Hyper Hearing: @{HasHyperHearing Aquired|Does not have}: Change
*set LookingAt "HyperHearing"
#X-Ray Vision: @{HasXRay Aquired|Does not have}: Change
*set LookingAt "XRay"
#Telescopic Senses: @{HasTelescopic Aquired|Does not have}: Change
*set LookingAt "Telescopic"
#Danger Sense: @{HasDangerSense Aquired|Does not have}: Change
*set LookingAt "DangerSense"
#Mind Reading: @{HasMindReading Aquired|Does not have}: Change
*set LookingAt "MindReading"
#Done With Senses
*goto MainPage
*goto PowerSelection
*label DefensePowers
[i]-Defensive powers are powers that would allow your character to actively stay in combat and protect your character from harm.-[/i]
*fake_choice
#Forcefield: @{HasForcefield Aquired|Does not have}: Change
*set LookingAt "Forcefield"
#Hyper Reflexes: @{HasHyperReflexes Aquired|Does not have}: Change
*set LookingAt "HyperReflexes"
#Super Toughness: @{HasDurable Aquired|Does not have}: Change
*set LookingAt "Durable"
#Combat Instincts: @{HasInstincts Aquired|Does not have}: Change
*set LookingAt "Instincts"
#Back to Power Menu
*goto MainMenu
*goto PowerSelection
*label OffensePowers
[i]-Offensive powers are used when attacking opponents.
*fake_choice
#Super Strength: @{HasSuperStrength Aquired|Does not have}: Change
*set LookingAt "SuperStrength"
#Telekinesis: @{HasTelekinesis Aquired|Does not have}: Change
*set LookingAt "Telekinesis"
#Energy Blast: @{HasBlast Aquired|Does not have}: Change
*set LookingAt "Blast"
#Back to Power Menu
*goto MainMenu
*goto PowerSelection
*label MiscPowers
[i]-Miscellaneous powers are powers that do not fit into other categories.
*fake_choice
#Healing: @{HasHealing Aquired|Does not have}: Change
*set LookingAt "Healing"
#Regeneration: @{HasRegeneration Aquired|Does not have}: Change
*set LookingAt "Regeneration"
#Enhanced Endurance: @{HasEndurance Aquired|Does not have}: Change
*set LookingAt "Endurance"
#Back to Power Menu
*goto MainMenu
*goto PowerSelection
*comment /////////////////////////////////////////////////////////////
*comment ///////// Entering the ending part of code /////////////////
*comment The following complies what powers are actually active and does some clean up to make quick refrences to powers faster throughout the story.
*label Compile
*comment P1Recovery is a stat that the character always has. It judges how much healing is done within an hour. Taking Regeneration lifts this value so injuries heal faster
*if HasRegeneration
*set P1Recovery 1 + HasRegenerationLevel
*comment First step I define the PowerName as "Endurance". PowerName will be changed below as I have the system loop and check for every power name one by one.
*set PowerName "Endurance"
*label ChangeName
*comment OnlyHero is a quick term I use for when the power can only be used in their heroic identity.
*comment This part of the code also check so I the system will know if the character knows magic or has a power armor
*if ({("Has"&PowerName)&"PowerArmor"})
*set {("Has"&PowerName)&"OnlyHero"} true
*set HasPowerArmor
*if ({("Has"&PowerName)&"Artifact"})
*set {("Has"&PowerName)&"OnlyHero"} true
*if ({("Has"&PowerName)&"Spell"})
*set HasSpells true
*comment This part of the code is to switch PowerName to the different powers befor looping back.
*comment It starts at the bottom and works its way up to avoid the code from switching PowerName without checking it.
*comment I loop it at the end instead of it all instead of right after defining PowerName to save on lines of code. Why constantly tell it to *goto ChangeName when I can do it once and it works the same?
*if PowerName = "Blast"
*return
*if PowerName = "Flight"
*set PowerName "Blast"
*if PowerName = "Acceleration"
*set PowerName "Flight"
*if PowerName = "HyperHearing"
*set PowerName "Acceleration"
*if PowerName = "XRay"
*set PowerName "HyperHearing"
*if PowerName = "Telescopic"
*set PowerName "XRay"
*if PowerName = "DangerSense"
*set PowerName "Telescopic"
*if PowerName = "MindReading"
*set PowerName "DangerSense"
*if PowerName = "NightVision"
*set PowerName "MindReading"
*if PowerName = "Forcefield"
*set PowerName "NightVision"
*if PowerName = "HyperReflexes"
*set PowerName "Forcefield"
*if PowerName = "Durable"
*set PowerName "HyperReflexes"
*if PowerName = "Instincts"
*set PowerName "Durable"
*if PowerName = "Telekinesis"
*set PowerName "Instincts"
*if PowerName = "SuperStrength"
*set PowerName "Telekinesis"
*if PowerName = "Healing"
*set PowerName "SuperStrength"
*if PowerName = "Regeneration"
*set PowerName "Healing"
*if PowerName = "Endurance"
*set PowerName "Regeneration"
*goto ChangeName
*return
4 Likes
Last part is the code that turns powers on and off.
PowerCheck.txt
*temp PowerName "Teleportation"
*comment First Step is to set up which stats the game will use in this Identity
*if P1Hero
*set P1Strength P1HeroStrength
*set P1MaxStrength P1HeroStrength
*set P1Stamina P1HeroStamina
*set P1MaxStamina P1HeroStamina
*set P1Toughness P1HeroToughness
*set P1MaxToughness P1HeroToughness
*set P1Reflex P1HeroReflex
*set P1MaxReflex P1HeroReflex
*set P1Speed P1HeroSpeed
*set P1MaxSpeed P1HeroSpeed
*set P1Acuity P1HeroAcuity
*set P1MaxAcuity P1HeroAcuity
*else
*set P1Strength P1NormalStrength
*set P1MaxStrength P1NormalStrength
*set P1Stamina P1NormalStamina
*set P1MaxStamina P1NormalStamina
*set P1Toughness P1NormalToughness
*set P1MaxToughness P1NormalToughness
*set P1Reflex P1NormalReflex
*set P1MaxReflex P1NormalReflex
*set P1Speed P1NormalSpeed
*set P1MaxSpeed P1NormalSpeed
*set P1Acuity P1NormalAcuity
*set P1MaxAcuity P1NormalAcuity
*comment Next I make sure changing stats do not cause them to go over their maximum value
*if P1Stamina >= P1MaxStamina
*set P1Stamina P1MaxStamina
*if P1PowerArmorStamina >= P1MaxPowerArmorStamina
*set P1PowerArmorStamina P1MaxPowerArmorStamina
*if P1MentalStamina >= P1MaxMentalStamina
*set P1MentalStamina P1MaxMentalStamina
*comment StatsReset adjusts stats based on injuries and exhaution
*gosub_scene StatsReset
*comment This code turns all powers off to have a clean slate
*set Acceleration false
*set HyperHearing false
*set XRay false
*set Telescopic false
*set DangerSense false
*set MindReading false
*set NightVision false
*set Forcefield false
*set HyperReflexes false
*set Durable false
*set Instincts false
*set Telekinesis false
*set SuperStrength false
*set Healing false
*set HealingOthers false
*set HealingSelf false
*set Regeneration false
*set Teleportation false
*set Endurance false
*set Flight false
*set EyeBeams false
*set HeatVision false
*set LaserVision false
*set GrappleGun false
*set BasicFlight false
*set EarthFlight false
*set WaterFlight false
*set SpaceFlight false
*set Immoveable false
*set AutomatedForcefield false
*set StoneBody false
*set MetalBody false
*set Blast false
*set Explosion false
*set Beam false
*set EnergyBlast false
*set FireBlast false
*set LightBlast false
*set ForcefieldOthers false
*comment This loop checks if a power should be turned back on depending on what is currently happening in the story
*label PowerCheckLoop
*if {"Has"&PowerName}
*set {PowerName} true
*if ({("Has"&PowerName)&"OnlyHero"}) and not(P1Hero)
*goto SetFalse
*if ({("Has"&PowerName)&"PowerArmor"}) and PowerArmorLock
*goto SetFalse
*if ({("Has"&PowerName)&"SuperTech"}) and SuperTechLock
*goto SetFalse
*if ({("Has"&PowerName)&"Artifact"}) and ArtifactLock
*goto SetFalse
*if ({("Has"&PowerName)&"Spell"}) and SpellLock
*goto SetFalse
*if (PowerName = "Flight") and (HasFlightRequiresMetal and MetalLock)
*goto SetFalse
*if (PowerName = "Forcefield") and (HasForcefieldMetalOnly and MetalLock)
*goto SetFalse
*if (PowerName = "Telekinesis") and (HasTelekinesisMetalOnly and MetalLock)
*goto SetFalse
*goto ChangeName
*comment This code switches PowerName tot eh different powers to check. It works from the bottom and works its way up
*label SetFalse
*set {PowerName} false
*label ChangeName
*if PowerName = "Blast"
*goto Details
*if PowerName = "Swinging"
*set PowerName "Blast"
*if PowerName = "Flight"
*set PowerName "Swinging"
*if PowerName = "Acceleration"
*set PowerName "Flight"
*if PowerName = "HyperHearing"
*set PowerName "Acceleration"
*if PowerName = "HyperSmell"
*set PowerName "HyperHearing"
*if PowerName = "XRay"
*set PowerName "HyperSmell"
*if PowerName = "Telescopic"
*set PowerName "XRay"
*if PowerName = "DangerSense"
*set PowerName "Telescopic"
*if PowerName = "MindReading"
*set PowerName "DangerSense"
*if PowerName = "NightVision"
*set PowerName "MindReading"
*if PowerName = "Forcefield"
*set PowerName "NightVision"
*if PowerName = "HyperReflexes"
*set PowerName "Forcefield"
*if PowerName = "Durable"
*set PowerName "HyperReflexes"
*if PowerName = "Instincts"
*set PowerName "Durable"
*if PowerName = "Telekinesis"
*set PowerName "Instincts"
*if PowerName = "SuperStrength"
*set PowerName "Telekinesis"
*if PowerName = "Healing"
*set PowerName "SuperStrength"
*if PowerName = "Regeneration"
*set PowerName "Healing"
*if PowerName = "Endurance"
*set PowerName "Regeneration"
*if PowerName = "Teleportation"
*set PowerName "Endurance"
*goto PowerCheckLoop
*comment //////////////////////////////
*comment //////Turning on Details
*comment This section looks to see if specific versions of abilities are available or generate special conditions for the MC
*label Details
*set EyeBeams false
*set HeatVision false
*set LaserVision false
*if Blast and HasBlastFire
*set FireBlast true
*if HasBlastEyes
*set EyeBeams true
*set HeatVision true
*set FireBlast false
*if Blast and HasBlastLight
*set LightBlast true
*if HasBlastEyes
*set EyeBeams true
*set LaserVision true
*set LightBlast false
*if Blast and HasBlastEnergy
*set EnergyBlast true
*if HasBlastEyes
*set EyeBeams true
*set EnergyBlast false
*set Immoveable false
*if HasDurableImmoveable and Durable
*set Immoveable true
*set Bulletproof false
*set BulletProofBone false
*if (P1MaxToughness >= 50)
*set BulletProofBone true
*if Durable and HasDurableStoneBody
*set StoneBody true
*if BulletProofBone
*set BulletProof true
*if Durable and HasDurableMetalBody
*set MetalBody true
*if BulletProofBone
*set BulletProof true
*if ((Armor_Chest = "power armor") or (Armor_Chest = "kevlar armor")) or (Armor_Chest = "custom alloy")
*set BulletProof true
*if Flight
*set BasicFlight true
*if HasFlightUseableInSpace
*set SpaceFlight true
*set BasicFlight false
*if HasFlightUseableUnderwater
*set WaterFlight true
*set BasicFlight false
*if Healing
*set HealingSelf true
*set HealingOthers true
*if HasHealingOthersOnly
*set HealingSelf false
*if HasHealingSelfOnly
*set HealingOthers false
*if Forcefield and HasForcefieldAutomated
*set AutomatedForcefield true
*if Forcefield and HasForcefieldOnOthers
*set ForcefieldOthers true
*comment The following turns Telekinesis off letting the system know that the power only works on metal. Sometimes I check for Ferrokinesis when the object is metal. Others I check for Telekinesis when it is not.
*if Telekinesis
*set Ferrokinesis true
*if HasTelekinesisMetalOnly
*set Telekinesis false
*return
5 Likes
my goodness, this is awesome, but is it viable in an actual runtime? I think there are too many things need to be checked, and each superpower will have its own mechanism, like mind reading or hyper smell
anyway the long list of super powers show how well-informed you are with it, keep up the good work 
3 Likes
I could see this being an issue if I run the PowerCheck file every time I see the status of a power, but really I only need to run that file whenever there is a chance of something changing.
So I often run the code at the begining of a chapter or right after a major choice that can change them.
For example the code for the start of Chapter 4:
*set CurrentChapter +1
*set P1Hero false
*set Name DNPCName
*set Nick DNick
*set Gender DNPCGender
*set Date 36
*set StoryFocus "P1"
*gosub_scene GenderSet
*gosub_scene PowerReset
*gosub_scene PowerCheck
[i][b]Chapter ${CurrentChapter}[/b]
*line_break
[i]Day 36 - Friday - Morning
In this example I know that the character will not be in their super hero identity, so that might change the available powers (like for power armor heroes). So I make sure to run PowerCheck after changing the variable P1Hero.
However there are times in the middle of a chapter when something might change. For Example:
Spoiler for Dawn of Heroes Chapter 13
My power suit is weighing me down. For me to live I will need to get rid of it.
Springing to action I try to do an emergency release of my armor. It does not work. Panic continues to grow, and I try again.
I try to swim within the armor but cannot tell if I am going anywhere within all the darkness. If only my armor was waterproof, I would have more time to figure this out. That is an issue for the future me.
The water must be interfering with the emergency release. Still, I try one more time.
*fake_choice
*selectable_if (Karma > MinKarma) #[i]$!{SpendKarma}[/i] Then something grabs me.
*set Karma -1
*goto Saved
*selectable_if (Karma < MaxKarma) #[i]$!{GainKarma}[/i] The release works at last.
*set Karma +1
*set NoPowerArmor true
*gosub_scene PowerCheck
In this example the choice leads to a potential shift in powers mid scene.
When I run either of these, there is rarely a lag. Most of devices have enough RAM and processing power to run the code before anyone notices what has happened.
2 Likes
Thanks for sharing this. Now I will have to decide whether to either keep trying to use my own broken code for my project Super Sorority with its infinite loop and bugs or give this one a try - at the very least it’s a great example to learn from and hopefully improve my own code.
4 Likes