Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
120 user(s) are online (105 user(s) are browsing Forums)

Members: 1
Guests: 119

Yodaphone, more...

Support us!

Headlines

 
  Register To Post  

Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
Wasn't sure where to post this but hey, we want to compile it for AOS4.x

Been playing through FFXIII on the 360 for quite a while now and it's dawned on me that a program for calculating weapon upgrades would be handy...

Here is the criteria of the program

You start off with a base amount which also is the exp needed to get to level 1...

say 800

once you hit level 1 the exp to get to level 2 is level 1 + a random amount

The random amount could be 180 for example... so you need 800 + 180 to get to level 2... 980...

and the process continues to compound... to get to level 3 it would be 980 + 180... etc etc etc....

Lets call each level a rank... upto rank 99 would be enough...

The program would prompt us for a base amount then a random amount and then a rank... and add it all together...

So logic would follow like this

800
180
12 <-- 12 levels or ranks in this calculation...

The final figure would be (let me get the calculator lol)

800
980
1160
1340
1520
1700
1880
2060
2240
2420
2600
2780

equals = 21480

And that's all I'd want the program to do... cough that figure up... for those that do play FFXIII and are wondering about upgrading when a item comes in at level 9 for example... no worries, you simply use the next level as the base level and remove 10 levels from your rank input...

Anyway, does anyone understand ok? so is anyone up to the task? If you feel generous you could release the code so I might be able to tweak it later.

Thanks for any considerations...

ps... just for final notes... I don't think you'll need more than 99 ranks... most I've seen so far is 91... and I wouldn't think we'd need over 9,999,999. final output... possibly even 999,999 but I don't want to take the chance lol

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Not too shy to talk
Not too shy to talk


See User information
@Slayer
#include <stdio.h>

void main()
{
    
int base 800;
    
int rate 180;
    
int level 12;

    
int result base;
    
int count 0;

    for(
level level -1count levelcount++)
    {
        
base base rate;
        
result result base;
    }
    
printf("result: %d\n"result);
}

Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Just popping in
Just popping in


See User information
@Slayer

A basic code would look like this :

Input "Base :",Base
Input "Random Amount :", Amount
Input "Rank :", Rank

Rem take off Amount as its added in the loop

Base = base - Amount

for i = 1 to Rank

Newbase = Base + Amount
TotalExp = TotalExp + Newbase
Base = Newbase
Print TotalExp

next i

I dont have an OS4 machine, so it was hard to find a programming language that would work.
Windows sdlBasic Version 20051016, Jul 12 2007 23:44:09, based upon SciTE Version 1.64, December 1998-June 2005.

Here is a quick SDL Basic Program I made :

Base = 0
Newbase =0
TotalExp = 0

fPrintS("Please Enter Base exp :")
BaseInput$ = zoneInputS( 23, 0, 10, "" )

fPrintS("Please Enter Random Amount :")
RAmountInput$ = zoneInputS( 28, 1, 10, "" )

fPrintS("Please Enter Rank:")
RankInput$ = zoneInputS( 18, 2, 10, " " )

Base = val(BaseInput$)
Rank = val(RankInput$)
Amount = val(RAmountInput$)

cls
' take off Amount as its added in the loop
Base = Base - Amount

for i = 1 to Rank

Newbase = Base + Amount
TotalExp = TotalExp + Newbase

' Show each Rank info
PrintS("Rank: " &i & " TotalExp " &TotalExp)

Base = Newbase

next
' Output the Final Rank and Experience Required
printS( "Rank " &Rank )
printS( "Total Experience Required:" &TotalExp )

wait(500)
waitKey


I hope this is useful to you.
have fun

Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@ZeroG

Thats great but I think I'd need to edit the c code then recompile it then execute it for the answer?

I was thinking more of the program prompts you for a base rate then prompts you for a random value then prompts you for a rank...

THEN it calculates this and spits out the total exp value

The 800 120 and 12 were off the top of my head to illustrate the logic

I do like the look of the code though!

Thanks!

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@angelheart

I must say that that looks very complete trouble is I'm not sure I can compile SDL language?

I thought of another way to calculate it too... since it increases the same amount each time... you could do this...

12 x 800 = 9600

then... to get from level 2 to level 12 it would be

1 + 2 +3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 =

66 x 180 = 11880

9600 + 11880 = 21480

Maybe this example would be easier to code?

Thanks for any interest

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Just popping in
Just popping in


See User information
@Slayer

yes thats another way. But you still need a loop

eg

Rank = 12

For level = 1 to Rank-1
Total = Total + level
Next

print Total*180 + Rank*800

I thought you could try running the code using SDL Basic for OS4.

http://os4depot.net/share/development/language/sdlbasic.lha

If that dont work I can quickly make an Amos version - I dont know if you want a classic/OS3 program.

I only have Windows / AmigaOS 3 here.

edit: the c code
edit 2 few changes from abalaban - thanks :)

#include <stdio.h>

void main()
{
int base, amount, rank, total=0;

printf("Input base : ");
scanf("%d", &base);
printf("\nInput Random amount: ");
scanf("%d", &amount);
printf("\nInput rank: ");
scanf("%d", &rank);

total = (rank * (rank+1))/2;

printf("\nExperience is :%d\n", total*amount + rank*base);
}


Edited by angelheart on 2010/4/13 10:03:12
Edited by angelheart on 2010/4/13 10:04:35
Edited by angelheart on 2010/4/13 16:21:33
Edited by angelheart on 2010/4/13 16:26:46
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@angelheart

for (i=1<=ranki++)
total += i;


And please don't forget to initialize total to 0 prior to do that. Also you can replace this whole loop by the following :
total = (rank * (rank+1))/2;

Back to a quiet home... At last
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Just popping in
Just popping in


See User information
@abalaban

done - thanks

Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Just popping in
Just popping in


See User information
@Slayer:

GUI'fied ZeroG code and made this toy.

http://www.terra.es/personal8/ami603/FFCalc.lha

Feel free to modify, publish, or whatever.

Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@Ami603

I'm impressed by the effort I will certainly check it out when I get home from work!

Thanks very much!

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@angelheart

I will look at your work Angelheart, thank you for all your hard work and consideration!

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@Ami603

That is Perfect Ami603!

But small problem...

800 Base
Random 180
12 level or rank...

should equal 21480 like in my above post... in yours it's 20680

please check the code?

sorry but it looks awesome! heh

edit:

oh I see what's happened... you just haven't added in the base amount (lvl 1 800 amount... the calculator adds lvl2 to lvl12 though)... I can live with that...

THANKS!!!!!

The picture etc is just the crowning cosmetics

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Just popping in
Just popping in


See User information
@Slayer

Thanks, i'm glad you liked it, in fact it only took two minutes with Emperor and copying the function ZeroG posted here to make it work.

The source code is available and easily fixed, just look at usercode.c

a simple "make" on a shell with the current SDK will be enough to compile it again.

Just one favour, could you upload it to OS4Depot? i lack the time right now.

Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@Ami603

I'll see what I can do when I get home later today, again thanks for your time!

and ZeroG for sharing his knowledge!

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@Slayer

It's quite simple to use a structure for this and, more from this, we can remove virtually the 800 base amount

Sample using C:

struct WeaponSTRUCT{
  
int BaseAMOUNT;             // Used for virtual amount for level 1
  
int LevelUPAmount;          // 1 level contain this amount of XP.
  
int TrueXP;                        // Real Experience point
 
}
typedef WeaponSTRUCT MyWeaponTYPE;

MyWeaponType MyTestWeapon;

// Used to define base and random number for level up
void Setup_Weaponint Baseint RandomLEVEL ){
  
MyTestWeapon.BaseAmount Base;
  
MyTestWeapon.LevelUPAmount RandomLEVEL;
  
MyTestWeapon.TrueXP 0;
 }

// Used to add XP amount to weapon
void AddXPToWeaponint XPAmount ){
  
MyTestWeapon.TrueXP MyTestWeapon.TrueXP XPAmount;
 }

// Get final XP to display
int GetDisplayXPvoid ){
  
int FinalXP MyTestWeapon.TrueXP MyTestWeapon.BaseAmount;
  return 
FinalXP;
 }

// Get actual weapon level
int GetDisplayLevelvoid ){
  
int FinalLevel 0;
  if (
MyTestWeapon.LevelUPAmound != ){
    
FinalLevel = ( MyTestWeapon.TrueXP MyTestWeapon.LevelUPAmount ) + 1;
   }
  return 
FinalLevel;
 }

// return the amount of XP within the actual level.
inf GetDisplayLevelXPvoid ){
  
int XPToShow 0;
  if (
MyTestWeapon.LevelUPAmound != ){
    
// Round to int needed for next calculation
    
Int FinalLevel MyTestWeapon.TrueXP MyTestWeapon.LevelUPAmount;
    
XPToShow MyTestWeapon.TrueXP - ( FinalLevel MyTestWeapon.LevelUPAmount );
   }
  return 
XPToShow;
 }


I hope it'll help ;)

I've made this code in 10 minutes directly on the web browser so, some errors can exist ...

EDIT : Ami603 : Nice piece of code :p
Useful to show how to initialize/clean some OS4 components :)

Kindest Regards,
AmiDARK.


Edited by freddix on 2010/4/14 22:40:34
All we have to decide is what to do with the time that is given to us.
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@freddix

I think I understand what you mean but the base amount of 800 was just an example...

regardless of how you code it you still need a starting figure whether that is 800 and called base amount or 1220 and called the total exp need to go from level 0 to level 1 or whatnot whoknows etc etc

The base amount could be 0 for example and the random amount is 5 to go to level 6 you'd need 75 exp...

lvl1 0exp
lvl2 5exp
lvl3 10exp
lvl4 15exp
lvl5 20exp
lvl6 25exp

The base amount in regards to this game is basically the exp you need to raise from 0 level to level 1... I think perhaps I should have explained it that way in my opening post

Thanks for your interest

I can't code, I can only compile :-p so your structure is probably no good to me

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Any takers for my Final Fantasy XIII (small routine)
Quite a regular
Quite a regular


See User information
@Slayer
In my sample the base amount can be changed. But if you need it in your program for tests (level 0 or >), it can be easily included in the system :

This is just a "sample of use". It is probably not suited for your exacts needs ;)

struct WeaponSTRUCT{
  
int BaseAMOUNT;             // Used for virtual amount for level 1
  
int LevelUPAmount;          // 1 level contain this amount of XP.
  
int TrueXP;                        // Real Experience point
 
}
typedef WeaponSTRUCT MyWeaponTYPE;

MyWeaponType MyTestWeapon;

// Used to define base and random number for level up
void Setup_Weaponint Baseint RandomLEVEL ){
  
MyTestWeapon.BaseAmount Base;
  
MyTestWeapon.LevelUPAmount RandomLEVEL;
  
MyTestWeapon.TrueXP 0;
 }

// Used to add XP amount to weapon
void AddXPToWeaponint XPAmount ){
  
MyTestWeapon.TrueXP MyTestWeapon.TrueXP XPAmount;
 }

// Get final XP to display
int GetDisplayXPvoid ){
  
int FinalXP MyTestWeapon.TrueXP;
  return 
FinalXP;
 }

// Get actual weapon level
int GetDisplayLevelvoid ){
  
int FinalLevel 0;
  if (
MyTestWeapon.LevelUPAmount != ){
    
FinalLevel = ( ( MyTestWeapon.TrueXP MyTestWeapon.BaseAMOUNT ) / MyTestWeapon.LevelUPAmount ) + 1;
   }
  return 
FinalLevel;
 }

// return the amount of XP within the actual level.
inf GetDisplayLevelXPvoid ){
  
int XPToShow 0;
  if (
MyTestWeapon.LevelUPAmount != ){
    
// Round to int needed for next calculation
    
Int FinalLevel = ( MyTestWeapon.TrueXP MyTestWeapon.BaseAMOUNT ) / MyTestWeapon.LevelUPAmount;
    
XPToShow = ( MyTestWeapon.TrueXP MyTestWeapon.BaseAMOUNT )- ( FinalLevel MyTestWeapon.LevelUPAmount );
   }
  return 
XPToShow;
 }

All we have to decide is what to do with the time that is given to us.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project