This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 19 Jul 2003 12:44:04 pm    Post subject:

In an rpg during the battles, usually the fastest person, or enemy attacks first, then the second fastest and so on. So how would you do that same concept in BASIC? Is there some kind of command that takes to largest integer out of a series of nubmers?
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 19 Jul 2003 01:24:43 pm    Post subject:

i use (HP)/3+(Level/2)-13 = Speed
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 19 Jul 2003 06:51:57 pm    Post subject:

68->A //Initiative of player
20->B //Initiatie of enemy
10->C //Player's HP
15->D //Enemy's HP

Repeat Q //repeat until player or enemy is dead
If (A>B:Then //if player's Initiative is higher:
//let player attack
Else //enemy's initiative is higher:
//let enemy attack
End
If C=0 OR D=0:1->Q //
End
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 19 Jul 2003 07:57:23 pm    Post subject:

In the second line of your code Arcane Wizard, what if I had more than one enemy and person. Like 3 vs 3.

Would I have to store their speed ratings into a list and use the 'max( ' command? Then use various conditionals to figure out which variable the ouput of 'max(' matches up with?

But the problem with that is that there would be I think 9 If Then statements, or was it 6. Any ideas?
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 19 Jul 2003 08:26:14 pm    Post subject:

if sum(LPLAY) > sum(LENEMY
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 19 Jul 2003 08:27:55 pm    Post subject:

Arcane Wizard wrote:
If C=0 OR D=0:1->Q //

should be:
if C<=0 or D<=0:1->Q // an attack might send the HP below 0
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 19 Jul 2003 10:07:35 pm    Post subject:

make it easy on him, just put a code for three bars, one for each character


Code:
Line(4,2,14,2
Line(4,4,14,4
Pt-On(3,3
Pt-On(15,3

for lower left i think in ymax 62, xmax 94 both mins are 0

Then just add this code in to the middle of your lbl or what not (yes i know it is very big but...)


Code:
A // player 1 attack bar speed
B // player 2 (ditto)
C // player 3 (ditto)

If A>= 0 and A<= 4
Then
Pt-On(3,4
End
If B>= 0 and B<= 4
Then
Pt-On(3,4
End
If C>= 0 and C<= 4
Then
Pt-On(3,4
End

(do that over until the desired amt. like 20 or less or more) also you could do the first code darth gave you for the first # and then add two ie. for player one:


Code:
(HP)/3+(Level/2)-13->Z
A // player 1 attack bar speed

If A>= Z and A<= Z+2
Then
Pt-On(3,4
End


you also need to add in
A+1->A
B+1->B
C+1->C
To the code so that when i loops it will add 1 every time and so then you get to the desired # (lets say 10 for now) it would look like this for one player:


Code:
   {your code}
If
Then
0->A
Goto 1
End
  {your code}
Lbl 1
  {your code}
If A>= 0 and A<= 4
Then
Pt-On(3,4
End
If A>= 5 and A<= 8
Then
Pt-On(3,5
End
If A>= 8 and A<= 10
Then
Pt-On(3,6
End
If A>= 11
Then
Line(3,4,3,13 (or what ever it is
End
If A>=11
Then
  {your code for attack here}
End
  {your code}
A+1->A
  {your code}
Goto 1
End
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 20 Jul 2003 05:16:26 am    Post subject:

omni wrote:
In the second line of your code Arcane Wizard, what if I had more than one enemy and person. Like 3  vs 3.

4->A //total number of combatants involved
4.1->L1(1 //speed person 1 ->player
5.2->L1(2 //speed person 2 ->enemy
3.3->L1(3 //speed person 3 ->enemy
6.4->L1(4 //speed person 4 ->enemy
50->L2(1 //player's HP
30->L2(2 //person 2's HP
25->L2(3 //person 3's HP
10->L2(4 //person 4's HP

//Note: the .1 .2 .3 .4 etc. are which person it is so it won't get messed up when you sort the list.

SortD(L1 //sort the list from highest speed to lowest speed

Repeat Q
For(X,1,A //could change A into Dim(L1
//Let person X attack, use 10fPart(L1(X to check which person it is and Ipart(L1(X to check his speed if you need it
If L2(target)=0:Then //check if target has died
If Sum(L2)=L2(X:1->Q //check if anybody else is left to fight with, if not 1->Q
End
End
(L2(1)=0 OR Q->Q //end combat sequence if 0 fighters remain or player is killed
End

Quote:
Quote:

If C=0 OR D=0:1->Q //

should be:
if C<=0 or D<=0:1->Q // an attack might send the HP below 0

Depends on the system you use.


Last edited by Guest on 20 Jul 2003 05:21:01 am; edited 1 time in total
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 20 Jul 2003 05:49:16 am    Post subject:

Arcane Wizard wrote:
Depends on the system you use.

system, as in engine?
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 20 Jul 2003 05:55:37 am    Post subject:

No, as in a RPG system that contains all the rules, like what happends when you hit someone with a sword, what happends if you cuts someone's arm off, what you must do to cast a spell, what happends when your spell fails, how much money houses cost, how you can pickpocket somebody, etc.

Like Dungeons and Dragons (bad example (the rules make no sense), but pretty much everybody knows what it is since it's used in a lot of games like Dungeons and Dragons, Neverwinter Nights, Baldurs Gate, etc.).
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 20 Jul 2003 05:59:07 am    Post subject:

yes, but even if, there are HP points removed, and what u said will only quit if those come exactly to 0. they might not. if a guy has 26 HP and removing his arm takes away 30 HP, well, he would never die bcuz his HP would nevr reach 0. thats why i said "less than or equal to (<=)".
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 20 Jul 2003 06:07:19 am    Post subject:

//calculate damage
If damage>HP:Then
//calculate effect using damage-hp (arms cut off, big flesh wound that bleeds enemy to death, something like that)
If effect=1:Text(1,1,"You hit the enemy's arm, by chance a bone fragment cuts a mayor artery (sp?) and your enemy falls lifeless to the ground"
If effect=2:Text(1,1,"You cut of your opponents arm, he looks at it and falls to the ground."
//etc.
0->HP //0 hp won't mean you're dead but you'll still be removed from the fight because you'll always be knocked out, paralized, dead, or something like that.
//after the fight is over you can just kill the paralized enemy by slitting his throat or something like that.
Else
HP-damage->HP
End


Last edited by Guest on 20 Jul 2003 06:07:41 am; edited 1 time in total
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 20 Jul 2003 06:10:37 am    Post subject:

thanku for clearing that up.
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 22 Jul 2003 01:20:12 pm    Post subject:

Arcane Wizard, about your method, how would I have the for( loop execute again when X reaches 4?
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 22 Jul 2003 04:50:36 pm    Post subject:

That's what the repeat loop does, it keeps the battle going until there are no enemys remaining or the player is killed.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement