Horrible battle system needs help!

Started by Construed, Thu 26/09/2013 22:22:33

Previous topic - Next topic

Construed

Code: ags

function room_AfterFadeIn()
{
 //aBattle.Play();
monsterui.Visible=true;  //displays monster and player life
player.PlaceOnWalkableArea();
//goblin.FollowCharacter(null);
//goblin.ChangeRoom(302);
object[1].SetView(56);
object[1].Animate(0, 3, eOnce, eBlock);
}

function room_RepExec()
{
expierance3 = Required_XP; //trying to ensure that required_xp shows up on stat screen as the characters TNL.
  if (health <= 15)
{
Display("You look tired, You should rest!");
}
  
if (monhealth <= 0){  //changes the monsters health back to zero if it goes in the negatives.
  monhealth=0;
}

//causes object0 which is representative of the character to animate doing a stab motion.  
 if (IsKeyPressed(eKeyUpArrow) == 1){
    object[0].Animate(0, 3, eOnce, eBlock);
  object[0].Animate(1, 3, eOnce, eBlock);

//causes a mixture of random damage + strength for harder hits as str increases.
  int dmg = Random(6) + Random(strength);
    
if (dmg==0) monsterz-=1;
  
else if (dmg==1) monsterz-=2;
  
else if (dmg==2) monsterz-=3;

else if (dmg==3) monsterz-=4;

else if (dmg==4) monsterz-=5;

else if (dmg==5) monsterz-=6;
object[1].SetView(56);
  object[1].Animate(0, 25, eOnce, eBlock);
int dmg2 = Random(6);
if (dmg2==0)  health-=0;  
else if (dmg2==1) health-=02;
else if (dmg2==2) health-=03;
else if (dmg2==3) health-=04;
else if (dmg2==4) health-=05;
else if (dmg2==5) health-=06;
 }
  else if (monsterz<=0) {
  player.PlaceOnWalkableArea();
  expierance += 10;  //int stores in a txt label to show total amount of xp
  Vexpierance += 10; //the same value shown in another gui
 Display ("You put up quite a fight! I'm worn out!" );
 Display ("You have gained %d expierance.",expierance );

int p=player.PreviousRoom;
  player.ChangeRoom(p, 158, 148);

//causes the player to level up
if(Vexpierance >= Required_XP){ 
level++;

//increases the maximum amounts of the glob vars.
  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",level, strength, player_maxhealth, player_maxmana,player_maxstamina, goldshow );
  Required_XP = Required_XP * Increase_Factor; //increases the required xp per level
  
//Required_XP = (Required_XP * 3) / 2;   // factor 1.5
 int win=Random(2);

//depleted code, no gold is won from this battle.
if (monsterz <= 0){




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

else if (win==1) goldshow += 0;
  
 
else goldshow += 0;
   
          }
        }   
      }
    }
  
function room_Load()
{
  aFight1.Play();
  //goblin.ChangeRoom(302);

//fighter attack view
   if ((player.View==93)||(player.View==42)||(player.View==2)) {
  player.ChangeView(85);
  object[0].SetView(82);
 }
//thief attack view
   else if ((player.View==59)||(player.View==92)||(player.View==28)) {
    player.ChangeView(87);
    object[0].SetView(84);
  }
  
  
//wizard attack view
  else if ((player.View==91)||(player.View==58)||(player.View==4)) {
    player.ChangeView(86);
    object[0].SetView(83);
}}

function room_Leave()
{
//fighter normal view
  if (player.View==85){
 player.ChangeView(2);
CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
  }
  
//wizard normal view 
  else if (player.View==86) {
    player.ChangeView(4);
    CafeDo(String.Format("speed is %d %d", 3, 3));
 player.SetWalkSpeed(3, 3);
  }
  
//thief normal view
  else if (player.View==87) {
    player.ChangeView(28);
    CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
}

//removes the monster/player life from the screen.
 monsterui.Visible=false; 
  aFight1.Stop();  
}


I know this code is quite horrible. It is old code from another game that I edited to fit this scenario and unfortunately I have forgotten a lot of what I was working with before and I'm just trying to piece it together into a stable functional battle scene. Everything is working, except the XP TNL keeps giving odd and random numbers and I'd like to figure out how to make the damage dealt appear above the heads of both the player and the monster for a few brief seconds.
Any suggestions to make the code better would be greatly appreciated!

Thanks a mill,
-Jared
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Crimson Wizard

#1
Quote
Any suggestions to make the code better would be greatly appreciated!

First thing you do with the old and ugly code like this: proper indentation + remove extra spaces and shit unneeded garbage. Spend few minutes on this and it will look much more comprehensible (for you and others). Maybe you'll even notice some mistakes along the way (this really happens!)

Also, not sure I understand, what is "XP TNL"?

Construed

Sorry about that, I was doing a lot of experimenting and editing and lost track of making it readable.
XP TNL is how much experience is needed until next level.


I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

geork

I'm too tired to look at this properly unfortunately, but some of the programming is a bit obtuse - you have a lot of if/else statements where a single calculation could suffice; EG:
Code: ags
if (dmg==0) monsterz-=1;
 
else if (dmg==1) monsterz-=2;
 
else if (dmg==2) monsterz-=3;
 
else if (dmg==3) monsterz-=4;
 
else if (dmg==4) monsterz-=5;
 
else if (dmg==5) monsterz-=6;

Could just be:
Code: ags
monsterz-=(dmg+1);

Sorry I can't be more help - really very tired!

Crimson Wizard

#4
Well, you say:
Quote
Everything is working, except the XP TNL keeps giving odd and random numbers
Can you explain, how is it supposed to work, that is, for example, which numbers it should display, and which it displays in real, and why it is wrong?
I see some lines in the code which refer to "experience" and "required experience", but I can't tell is that right or not.

Quote
and I'd like to figure out how to make the damage dealt appear above the heads of both the player and the monster for a few brief seconds.
I would suggest using Textual Overlays, which is a very simple way to display a text at some point on screen for designated time.

You could use a helper function like this:
Code: ags

function DisplayDamageOverCharacter(Character *ch, int damage)
{
    // Get current character's view frame
    ViewFrame *vf = Game.GetViewFrame(ch.View, ch.Loop, ch.Frame);
    // Get size of frame's graphic
    int sprite_width = Game.SpriteWidth[vf.Graphic];
    int sprite_height = Game.SpriteHeight[vf.Graphic];
    // Create overlay aligned somewhere around character's top
    Overlay* o = Overlay.CreateTextual(ch.x + sprite_width / 2, ch.y - sprite_height - 10, 120, Game.SpeechFont, 15, "Damage = %d", damage);
    Wait(40 * 3); // wait about 3 seconds
    o.Remove();
}

You then call it like:
Code: ags

DisplayDamageOverCharacter(player, dmg);

or
Code: ags

DisplayDamageOverCharacter(cMonster, dmg);


EDIT: geork was faster, but I'll leave this.
Regarding your code in general. There's this sequence that should be changed into simplier formula:
Code: ags

if (dmg==0) monsterz-=1;
else if (dmg==1) monsterz-=2;
else if (dmg==2) monsterz-=3;
else if (dmg==3) monsterz-=4;
else if (dmg==4) monsterz-=5;
else if (dmg==5) monsterz-=6;

This should be replaced by:
Code: ags

monsterz -= dmg + 1;

This is a must do; otherwise your code will sprawl into monstruosity.

Construed

expierence3 is a label in which required_xp's value is supposed to show on the stat screen, required_XP is a global variable of 10 and increase factor is a global variable of 3 that multiplies the amount of required xp after each level. expierances and vexpierances are glob vars that point to 2 different gui's which both display the players total expierance.

Thanks a lot for the code, I will try it out now :)
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Khris

Code: ags
if (win==0)  goldshow += 0;
 
 
else if (win==1) goldshow += 0;
 
 
else goldshow += 0;


(Just wanted to put this here, in case anybody else had missed it.)

Gilbert

Quote from: Construed on Fri 27/09/2013 01:55:59
expierence3

The code is giving me headache :sad:. I've tried searching for this expierence3 in your posted codes but it's not found, only to realise that, after digging into the codes a bit, it's spelt expierance3 instead. So, please check also whether the spellings of the variables match, in case there are two different variables having similar names.

BTW, the correct spelling should be experience.

Crimson Wizard

Err, okay, slightly more polished code: ;)
Spoiler

Code: ags

function room_AfterFadeIn()
{
    //aBattle.Play();
    monsterui.Visible=true;  //displays monster and player life
    player.PlaceOnWalkableArea();
    //goblin.FollowCharacter(null);
    //goblin.ChangeRoom(302);
    object[1].SetView(56);
    object[1].Animate(0, 3, eOnce, eBlock);
}

function room_RepExec()
{
    //trying to ensure that required_xp shows up on stat screen as the characters TNL.
    expierance3 = Required_XP;
    if (health <= 15){
        Display("You look tired, You should rest!");
    }
  
    //changes the monsters health back to zero if it goes in the negatives.
    if (monhealth <= 0){
        monhealth=0;
    }

    //causes object0 which is representative of the character to animate doing a stab motion.  
    if (IsKeyPressed(eKeyUpArrow) == 1){
        object[0].Animate(0, 3, eOnce, eBlock);
        object[0].Animate(1, 3, eOnce, eBlock);

        //causes a mixture of random damage + strength for harder hits as str increases.
        int dmg = Random(6) + Random(strength);
        monsterz -= dmg + 1;
        object[1].SetView(56);
        object[1].Animate(0, 25, eOnce, eBlock);
        int dmg2 = Random(6);
        health -= dmg2 + 1;
    } else if (monsterz<=0) {
        player.PlaceOnWalkableArea();
        expierance += 10;  //int stores in a txt label to show total amount of xp
        Vexpierance += 10; //the same value shown in another gui
        Display ("You put up quite a fight! I'm worn out!" );
        Display ("You have gained %d expierance.",expierance );

        int p = player.PreviousRoom;
        player.ChangeRoom(p, 158, 148);

        //causes the player to level up
        if(Vexpierance >= Required_XP){ 
            level++;
            //increases the maximum amounts of the glob vars.
            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",level, strength, player_maxhealth, player_maxmana,player_maxstamina, goldshow );
            Required_XP = Required_XP * Increase_Factor; //increases the required xp per level
  
            //Required_XP = (Required_XP * 3) / 2;   // factor 1.5
            int win=Random(2);

            //depleted code, no gold is won from this battle.
            if (monsterz <= 0){
                if (win==0) goldshow += 0;
                else if (win==1) goldshow += 0;
                else goldshow += 0;
            }
        }
    }
}
  
function room_Load()
{
    aFight1.Play();
    //goblin.ChangeRoom(302);

    //fighter attack view
    if ((player.View==93)||(player.View==42)||(player.View==2)){
        player.ChangeView(85);
        object[0].SetView(82);
    }
    //thief attack view
    else if ((player.View==59)||(player.View==92)||(player.View==28)){
        player.ChangeView(87);
        object[0].SetView(84);
    }  
    //wizard attack view
    else if ((player.View==91)||(player.View==58)||(player.View==4)){
        player.ChangeView(86);
        object[0].SetView(83);
    }
}

function room_Leave()
{
    //fighter normal view
    if (player.View==85){
        player.ChangeView(2);
        CafeDo(String.Format("speed is %d %d", 3, 3));
        player.SetWalkSpeed(3, 3);
    }
    //wizard normal view 
    else if (player.View==86) {
        player.ChangeView(4);
        CafeDo(String.Format("speed is %d %d", 3, 3));
        player.SetWalkSpeed(3, 3);
    }
    //thief normal view
    else if (player.View==87) {
        player.ChangeView(28);
        CafeDo(String.Format("speed is %d %d", 3, 3));
        player.SetWalkSpeed(3, 3);
    }

    //removes the monster/player life from the screen.
    monsterui.Visible=false; 
    aFight1.Stop();  
}

[close]

Construed

Ok, I cleaned it up about the best I know how and removed the depleted functions from it.
As crimson suggested, cleaning it up helped me comprehend it a little better.
Unfortunately I cant use your code because when the fight scene starts the character view changes into a 1x1 transparent dot and the character takes control of an object with the "fight view" then when he leaves the character regains it's view.It's kind of crazy but when I first started I was trying to replicate QFG1 which used almost the same technique.

I also removed the unnecessary expierence3 glob var. 

I could just display the dmg with a display function but I'm definitely up for other suggestions on that, the existing code and also I would like to figure out how to make the damage more random and perhaps incorporate other statistics into the equation such as dexterity. I was thinking somehow I could add a counter to the up arrow key press or some kind of decimal based int that would cause the dex,weapon use,dodge to go up separately from the actual level and make it to where those statistics actually effect the battle.

I know both my code and way of speaking can be frustrating, So I thank you all greatly for bearing with me and for the help you've provided thus far!

Code: ags

// room script file


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

function room_RepExec()
{
   if (health <= 15)
{
Display("You look tired, You should rest!");


int p=player.PreviousRoom;
  player.ChangeRoom(p, 158, 148);
}
  
if (monhealth <= 0){
  monhealth=0;
}
  
if (IsKeyPressed(eKeyUpArrow) == 1){
  
  int dmg = Random(4) + Random(strength);
  int dmg2 = Random(4);
  
  object[0].Animate(0, 3, eOnce, eBlock);
  object[0].Animate(1, 3, eOnce, eBlock);
  
  monsterz -= dmg + 1;
  
  object[1].SetView(56);
  object[1].Animate(0, 25, eOnce, eBlock);

if (dmg2==0)  health-=0;
  
else if (dmg2==1) health-=02;

else if (dmg2==2) health-=03;

else if (dmg2==3) health-=04;

else if (dmg2==4) health-=05;

else if (dmg2==5) health-=06;

 }
 
else if (monsterz<=0) {
  player.PlaceOnWalkableArea();
  expierance += 10;
  Vexpierance += 10;
   Display ("You put up quite a fight! I'm worn out!" );
   Display ("You have gained 10 expierance.");
int p=player.PreviousRoom;
  player.ChangeRoom(p, 158, 148);


if(Vexpierance >= Required_XP){ 
 level++;

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

        }
      }
    }
  
function room_Load()
{
  aFight1.Play();
  
  //fighter attack view
   if ((player.View==93)||(player.View==42)||(player.View==2)) {
  player.ChangeView(85);
  object[0].SetView(82);
 }
  //thief attack view
   else if ((player.View==59)||(player.View==92)||(player.View==28)) {
    player.ChangeView(87);
    object[0].SetView(84);
  }
  //wizard attack view
  else if ((player.View==91)||(player.View==58)||(player.View==4)) {
    player.ChangeView(86);
    object[0].SetView(83);
}}

function room_Leave()
{
//fighter normal view
  if (player.View==85){
 player.ChangeView(2);
CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
  }
  
//wizard normal view 
  else if (player.View==86) {
    player.ChangeView(4);
    CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
  }
  
//thief normal view
  else if (player.View==87) {
    player.ChangeView(28);
    CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
}
 monsterui.Visible=false; 
   
   aFight1.Stop();
    
}

I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Crimson Wizard

#10
Quote from: Construed on Fri 27/09/2013 17:56:46
Ok, I cleaned it up about the best I know how and removed the depleted functions from it.
There's still one case of excessive if/else structure, you did replace the first one with "monsterz -= dmg + 1;", but there's another just few lines below:
Code: ags

if (dmg2==0)  health-=0;
else if (dmg2==1) health-=02;
else if (dmg2==2) health-=03;
else if (dmg2==3) health-=04;
else if (dmg2==4) health-=05;

It's a bit different, for it decreases health by 0 if dmg2 is 0 (the previous decreased monster health by 1 if dmg was 0). Not sure if this is what you want, but anyway, this may be simplified:
Code: ags

if (dmg2 > 0)
    health -= dmg2 + 1;


Quote from: Construed on Fri 27/09/2013 17:56:46
Unfortunately I cant use your code because when the fight scene starts the character view changes into a 1x1 transparent dot and the character takes control of an object with the "fight view" then when he leaves the character regains it's view.

Well, since the function needs only ViewFrame, not exactly character, you may easily convert the code from using character to using object. Or, one of alternatives (either character or object):
Code: ags

function DisplayDamageOverThing(Character *ch, Object *obj, int damage)
{
    if (ch == null && obj == null) {
        Display("DisplayDamageOverThing: function called with only null pointers!");
        return;
    }
    ViewFrame *vf;
    // Get current view frame from either character or object
    if (ch != null)
        vf = Game.GetViewFrame(ch.View, ch.Loop, ch.Frame);
    else
        vf = Game.GetViewFrame(obj.View, obj.Loop, obj.Frame);
    // Get size of frame's graphic
    int sprite_width = Game.SpriteWidth[vf.Graphic];
    int sprite_height = Game.SpriteHeight[vf.Graphic];

    int over_x;
    int over_y;
    if (ch != null) {
        over_x = ch.x;
        over_y = ch.y;
    } else {
        over_x = obj.X;
        over_y = obj.Y;
    }
    Overlay *o = Overlay.CreateTextual(over_x, over_y - sprite_height - 10, 120, Game.SpeechFont, 15, "Damage = %d", damage);
    Wait(40 * 3); // wait about 3 seconds
    o.Remove();
}

Then:
Code: ags

// Display damage for character:
DisplayDamageOverThing(cSomeCharacter, null, damage);
// Display damage for object:
DisplayDamageOverThing(null, oCombatObject, damage);



Quote from: Construed on Fri 27/09/2013 17:56:46
also I would like to figure out how to make the damage more random and perhaps incorporate other statistics into the equation such as dexterity. I was thinking somehow I could add a counter to the up arrow key press or some kind of decimal based int that would cause the dex,weapon use,dodge to go up separately from the actual level and make it to where those statistics actually effect the battle.
Hmm, well, while I think I understand what you are saying in general, I believe you should have an accurate plan written somewhere (explaining what behavior do you want, which formulas to use, etc); it is pretty difficult to give any code-related advice when you don't know what you want in detail.

Construed


What I was trying to achieve is a random factor to the damage, you see:   int dmg2 = Random(4);
and I was trying to assign a different damage to each of the 4 random results.
So that one time he may hit you for 3, the next time for 1 etc...
I don't understand how: health -= dmg2 + 1; could change the value of those 4 random results.
But I took you guys word for it because I suck at coding and math.

Code: ags

  int dmg2 = Random(4);

if (dmg2==0)  health-=0;
else if (dmg2==1) health-=02;
else if (dmg2==2) health-=03;
else if (dmg2==3) health-=04;
else if (dmg2==4) health-=05;



And thanks a lot for the code, It looks very hard but I'll tinker with it for awhile.
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Crimson Wizard

Quote from: Construed on Mon 30/09/2013 09:50:44
What I was trying to achieve is a random factor to the damage, you see:   int dmg2 = Random(4);
and I was trying to assign a different damage to each of the 4 random results.
So that one time he may hit you for 3, the next time for 1 etc...
I don't understand how: health -= dmg2 + 1; could change the value of those 4 random results.
But I took you guys word for it because I suck at coding and math.

Hmm, it is not a good idea to just believe into this ;).
To be honest, I do not fully understand why this causes confusion, but I'll try to elaborate.

You are getting a random factor "dmg2", which may take a value from the range of 0 - 4.
Then you are decide how much health to subtract, depending on dmg2. This means, that you are getting another value, let's call it "minus_health". We may present things this way for simplicity:

Code: ags

int dmg2 = Random(4);
int minus_health;

if (dmg2==0)  minus_health = 0;
else if (dmg2==1) minus_health = 2;
else if (dmg2==2) minus_health = 3;
else if (dmg2==3) minus_health = 4;
else if (dmg2==4) minus_health = 5;

health -= minus_health;


So, what you do is making a rule of relation between dmg2 and minus_health values (which way minus_health depends on dmg2).
What kind of rule it is?
If you look closer, you may notice that whichever dmg2 is, the minus_health is 1 larger:
- if dmg2 = 1, then minus_health = 2;
- if dmg2 = 2, then minus_health = 3;
etc
So, we may write this as a formula:
Code: ags

minus_health = dmg2 + 1;
health -= minus_health;


There is only one case when this relation is broken: if dmg2 = 0, then minus_health = 0 too; that's why we add an exception:
Code: ags

if (dmg2 == 0)
    minus_health = 0;
else
    minus_health = dmg2 + 1;
health -= minus_health;


Now we remove separate minus_health variable and simplify this even more:
Code: ags

if (dmg2 == 0)
    health -= 0;
else
    health -= dmg2 + 1;


Because there's no sense in subtracting 0, we simplify this even further:
Code: ags

if (dmg2 > 0)
    health -= dmg2 + 1;


Construed

Thanks for explaining it to me, It's best to have it explained on a forum like this, cause I seem to have a memory leak in my brain LOL.

I think I understand now and I have tested it and it appears that both the player and the monster receive random damages. I went ahead and changed the player function to the same code.

Code: ags

function room_AfterFadeIn()
{
//////displays monster/player health  
monsterui.Visible=true;   
player.PlaceOnWalkableArea();
///////sets the monsters view
object[1].SetView(56);   
object[1].Animate(0, 3, eOnce, eBlock);
}

function room_RepExec()
{
  
///////stops the battle if the players life is 15 or less
   if (health <= 15)   
{
Display("You look tired, You should rest!");

/////////sends the player back to the previous room
int p=player.PreviousRoom; 
  player.ChangeRoom(p, 158, 148);
}

///////makes the monsters health go back to 0 if its in the negatives
if (monhealth <= 0){     
  monhealth=0;
}
  
if (IsKeyPressed(eKeyUpArrow) == 1){
  
/////////player stabbing animation  
  object[0].Animate(0, 3, eOnce, eBlock);
  object[0].Animate(1, 3, eOnce, eBlock); 
  
//////makes the damages random  
  int dmg = Random(4) + Random(strength); 
  int dmg2 = Random(4);
  
///////distributes the players damage  
if (dmg > 0)  
  monsterz -= dmg + 1;  
  
///////monsters attack animation  
  object[1].SetView(56);
  object[1].Animate(0, 25, eOnce, eBlock);
  
////////distributes the monster damage
if (dmg2 > 0)
    health -= dmg2 + 1; 

 }
////////ends the battle when the monster runs out of life
else if (monsterz<=0) {
  player.PlaceOnWalkableArea(); 
///////adds 10 expierence, expierence is only a fake value to show exp on 2 gui's
  expierance += 10;     
  Vexpierance += 10;
   Display ("You put up quite a fight! I'm worn out!" );
   Display ("You have gained 10 expierance.");

///////returns player to previous room
int p=player.PreviousRoom;
  player.ChangeRoom(p, 158, 148);

///////////levels up when expierence reaches correct amount
if(Vexpierance >= Required_XP){ 
 level++;

///////adds to statistic values
  player_maxhealth += 1;
  player_maxmana += 1;
  player_maxstamina += 1;
  strength += 1; 
  dexterity += 1;
 
/////////displays what the player recieves upon leveling
  Display ("You have reached level %d And now have, %d strength, %d health, %d mana, %d stamina",level, strength, player_maxhealth, player_maxmana,player_maxstamina);

///////tripples the required xp to next level by increase factor which is a glob var set at 3
  Required_XP = Required_XP * Increase_Factor;

        }
      }
    }
  
function room_Load()
{
  aFight1.Play();
  
  //fighter attack view
   if ((player.View==93)||(player.View==42)||(player.View==2)) {
  player.ChangeView(85);
  object[0].SetView(82);
 }
  //thief attack view
   else if ((player.View==59)||(player.View==92)||(player.View==28)) {
    player.ChangeView(87);
    object[0].SetView(84);
  }
  //wizard attack view
  else if ((player.View==91)||(player.View==58)||(player.View==4)) {
    player.ChangeView(86);
    object[0].SetView(83);
}}

function room_Leave()
{
//fighter normal view
  if (player.View==85){
 player.ChangeView(2);
CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
  }
  
//wizard normal view 
  else if (player.View==86) {
    player.ChangeView(4);
    CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
  }
  
//thief normal view
  else if (player.View==87) {
    player.ChangeView(28);
    CafeDo(String.Format("speed is %d %d", 3, 3));
player.SetWalkSpeed(3, 3);
}

////////gets rid of displayed monster and player health
 monsterui.Visible=false; 
   
   aFight1.Stop();
    
}

I hope this is right because I hate being a dummy lol..

I'm trying and testing the new sprite function now :)

I would greatly appreciate any suggestions to make this code better and funner for the player.

I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

SMF spam blocked by CleanTalk