TAB - thinBasic Adventure Builder
Would you like to react to this message? Create an account in a few clicks or log in to continue.

TAB - thinBasic Adventure Builder

T.A.B. is an interactive fiction/text adventure program for Windows and made with thinBasic.
 
HomeLatest imagesSearchRegisterLog in
Latest topics
» Happy New Year 2024!
string flags and combat I_icon_minitimeSun Dec 31, 2023 4:04 pm by catventure

» TAB Version 71
string flags and combat I_icon_minitimeMon Aug 21, 2023 12:17 pm by catventure

» TAB Version 70
string flags and combat I_icon_minitimeSun Oct 02, 2022 1:49 pm by catventure

» TAB Version 70
string flags and combat I_icon_minitimeFri Sep 30, 2022 10:23 pm by catventure

» TAB Version 70
string flags and combat I_icon_minitimeMon May 23, 2022 4:08 pm by catventure

» TAB Version 70
string flags and combat I_icon_minitimeSat Apr 30, 2022 11:15 am by catventure

» TAB Version 70
string flags and combat I_icon_minitimeSat Apr 23, 2022 2:32 pm by catventure

» TAB Version 68 Update
string flags and combat I_icon_minitimeTue Mar 15, 2022 4:18 pm by catventure

» TAB Version 68 Update
string flags and combat I_icon_minitimeFri Mar 11, 2022 8:47 pm by catventure


Share | 
 

 string flags and combat

View previous topic View next topic Go down 
AuthorMessage
stants
Experienced Adventurer
stants

Number of posts : 71
Age : 50
Location : Maidstone, Kent, UK
Humor : I shall tear your soul Apart!!!!!
Adventure Points : 32
Registration date : 2009-09-16

string flags and combat Empty
PostSubject: string flags and combat   string flags and combat I_icon_minitimeMon May 02, 2011 8:15 pm

I know you can store numbers in flags but how about strings.

I have lots of data for each character
and i need 4 flags for each.
character 1
flag1=i want to store characters name
flag2=7 for strength
flag3=60 for stamina
flag4=7 for luck

Character 2
flag5 = store name of character
flag6=8 for strength
flag7=30 for stamina
flag8 =5 for luck

I then want to organise some sort of combat system so you can attack characters and other characters can fight you.

So if you are in the same room as a character and you are holding a weapon type 'Kill <character name> with Knife' and then i want to print messages of a combat occuring. i.e You attack Scotty with the Knife and deal 10 points of damage. Decrease the stamina flag for that character by 10. So basically if you are fighting a character who has higher strength he deals more damage to you but there is also a luck factor involved. You might get lucky and win a combat round.

Ok so im carrying a Knife and i see Spock in the same room.
I type stats spock to see his stats. They read
Strength=9
Stamina=80
Luck=5

I then type stats to check mine. They read
Strength=7
Stamina=80
Luck=7

So now i know that spock is stronger than me so he will deal more damage to me in combat. We both have the same stamina (you lose stamina from fighting - if it reaches 0 you die) but i am more lucky than Spock.

So if i am in the same room as a character and i am holding a weapon and i type kill <character> with knife

it first checks the luck values. I have 7 chances of winning the combat round and spock has 5.
I create a rnd number for me and store it in flag 100 say. Then i create a rnd number for spock and store it in flag 101 say. If my rnd number was higher than spocks then i get 1 point. I set flag 102 to store 1. If its not higher spock gets a point. Store 103 to 1. Repeat this for however many luck points you have. If at the end of that flag 102 is higher than flag 103 then i deal a combat round of damage causing 7 points of damage. Decrease stamina flag for spock by 7.
Repeat process until one of you reaches 0 stamina. You are dead.

So its pretty cool really if ive worked it out properly. Its a bit risky doing combat cos you could lose even if you are stronger. Thats where the luck factor comes in.

Does this make sense to you Phil. Maybe you know an even better solution for this.
Id like to hear your ideas for this type of situation.
Id be interested to hear how you would code this as youre the brains.

Cheers

Kind Regards
Stants







Back to top Go down
catventure
Admin Adventurer
catventure

Male
Number of posts : 404
Age : 72
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

string flags and combat Empty
PostSubject: Re: string flags and combat   string flags and combat I_icon_minitimeMon May 02, 2011 8:43 pm

Well I see what you mean.
You must remember that TAB is first and foremost a text adventure creator - not a dungeon type or rpg type of maker...
There is no inbuilt official combat system included, unlike some other programs specially made with stats for those kinds of fight/attack puzzles.

That said, some clever things can be done with the flags.
They can hold values relating to various attributes like strength, stamina and luck such as you mention; and yes, you can increase and decrease these flags and also have flags containing random numbers for comparison.
Also you can display the values of these flags in mess or cmess eg:

cmessStrength=%flag4%

would print maybe:

Strength=15 (depending on the value held in flag 4.)

#incflag4,2#rem: increases flag 4 by 2pts

#decflag3,1# rem: decrease flag 3 by 1pt.

A flag cannot contain a string.

But there are embedded control codes for printing a character keyword or name:

%charn1% - prints Character n1 KEYWORD
%charn2% - prints Character n2 KEYWORD
%charname1% - prints Character n1 "name" text
%charname2% - prints Character n2 "name" text


It would be more or extra work and require quite a number of flags to keep track of....
Just depends if you think it worth it or not. The simpler you design it the easier it would be to code.

Phil.


Back to top Go down
https://adventure.forumotion.com
 

string flags and combat

View previous topic View next topic Back to top 

 Similar topics

+
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
TAB - thinBasic Adventure Builder :: TAB FORUMS :: General Forum-
Jump to: