Battle engine hell (SOLVED)

Started by Construed, Sat 10/03/2012 21:55:07

Previous topic - Next topic

Icey

#20
No prob grim.

Intended for Khris
Spoiler

Look Khris I had already stated I didn't know if 1 of his questions had been answered so I took a shot at it. This is also another reason why I didn't post what's inside the brackets because I didn't want someone to comment on my stuff in that type of manner. Sure I took a shot at helping Grim with something I think works for me. And even if Hernald came and cleaned it up a bit that shouldn't be a problem.

What I men't was <= and >=, and I didn't know I could use < and > alone.

Also who the hell do you think you are coming in here yelling at me like that, are you freaking crazy!! I don't appreciate that. I have been successful at helping people in the past and then there were times were I was wrong. I'm human just like you(I hope). I'm some super genius when it comes to AGS but I try to find ways to get it to work for me because if I don't I either won't get the right help or just non at all.

Quote
And you think you're ready to go commercial, on Steam? It'd be funny if it weren't so pathetic.
Spoiler

Really, like for real. Who says something like that? If I set you off that bad by not even attacking you and trying to help a friend then that's goddamn shame. And for your information, read what I say a little bit better cause I'm not trying to go commercial, I'm preparing myself for if I go commercial.

My point is you I guess you can be a complete asshole some times. And yet you would call me a troll. I don't start things and get madder when others get mad. I get mad when someone else comes off at me when I know their wrong.

And that is something people do every day so if I'm trolling, your trolling. good day sir!
[close]

This is my story and I'm not gonna sit here and let all the hatters write for me. That's my motto and I'm sticking by it.
[close]

Khris

It's only natural that you follow your very first instinct: backlash.

What you should do instead though is turn on your brain for a few seconds and try to figure out WHY I'd react like that.
You have constantly strained everyone's patience here. For months on end, people tried to get you to see why what you think is OK is in fact not. No dice.

Regardless of the other stupid shit you're doing in these forums, posting broken code is obviously not helping. Can we agree on that?
Can we also agree that you've posted broken code before and were told not to?

Last but not least, if somebody keeps doing dumb things, even after repeatedly being told to stop it, at what point is it justified for others to ditch courtesy? You are WAY past that point by now.

Do you actually think I give a fuck about what you appreciate? Is this what a serial killer is supposed to tell the cops? "I don't appreciate being put in jail?"
Please, pull your head out of your ass.

Dualnames

Alright, I've read this topic in its entirety. This is becoming like a gen-gen topic too fast, so congrats on somewhat achieving that, icey. Everyone after a post is just focusing of making fun of you, instead of helping grimreapyou.

Posting half-assed code that doesn't work is okay, and it happened even to the best of us (Khris included (once though)). Continuously doing that, is however wrong. Wanting to help and actually helping are two separate things. Even coming with the best intentions here, doesn't make up for the situation you caused. I mean, I want to be a doctor, but I don't even know the basics.

Worst part is that half of the posts here (including mine) have no use to whoever will come here in the future expecting for some help.

"I'm not show what inside the brackets cause I don't wan't everyone to know how my leveling system works."

You typed this before a code that has absolutely no chance of working in any of the parallel universes, and expect everyone to thank you. It baffles me really.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Construed

Alright, I got it working somewhat like this:
Code: ags

  int xpnext=14;
// Insert this code when you award xp
expierance+=15; // award the xp
if(expierance > xpnext){
// Insert your stat changes here.
  player_maxhealth += 1;
  player_maxmana += 1;
  player_maxstamina += 1;
  strength += 1; 
  level++;
xpnext = (5*(level*level))+10; // sets the next xp requirement based on the current level. 
// lvl 1:15, lvl2: 30, lvl3: 55, lvl4 90, etc. levels become progressively harder to gain.
if (expierance > xpnext){ expierance = xpnext-1; } // not required, but this will prevent double levels.
}

But I'm guessing I did something wrong here, because it just levels after every fight and the amount of exp required is not increased.. :-\
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

suicidal pencil

I've been avoiding looking at this topic because I'm helping Grim with this somewhere else, but now that I've read it I'm giggling like an idiot and face-palming at the same time.  :-\

Grim, buddy, I think the AGS forums need a break from the technical aspects of your QFG multiplayer remake. I've already told you I'm willing to help with the code in what ways I can. The next time you post about it, it should be about how awesome the latest build is looking ;) Khris is a helpful guy, but I've got the feeling his patience is running just a bit too thin, dealing with some of the delinquents romping around the forum.

Icey, my sentiments for your code have already been quite eloquently expressed:
Quote from: Khris
Are you serious? What the hell?

edit: Dammit Grim, you ninja'd me!

Construed

LOL, Yea...
I think it would be best to break from my blatant postings of stupidity, However i need to get this done ASAP, It's been holding me up over a week and i have barely touched the game because I'm ocd and cannot continue other aspects till this is complete.
I think it be best proceeding with some of victors code, seems swell however I'm going to need your help learning how some of it is implemented
Hit me up on the other forum homie or in the chat :D
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Gilbert

Alright. Enough chit chats already, or else I may decide to break this thread up and remove the offtopic posts.

suicidal pencil

#27
Quote from: Iceboty V7000a on Mon 12/03/2012 01:26:15
Alright. Enough chit chats already, or else I may decide to break this thread up and remove the offtopic posts.

Absolutely. In the attempt to drag this back on topic:

Lets talk experience and the player, in the simplest form we can.

you will need two variables, one that represents the required amount of xp that the player needs to level up (hereby known as 'X'), and the actual amount of xp the player has ('Y'). Whenever X equals or is greater than Y, X increases, and the player's level increments by '1'.

In code, that's
Code: ags
if(Y >= X) Level_Up();
where the function 'Level_Up' increases X, and modifies the player's stats accordingly.
So now, the player only levels up when their accrued xp is high enough, instead of being leveled up every time xp is given.

So when the fight concludes and the player is victorious, somewhere in the code would be:
Code: ags
.
.
.
Y += Monster_Experience;
if(Y >= X) Level_Up;


so now how about X incrementing geometrically?

A third variable needs to be involved. This variable can either be a constant or increase along side X. I'm going to call this variable A. Every time the player levels up, X will equal X * A

Here's my example:
Let A equal '1.5'. A is a constant, so it never changes. The player's level is '1', and X equals 100.

Total XP required at level:
Code: ags

1) 100
2) 150
3) 225
4) 337.5
5) 506.25
6) 759.375
7) 1139.0625
8) 1708.59375
9) 2562.89063
10) 3844.33595


This also represents the difficulty curve nicely: The closer A is to '1', the slower the rise in the difficulty of the game. The higher A is, the higher the difficulty is (because you aren't leveling up and increasing your stats as often)

Now lets include 4 stats for the player that are affected by xp: Health, Mana, Constitution, and Wisdom.

So lets assume that:
Health = Constitution * 5
Mana = Wisdom * 10;

How do you know when to increase Wisdom and Constitution? It's simple if they increase every level, but what if you want Constitution to increase every second level (3, 5, 7, 9) and Wisdom to increase every third level (4, 7, 10, 13)? Use a counter!

Lets have a new variable, called B. This variable starts as '0', and increments by '1' every time the player levels. Once it hits '3', it resets to '0'. Now lets define the 'Level_Up()' function with this new variable and what we defined above:
Code: ags
function Level_Up()
{
  Player_Level++;
  X *= A;
  B++;
  if(B == 2) Player_Constitution++;
  else if(B == 3)
  {
    B = 0;
    Player_Wisdom++;
  }
  Player_Health = Player_Constitution * 5;
  Player_Mana = Player_Wisdom * 5;
}


These are the basics, and pretty much everything else is based off this.

Construed

Ok, this is what I've come up with from all of this however i keep getting parser error at :   Required_XP .....

int expierance = 0; ///is a global var int
int Required_XP = 15; ///is a global var int
Increase_Factor = 2.0 ///is a global var float

Code: ags

 else if (monsterz<=0) {
  int p=player.PreviousRoom;
  player.ChangeRoom(p, 160, 120);
  goblin.ChangeRoom(p, 160, 120);
  player.PlaceOnWalkableArea();
  expierance += 15;
  
if(expierance >= Required_XP){ 
level++;

  player_maxhealth += 1;
  player_maxmana += 1;
  player_maxstamina += 1;
  strength += 1; 
  Display ("You have reached level %d And now have, %d strength, %d health, %d mana, %d stamina, %d gold",level, strength, player_maxhealth, player_maxmana,player_maxstamina, goldshow );
  Required_XP *= Increase_Factor;


Can anyone tell me why I'm getting this error, is it because 1 is an int and the other is a float in :   Required_XP *= Increase_Factor;
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Scavenger

Quote from: GrimReapYou on Mon 12/03/2012 09:19:40
Ok, this is what I've come up with from all of this however i keep getting parser error at :   Required_XP .....

int expierance = 0; ///is a global var int
int Required_XP = 15; ///is a global var int
Increase_Factor = 2.0 ///is a global var float

Is there any reason why you're using a float for what is effectively integer multiplication? It seems needlessly complicated for something that could be just *2 or << 1.

In order to do float math with an Int, you need to convert it to a float with the IntToFloat and FloatToInt functions. The reason why it hasn't got to the type error is because, I think, you need to express the function as:
Code: ags

Required_XP = Required_XP * Increase_Factor;


I don't think AGS HAS *= as one of it's thingies, only += and -=.

Construed

Oh okay, I was thinking perhaps i could use an int value instead too.
mucho gracias :D
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

#31
Switched it over to an int and its working great, Thanks bud :D

PS.
This was the end code if anyone is curious:
Code: ags

// room script file
// room script file

function room_AfterFadeIn()
{
monsterui.Visible=true; 
player.PlaceOnWalkableArea();
object[1].SetView(56);
object[1].Animate(0, 3, eOnce, eBlock);
goblin.FollowCharacter(null);
object[1].SetView(56);
object[1].Animate(0, 3, eOnce, eBlock);
}


function room_RepExec()
{
  
  
 if ((player.View==42)||(player.View==16)) {
  player.ChangeView(85);
  object[0].SetView(82);
 }
   else if ((player.View==17)||(player.View==59)) {
    player.ChangeView(87);
    object[0].SetView(84);
  }
  else if ((player.View==18)||(player.View==58)) {
    player.ChangeView(86);
    object[0].SetView(83);
}
  
  
  
 if (IsKeyPressed(eKeyUpArrow) == 1){
   
  object[0].Animate(0, 3, eOnce, eBlock);
  object[0].Animate(1, 3, eOnce, eBlock);

  int dmg = Random(5);
  monsterz -= dmg + 1;

  object[1].SetView(56);
  object[1].Animate(0, 25, eOnce, eBlock);

if (dmg==0)  health-=0;
  health -= dmg + 1;
 }
 
 else if (monsterz<=0) {
  int p=player.PreviousRoom;
  player.ChangeRoom(p, 160, 120);
  goblin.ChangeRoom(p, 160, 120);
  player.PlaceOnWalkableArea();
  expierance += 15;
  
if(expierance >= Required_XP){ 
level++;

  player_maxhealth += 1;
  player_maxmana += 1;
  player_maxstamina += 1;
  strength += 1; 
  Display ("You have reached level %d And now have, %d strength, %d health, %d mana, %d stamina, %d gold",level, strength, player_maxhealth, player_maxmana,player_maxstamina, goldshow );
  Required_XP = Required_XP * Increase_Factor;

 int win=Random(2);

  

if (monsterz <= 0){

  

if (win==0)  goldshow += 20;
  

else if (win==1) goldshow += 10;
  
 
else goldshow += 5;
   
          }
        }   
      }
    }
  
function room_Load()
{
 if ((player.View==42)||(player.View==16)) {
  player.ChangeView(85);
  object[0].SetView(82);
 }
   else if ((player.View==17)||(player.View==59)) {
    player.ChangeView(87);
    object[0].SetView(84);
  }
  else if ((player.View==18)||(player.View==58)) {
    player.ChangeView(86);
    object[0].SetView(83);
}

}

function room_Leave()
{

Display("You have triumphed over your enemy!");
  if (player.View==85){
 player.ChangeView(16);
CafeDo(String.Format("speed is %d %d", 5, 5));
player.SetWalkSpeed(5, 5);
  }
  else if (player.View==86) {
    player.ChangeView(18);
    CafeDo(String.Format("speed is %d %d", 5, 5));
player.SetWalkSpeed(5, 5);
  }
  else if (player.View==87) {
    player.ChangeView(17);
    CafeDo(String.Format("speed is %d %d", 5, 5));
player.SetWalkSpeed(5, 5);
}
 monsterui.Visible=false; 
  goblin.ChangeView(89);
}
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

If you actually want to double the required XP each time, 2 instead of 2.0 is fine.
But I think suicidal pencil chose 1.5 for a reason, namely to not make too big jumps. With a factor of 2, the XP the player has to gain to reach level X is all(!) the XP he had to gain to reach the level before that and then some, which might be a bit much.
Example: 2: 100, 3: 200, 4: 400: 5: 800, 6: 1600
Total XP necessary to reach lvl 5: 1500.
XP necessary on top of that(!) to reach lvl 6: 1600

Now there's no need for a global variable here since it never changes.
Thus the line should look like this:

Code: ags
  Required_XP = (Required_XP * 3) / 2;   // factor 1.5

Construed

I tried using it, just can't seem to get it working right.
I can see its a solid piece of code.I surely need the 1.5 instead of 2, that jump is lame.
Thanks for it, I'll continue to tinker with it as my knowledge advances.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

My line is supposed to replace this line in your code:

Code: ags
  Required_XP = Required_XP * Increase_Factor;


No further adjustments are necessary.

Construed

For some reason its giving me a level every fight for the first 5 fights,
then it takes 2 fights for level 6 and 3 fights for level 7.
I dont know what the issue is, probably on my end :(
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

Well, what's the initial value of Required_XP? Sounds like it is too low.

You are awarding 15 XP per fight, so it should start out as 40 or something, I guess.
That way, it takes three fights to reach 45 XP / lvl 2, then four fights to reach the new requirement of 60 XP.

Victor6


EDIT: Khris beat me to it;-

XP for each level (roughly, since it'll be converted to an int):
level 2 : 15
level 3 : 15*1.5 = 22.5
level 4 : 22.5*1.5 = 33.75
level 5 : 33.75*1.5 = 50.65
level 6 : 50.65*1.5 = 75.9

XP after each fight
fight1 : 15 (requires 15 for level 2)
fight2 : 30 (requires 22.5 for level 3)
fight3 : 45 (requires 33.75 for level 4)
fight4 : 60 (requires 50.65 for level 5)
fight5 : 75 (requires 75.9 for level 6 - So no level gain.)

suicidal pencil

Well, after every level-up you could reset the player's accrued experience back down to zero when he levels up.

reusing my example:

Without reseting accrued experience:
Code: ags
1) 100 (100xp required)
2) 150 (50xp required)
3) 225 (75xp required)
4) 337.5 (112.5xp required)
5) 506.25 (168.75xp required)
.
.
.


Now reseting experience to zero after every level:
Code: ags
1) 100 (100xp required)
2) 150 (150xp required)
3) 225 (225xp required)
.
.
.


So in your code:
Code: ags
if(expierance >= Required_XP){ 
level++;
expierance = 0; //<----just add this one line
.
.
.


edit: god damn, you guys beat me :<

Construed

Damn you guys are sick with the math.
Greatly appreciated :D
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

SMF spam blocked by CleanTalk