TAB - thinBasic Adventure Builder

T.A.B. is an interactive fiction/text adventure program for Windows and made with thinBasic.
 
HomeFAQSearchUsergroupsRegisterLog in
Latest topics
» TAB Version 66 Available
Mon Sep 26, 2016 12:02 pm by catventure

» TAB Version 65 Available
Mon Feb 23, 2015 12:04 pm by catventure

» Incubation pt 1
Wed Apr 24, 2013 9:24 am by Kabrinski

» Charecter movements - doors
Wed Mar 20, 2013 2:55 pm by garethfx

» Member feedback on game planning
Sun Mar 03, 2013 1:47 pm by garethfx

» Still alive - just!
Thu Feb 28, 2013 11:34 am by catventure

» TAB 64 crashes ...
Mon Aug 20, 2012 11:31 am by acko

» Idea on addition to object being container
Sat Aug 18, 2012 3:49 pm by catventure

» sizex=y action ...
Thu Aug 09, 2012 11:29 am by catventure


Share | 
 

 string flags and combat

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

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

PostSubject: string flags and combat   Mon 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
View user profile
catventure
Admin Adventurer
avatar

Male
Number of posts : 376
Age : 65
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 52
Registration date : 2008-06-08

PostSubject: Re: string flags and combat   Mon 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.



_________________
http://tab.thinbasic.com ; Home of the TAB I.F. project.
Back to top Go down
View user profile http://adventure.rpgdynasty.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: