Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Matti

#2101
Unfortunately that wasn't the problem. I temporarily disabled the while loop but the game was still damn slow...
#2102
I'm working on a fighting scene where the player fights against an AI character. Scriptwise everything seems to work fine but if the character is standing or walking near the enemy the game REALLY slows down and it's almost impossible to play. Since this can hardly be a matter of my PCs memory or anything similar I guess that certain parts of my script are written too badly for letting the game run smoothly.

Well, here's the script for the enemy movement (which is the only relevant part I guess). It would be nice if somebody could take the time and go through it and then let me know if the script could be improved in a way to make the game run normally.

Code: ags


//    --------- aiming ---------

if((character[1].View==1)||(character[1].View==4)){
if((gzielx==character[1].x)&&(gziely==character[1].y)&&(gziel==false)){
 a=Random(20);
  if ((character[1].x>=cEgo.x+100)&&(a>=10)){            // to the right of the player
    gzielx=cEgo.x+130;gziely=cEgo.y;gziel=true;
  }
  if ((character[1].x<cEgo.x+100)&&(a>=10)){              // to the left of the player
    gzielx=cEgo.x-130;gziely=cEgo.y;gziel=true;
  }
  
  if a<10){
    while ((Region.GetAtRoomXY(gzielx, gziely) != region[1])){            // somwhere
      gzielx=30+Random(700);gziely=300+Random(270);gziel=true;
    }
  }
}   
}

//    --------- moving ---------

if (gziel){
  gziel=false;
  character[1].Walk(gzielx, gziely);     
}

if((gzielx>=character[1].x-2)&&(gzielx<=character[1].x+2)){gzielx=character[1].x;}
if((gziely>=character[1].y-2)&&(gziely<=character[1].y+2)){gziely=character[1].y;}

//    --------- strikes ---------

if((character[1].View==1)||(character[1].View==4)){

  if((character[1].y>cEgo.y-15)&&(character[1].y<cEgo.y+15)){
   a=Random(1);
    if((character[1].x>cEgo.x+60)&&(character[1].x<cEgo.x+160)){ 
      gzielx=character[1].x;gziely=character[1].y;
      character[1].FaceCharacter(cEgo);
      if (a==0) {gschlag="links"; character[1].ChangeView(2);}   // normal strike left
      if (a==1) {gschlag="links"; character[1].ChangeView(3);}}   // upper strike left
    if((character[1].x<cEgo.x-60)&&(character[1].x>cEgo.x-160)){ 
      gzielx=character[1].x;gziely=character[1].y;
      character[1].FaceCharacter(cEgo);
      if (a==0) {gschlag="rechts"; character[1].ChangeView(2);}  // normal strike right
      if (a==1) {gschlag="rechts"; character[1].ChangeView(3);}} // upper strike right
  }
}
//--------- normal view after strike animation

if((character[1].View==2)||(character[1].View==3)&&(character[1].Frame==4)){
  character[1].ChangeView(1);
}
// ----- character looks either left or right ------------

if ((!player.Moving)&&((character[1].View==1)||(character[1].View==4))) { 
  if (character[1].Loop == 1 && character[1].NormalView != LEFT) character[1].ChangeView(LEFT);
  if (character[1].Loop == 2 && character[1].NormalView != RIGHT) character[1].ChangeView(RIGHT);
}
// -------- strike animations are played -------------

if(gschlag!=""){ 
  if(gschlag=="links"){character[1].Animate(1, 2,  eOnce,  eNoBlock);}
  if(gschlag=="rechts"){character[1].Animate(2, 2, eOnce,  eNoBlock);}
  gschlag="";
}
#2103
Quote from: ShadowRifter666 on Mon 02/02/2009 03:13:32
you say put the
Code: ags
character.Visible = false 

at the beginning, where would be the beginning

Just put it in the room's beforefadein-section.

Quote from: ShadowRifter666 on Mon 02/02/2009 03:13:32
[...] and would the code apply to all 6 characters, and what is the code to select one character to appear and become the main character

Well, the command is for one character only but you can just write it for all 6 characters. The code for one character to appear is the exact same, just set it to "true" instead of "false"...

To make a character the player character use character.SetAsPlayer();

EDIT:

You don't have to make 6 characters. Just use ONE player character and change its look assigning one of six views to it using Character.ChangeView(view).
#2104
Can you post the relevant script where the variable is used?

And did you create the variable via the global variable's pane?
#2105
Quote from: ShadowRifter666 on Sun 01/02/2009 21:32:06
i just need to now remove the class select GUI that appears first and remove the characters that appear onscreen before the character is selected.

In the GUI's panel you can change the appearance and e.g. select "normal, initially off". As for the character: Just set character.Visible to false in the beginning and to true when a class or the gender is selected.
#2106
General Discussion / Re: Bullshit marketting
Sun 01/02/2009 15:40:21
Quote from: Mods on Sun 01/02/2009 15:28:34
Maybe it's just me or do some marketting campaigns take people for absolute fools?

Isn't that what marketing is all about? Especially TV- and radio-Ads....
#2107
General Discussion / Re: Backup
Fri 30/01/2009 15:37:59
Quote from: SSH on Fri 30/01/2009 14:27:05
Quote from: Buckethead on Fri 30/01/2009 10:40:45
And I really don't see why I should back up my entire harddisk. I've never had a situation where I suddenly lost it all.
No-one has a hard disk die... until they do


Exactly. I never thought that my hard disc would die and that's why I didn't make backups. Yeah, and now I've lost everything and suddenly can't understand why I never made backups.
#2108
It's a  flying robot equipped with sensitive antennas, two grapplers and a triple missile launcher. Beware!


#2109
General Discussion / Re: Backup
Fri 30/01/2009 09:54:27
Well, I never really took backups of my stuff. Once I saved my GiP onto my extern hard drive but unfortunately deleted it again some day. Well, and a month ago my PC's hard drive crashed and A LOT of stuff I worked on is gone, not only my AGS game.

From now I'll burn a CD once in a while with all my important stuff and as long as I'm working on my new AGS project regularly I'm backing up the game every 2-3 days. I won't let something like this happen EVER again.
#2110
Critics' Lounge / Re: Cliff Shading
Thu 29/01/2009 23:16:09
Quote from: Raider on Thu 29/01/2009 05:15:14
Also do you think the 2nd largest pyramid looks odd in its angle?

Yes!
#2111
Cool, thank you both.
#2112
I know how to save text to an extern .txt file and I know how to save ints but is it possible to save ints as a written text? I want to know how the NPCs in my RPG develop throughout the game and it would be very handy if I could just look at a saved textfile after playing to see the character values written down.

WriteRawLine(string text) doesn't let you include variables and WriteInt can't be used with a textfile, so is there any other way?
#2113
Quote from: teenage_musings on Sat 31/05/2008 12:01:26
thank you!
I found it XD just goes to show how  careful you have to be in AGS, I forgot 1 bracket and it screwed my whole game up ><"

This has nothing to do with AGS but rather with programming in general.
#2114
Post the error message and the relevant script in the beginners technical forum.
#2115
Quote from: Rentin on Wed 28/01/2009 23:24:22
Like I said above, I think they got resized when I uploaded to flickr to post them on here. Normally I use photobucket but it just hasnt been working for me lately. The backgrounds are really 640X480.

Just use this site to upload your pics.
#2116
Quote from: jakerpot on Wed 28/01/2009 16:00:08
he don't get a trophy ???

Trophies weren't supplied so no one's getting one.  ;) Every competition is different.
#2117
Quote from: woot52 on Tue 27/01/2009 22:22:18
Quote from: matti on Tue 27/01/2009 22:06:15
Also, please don't start several threads with the same content. And note that capital letters don't make the thread look important.
sorry it was more of an accident that I posted twice

Okay then. Some newbies think that they'll get the answers quicker if the start more than one thread.
#2118
Also, please don't start several threads with the same content. And note that capital letters don't make the thread look important.
#2119
Don't wait for me, I won't be able to post an entry today...
#2120
Can you post the whole room 3 script? And did you have a look at line 138 and everything relevant before that?
SMF spam blocked by CleanTalk