Non-threaded
Forums
»
Advanced Editor Forum
»
Read Thread
Get help from the experts on variables, scripts, items, and other scary things.
Bezro
Reply
Shield
9 months ago
How would I make a shield system in my game, kinda like the one in Warzone where you take damage on your shield which is rechargeable before you take damage on your actual health?
Mizal
Reply
Shield
9 months ago
Variables.
PerforatedPenguin
Reply
Shield
8 months ago
Preferably some with numbers.
Bezro
Reply
Shield
8 months ago
I tried to script some variables, but it didn't work. My first try was to put
IF SHEILD>0 THEN
HEALTH:= HEALTH+ENEMYDMG
IF HEALTH:=HEALTH+ENEMYDMG THEN
SHEILD:=SHEILD-ENEMYDMG
I put it on the link script after a turn you take damage in. It just made it so health didn't go down and the shield stayed the same.
Mizal
Reply
Shield
8 months ago
It's really fascinating looking at how different people approach the logic to setting up something like this.
I might have some suggestions later, but for now, I see you're adding the enemy's damage to the health variable any time the shield is active? There's nothing here that would subtract health.
Also, check the spelling of the shield variable and the script you're using to reference it, because I notice you seem to get creative with it in your post here.
What is ENEMYDMG actually set to?
And what's the purpose of checking the health before subtracting from the shield?
Bezro
Reply
Shield
8 months ago
ENEMYDMG is set to 5, and I have another line of code taking health away from the player, I just didn't think to include it. I added the ENEMYDMG to the health because it would stop health from taking damage and removing it from sheild
Mizal
Reply
Shield
8 months ago
Yeah, there's no reason to reference health at all if the shield is still active, and this is in just such a convoluted unnecessary way. What Peng suggested should work though. Just have damage subtracted from the shield until it reaches zero, then take it from health instead.
Keep in mind though that none of this stuff will do you any good if the writing isn't up to par. There's nothing inherently interesting about clicking a link over and over to make numbers happen.
PerforatedPenguin
Reply
Shield
8 months ago
Your check for if H equaled H+D (abbreviating here) will never be true. Having already set H to H+D, the check is essentially asking if (H+D) = ((H+D)+D). This means that your shield will never actually go down.
A simpler way to go about doing this:
If S > D: S = S-D
Else: H=H-(D-S) and S=0
And then recharge S however you want to.
Ogre11
Reply
Shield
8 months ago
You can use a item and have people pick it up if you want.
Home
Storygames
Random
Search
Newly Created
Top Rated
Fantasy
Grimdark Fantasy
Sci-Fi
Modern
Horror
Love & Dating
Mystery / Thriller
Family Friendly
Historical
Puzzles / Games
Edutainment
Fan Fiction
Forums
Newbie Central
The Lounge
News & Updates
The Parlor Room
Creative Corner
Writing Workshop
Reading Corner
Adv. Editor Forum
Wishing Well
Bugs and Problems
My Stuff
Storygames
Pictures
Messages
Notifications
Duels
Saves
Comments
Points
Commendations
Notepad
Profile
View Profile
Help & Info
CYOA History
About Us
Privacy Policy
Terms Of Service
Logon
version 23.22 | ChooseYourStory © 2001 - 2024, Halogen Studios Entertainment |
contact us