Omnimaga

Calculator Community => TI Calculators => General Calculator Help => Topic started by: Yeong on October 19, 2010, 09:24:45 pm

Title: Need help in battle engine
Post by: Yeong on October 19, 2010, 09:24:45 pm
So I'm trying to make BASIC battle engine that monster comes out depends on # of party (max=3)
The turn will be decided by the speed.
I've tried, but I'm stuck.
Can you guys give me general algorithm for it?
Title: Re: Need help in battle engine
Post by: guy6020665 on October 19, 2010, 09:38:31 pm
When you say monster come out does that mean at the very beginning? If so perhaps have a variable that holds the number of people in your party and use that for a loop?

like this?
Code: [Select]
(Number of people in your party)->B
For(A,B,1,-1
randint(1,(however many enemies you plan on))->C
If C=1
Theh
output(your choice,your choice+A,"enemy character"
enemy HP -> variable that holds the enemies hp
End
If C=2

"and so on"

That should display the enemies, you just have to add in numbers, thats just the beginning though.
Title: Re: Need help in battle engine
Post by: Yeong on October 19, 2010, 09:40:51 pm
thnx!
Title: Re: Need help in battle engine
Post by: ztrumpet on October 19, 2010, 09:42:51 pm
I'm actually working on a very complex RPG that I believe follows some of these guildlines.  If you wish, I can post the battle engine's code in its current state for you to look at (though keep in mind it's a work in progress. :) )
http://www.omnimaga.org/index.php?board=63.0 I suggest looking at the screenshot thread. ;D
Title: Re: Need help in battle engine
Post by: Yeong on October 19, 2010, 09:44:48 pm
Ah! My computer froze trying to view the screenshots! :o
Title: Re: Need help in battle engine
Post by: DJ Omnimaga on October 20, 2010, 02:38:19 am
I'm actually working on a very complex RPG
I'M glad to see that in present tense, since it means it's still alive ;D
Title: Re: Need help in battle engine
Post by: Yeong on October 20, 2010, 07:42:01 am
One more question:
I got stuck where speed decides the turn.
it was no problem with 1v1 (Max())
but, is there any less-bytes-consuming way to decide who go first?(Speed-based)
Title: Re: Need help in battle engine
Post by: DJ Omnimaga on October 20, 2010, 02:01:49 pm
It depends, is it kinda semi real-time, where you can sometimes attack twice in one turn if your speed is very high, or is it more like the old FF games?
Title: Re: Need help in battle engine
Post by: Yeong on October 20, 2010, 03:06:00 pm
It depends, is it kinda semi real-time, where you can sometimes attack twice in one turn if your speed is very high, or is it more like the old FF games?
No.. Speed is just used for turn
Title: Re: Need help in battle engine
Post by: guy6020665 on October 20, 2010, 03:27:21 pm
Well I don't know an easy way to figure out who goes first, but after that you could put the order in a list and use that to decide the battle cycle.
Title: Re: Need help in battle engine
Post by: AngelFish on October 20, 2010, 03:37:40 pm
One more question:
I got stuck where speed decides the turn.
it was no problem with 1v1 (Max())
but, is there any less-bytes-consuming way to decide who go first?(Speed-based)

Whoever has the higher speed goes first. If there's a tie, then pick the first person.

For example, in Axe
Code: [Select]
100->A
102->B
If A≠B
If A>B
First player attack
Else
Second Player attack
End
Else
First player attack
End

This could be done very efficiently in Assembly.
Title: Re: Need help in battle engine
Post by: Yeong on October 20, 2010, 03:40:54 pm
i meant 2v2 or 3v3
Title: Re: Need help in battle engine
Post by: ztrumpet on October 20, 2010, 03:54:51 pm
Here, this may help:
Find the element in L1 that's the smallest (defaults to the  biggest element number in case of tie):
max((L1=min(L1))cumSum(binomcdf(dim(L1)-1,0
Find the element in L1 that's the biggest (defaults to the  biggest element number in case of tie):
max((L1=max(L1))cumSum(binomcdf(dim(L1)-1,0

Ex:
{6,4,6,78,4,9001
max((Ans=min(Ans))cumSum(binomcdf(dim(Ans)-1,0
Would return 5

{6,4,6,78,4,9001
max((Ans=max(Ans))cumSum(binomcdf(5,0
Would return 6

I hope this helps! ;D
Title: Re: Need help in battle engine
Post by: Yeong on October 20, 2010, 03:57:40 pm
thanks again!
Title: Re: Need help in battle engine
Post by: ztrumpet on October 20, 2010, 04:05:21 pm
I'm actually working on a very complex RPG
I'M glad to see that in present tense, since it means it's still alive ;D
It's in progress, but I want to finish Exodus before starting work on it again.  They conflict too much to be worked on together easily. ;D

thanks again!
Cool, I hope you got it to work. :D
Title: Re: Need help in battle engine
Post by: DJ Omnimaga on October 20, 2010, 11:47:56 pm
Yeah I hope you finish Exodus soon. I hope it gets released for Christmas at least ;D