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: 14 Sep 2003 04:26:16 pm    Post subject:

In rpg games like Final fantasy, when you attack an enemy, the amount of damage you do is random, So how would you do randomness in the ti83+?
Back to top
Ben Trettel


Member


Joined: 17 Jul 2003
Posts: 153

Posted: 14 Sep 2003 04:33:25 pm    Post subject:

Actually, the amount of damage is not random completely, it can depend on your stats. The random integer function is randInt( I think. Find it in the Math menu or the catalogue.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 14 Sep 2003 05:50:17 pm    Post subject:

yes, RandInt(1,10) (math->left once->down 5->enter) would return a pseudorandom integer between 1 and 10, inclusive
rand returns a pseudorandom # between 0 and 1, i think, but i havent used that one as much...


Last edited by Guest on 14 Sep 2003 05:51:05 pm; edited 1 time in total
Back to top
Matt


Member


Joined: 11 Jun 2003
Posts: 169

Posted: 14 Sep 2003 08:34:46 pm    Post subject:

or just:


Code:
IPart(rand*[any number you choose])


That will put in a random # that doen't have any decimals up to the # you choose
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 15 Sep 2003 06:46:33 am    Post subject:

Matt wrote:
or just:


Code:
IPart(rand*[any number you choose])


That will put in a random # that doen't have any decimals up to the # you choose

RandInt( is faster (and takes less memory?).

How you can base it on your strat:

Say your character has strength 5 and that value is stored in LRPG(4)
You can either rule your strength is the max damage you can do,
RandInt(0,LRPG(4)->D

or that you add strength to a base roll (as is the case in most rpg's, including DnD)
RandInt(1,6)+LRPG(4)->D


Last edited by Guest on 15 Sep 2003 06:50:26 am; edited 1 time in total
Back to top
JesusFreak
JesusFreak


Active Member


Joined: 17 Jun 2003
Posts: 537

Posted: 19 Sep 2003 07:47:52 pm    Post subject:

Quote:
RandInt(1,6)+LRPG(4)->D


ahhh the is right, but in many RPGs i acctually do less damage than what is the avg. or what not. this is what i do: (assuming that LRPG(4 is the strength

Code:
RandInt(0,10)->A (no need for the ")" but ohh well it is easier to see...)
RandInt(1,2)->B
If B = 1
Then
LRPG(4)+A
End
If B=2
Then
LRPG(4)-A
End


It takes a little more, but adds more randomness to the game
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 20 Sep 2003 03:41:46 am    Post subject:

D //damage rolled
B // enemy's toughness/armour
A //enemy's HP

RandInt(1,6->D
Repeat fPart(Ans/6 //keep adding D6 damage until lower than 6 is rolled
D+(D=6)RandInt(1,6->D //add another D6 damage to the roll if it was a critical one (rolling a 6 for damage would be a critical)
End
A-(D+LRPG(4)-B->A //substract damage from enemy's HP

The reason you do less damage than average is because your enemy is probably wearing armour or has some other way of reducing damage (toughness, magic items, etc.) or because you are getting penalties for some reason (in DnD for example, when you use a weapon in your off-hand (left) you get a -4 (right arm) -4 (left arm) chance to hit unless you have appropriate skills)


Last edited by Guest on 20 Sep 2003 03:43:42 am; edited 1 time in total
Back to top
Flash
Umpa Loompa


Member


Joined: 31 Aug 2003
Posts: 110

Posted: 20 Sep 2003 11:57:48 am    Post subject:

what exactly does IPart do? i alwaysed used "rand" or "randInt" but always looking for differnt ways of trying things
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 20 Sep 2003 12:19:35 pm    Post subject:

iPart(X) - returns the integer part of X
fPart(X) - returns the floating part (decimal) of X
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 20 Sep 2003 12:37:30 pm    Post subject:

iPart(5.6789) = 5

fPart(5.6789) = 0.6789

Usefull when decompressing data, for example:

46->A //player x coord
30->B //player y coord

100A+B->LSAVE(1 //save

iPart(.01LSAVE(1->A //load A
100fPart(.01LSAVE(1->B //load B


Last edited by Guest on 20 Sep 2003 12:38:14 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 15 Nov 2003 03:54:54 pm    Post subject:

why are there 2 functions - int( and iPart( that do the same thing?

randInt(0,N is faster than int((N+1)rand but takes more space if N is a constant. They are both best in some cases.


Last edited by Guest on 15 Nov 2003 03:55:06 pm; edited 1 time in total
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