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 - NiksterG

#61
Wow, that code really did the trick! I still need to tweak it in parts so that it sorts the way I need it to in my particular game, but the actual sorting part worked excellently. Thanks so much!

NiksterG  ;D
#62
I'm actually using properties as the focus points of the sort. However, that's not really the problem. I can't seem to get the script right, because the indexes of the items are read-only. I guess the best way to put the question is, is there any way to get around the read-only-ness of the variables?

And by the way, I don't think properties are changable. At least, that's the message I got when I read about them in th manual.
#63
I'm making a collectible trading card game, where the player gets cards as inventory items. I want to have these cards able to be sorted by various aspects of those cards (attack, defense, type of card, etc). So far I've used a Bubble Sort, but the variables that I use (InvWindow.ItemCount, InvWindow.ItemAtIndex, etc) are read-only, and i can't update them. So then I tried to modify the contents of the Character.InventoryQuantity[] array, but then I have to call UpdateInventory() in order for it to be shown on screen, and that totally defeats the purpose of sorting it to begin with, since UpdateInventory resets all items back to their index based on the order they were created in the editor.

Does anyone have any idea how to sort inventory items well? Thanks in advance!  ;D
#64
I haven't tried your code yet, but just a question: would it actually look like the characters are jumping, or would they suddenly pop to the highest point in their jump and then pop back down? That's what happened everytime I tried to change the coordinates of the people without updating the scene. It looked like the characters were vibrating, rather than jumping.

I found an alternate solution, though: this article gave me the idea. Since Idleviews animate even during Wait commands, this worked out pretty nicely. the player moves (blocking) across the screen, therefore scrolling it. The people in the background bounce. Perfect. Thank you, BFAQ!!! :D
#65
Hi there!

I've finally finished my game so that it is playable. All I want to do now is add a small cutscene at the end that shows the credits. However, I'm not quite sure what to script...

I'm using textual overlays for the actual credits, and there's a scene in the background where there are some people jumping up and down in celebration. Then the screen scrolls over to the right and reveals even more celebrating going on. To make the screen scroll, I used the player character with an invisible view and had him walk to the right. The scrolling works very well, but the characters in the background don't do anything because of a wait command. I wanted to have them jump with the repeatedly_execute_always function, but their jumping function is blocking, so that doesn't work.

Here's the code I have: cPlayer = player character, cTga - cTgc = people jumping

Code: ags

// room script file

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: Player enters room (before fadein)

  cPlayer.LockView(35); // sets character view to invisible

#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for Room: Player enters room (after fadein)

  FadeIn(1);
	Wait(80);
	Overlay* credits1 = Overlay.CreateTextual(80, 120, 160, 3, 65472, "Title goes here");

	cPlayer.Walk(518, 152, eNoBlock, eAnywhere);
	Wait(400);
	credits1.Remove();
}
#sectionend room_b  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart room_c  // DO NOT EDIT OR REMOVE THIS LINE
function room_c() {
  // script for Room: Repeatedly execute

  int i=0;
  while (i<400) {
	  jump(cTga.ID, 125, 145);
	  jump(cTgb.ID, 80, 100);
	  jump(cTgc.ID, 180, 200);
              i++;
  }
}
#sectionend room_c  // DO NOT EDIT OR REMOVE THIS LINE



Code: ags

// global script

function jump(int characterID, int ymin, int ymax) { // characterID jumps from ymax to a height of ymin, then comes back down
  int i = 0;
  while (i<2) {
	if (character[characterID].y <= ymin) {
		while (character[characterID].y < ymax ) {
			character[characterID].y++;
			Wait(1);
		}
	}
	else if (character[characterID].y >= ymax) {
		while (character[characterID].y > ymin) {
			character[characterID].y--;
			Wait(1);
		}
	}
	i++;
	}
}


I will keep trying to come up with my own answer, but any help would be appreciated! Thanks  ;D
#66
I managed to create a single room where you can only pass through if you go through it in the correct order. This single room simulates the action of four different rooms. This is kind of useful if you want to save space and make your game a teeny bit smaller.

The code is ripped right out of my game, so I didn't bother changing some of the x or y coordinates, and room numbers, etc. I also used global ints to keep track of whether the player went the right way, but you can replace the GetGlobalInt() with InventoryQuantity[] or whatever you need.

Code: ags

// room script file

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for room: Walk off left screen edge
SetGlobalInt(5, 0); // reset number of correct turns because the player didn't go through correctly
cPlayer.ChangeRoom(21, 300, 170); // go to beginning
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for room: Walk off right screen edge
  
if ((GetGlobalInt(5) != 1) && (GetGlobalInt(5) != 3)) { // this direction is not correct right now
  FadeOut(10);
  cPlayer.StopMoving()
  cPlayer.x = 20;
  cPlayer.y = 170; //place player on opposite side of room; gives the illusion of a new room
  SetGlobalInt(5, 0); // wrong way, reset the number of correct turns
  Wait(1);
  FadeIn(10);
}
else if (GetGlobalInt(5) == 1) { //correct path
  FadeOut(10);
  cPlayer.StopMoving();
  cPlayer.x = 20;
  cPlayer.y = 170; //place player on opposite side of room; gives the illusion of a new room
  SetGlobalInt(5, 2); // correct path
  Wait(1);
  FadeIn(10);
}
else if (GetGlobalInt(5) == 3) {
  SetGlobalInt(5, 0); //reset correct path for next time player goes through the maze
  cPlayer.ChangeRoom(23, 20, 170); // finished maze, go to next room
}

}
#sectionend room_b  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_c  // DO NOT EDIT OR REMOVE THIS LINE
function room_c() {
  // script for room: Walk off bottom screen edge
if (GetGlobalInt(5) == 2) { // correct path
  FadeOut(10);
  cPlayer.StopMoving();
  cPlayer.x = 150;
  cPlayer.y = 80; //place player on opposite side of room; gives the illusion of a new room
  SetGlobalInt(5, 3);
  Wait(1);
  FadeIn(10);
}
else { // not the correct path
  FadeOut(10);
  StopMoving(PLAYER);
  character[PLAYER].x = 150;
  character[PLAYER].y = 80; //place player on opposite side of room; gives the illusion of a new room
  SetGlobalInt(5, 0); // reset number of correct turns
  Wait(1);
  FadeIn(10);
}

}
#sectionend room_c  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_d  // DO NOT EDIT OR REMOVE THIS LINE
function room_d() {
  // script for room: Walk off top screen edge
if (GetGlobalInt(5) == 0) { //correct path
  FadeOut(10);
  cPlayer.StopMoving();
  cPlayer.x = 160;
  cPlayer.y = 220; //place player on opposite side of room; gives the illusion of a new room
  SetGlobalInt(5, 1);
  Wait(1);
  FadeIn(10);
}
else { //not the correct path
  FadeOut(10);
  cPlayer.StopMoving();
  cPlayer.x = 160;
  cPlayer.y = 220; //place player on opposite side of room; gives the illusion of a new room
  SetGlobalInt(5, 0);
  Wait(1);
  FadeIn(10);
}

}
#sectionend room_d  // DO NOT EDIT OR REMOVE THIS LINE


Sorry if that's a bit long and hard to understand... This is my first time I've ever tried to help someone rather than asking for help myself.  :P

For this particular maze, the player (cPlayer) needs to go North, East, South, East in order to pass through the maze. Hope this helps!
#67
Okay, I'm really sorry to bring this thread up to the front again after it seemed to be solved, but I have a question. This has been happening to me, too, and I noticed that the midis only play while WMP is on in the background. Assuming that Aesir's conclusion is correct, how would I disable the muting of the synth channel after turning off WMP? Or do I have to check it manually each time before I launch my game?  ???

Again, sorry I'm bringing this to the front again, but I figured it'd probably be better to post here than to make a whole new thread.
#68
This is really weird... I'm only 16, but apparently I've the memory of an old grandpa. I actually did forget to import the function in the script header. That's the reason that one function was working and the others weren't; it was in the script header. However, i completely forgot to put the other functions there. I suppose this is what happens when I lose access to the sacred AGS manual... :P

By the way, Ashen, that link worked, I can now read the .chm file. All I had to do was uncheck the "Always ask when opening this file" box. Heh, I feel like a dork now... ;D

Thanks for the help!
#69
I'm making my own functions in the global script. However, they are not working at all whenever i call them in other rooms. I've made one other function before, and that one worked (and still is), but all the new functions I'm making don't do anything. And I'm not getting any errors, either, unless I call the functions in room scripts.

This is my code for one of the functions that don't work:

Code: ags
function transtohuman() {
        GUIOff(6);
        PlaySound(9);
          if (character[PLAYER].view == 10) { //from dragon monster view
            SetCharacterView(PLAYER,  10);
            AnimateCharacterEx(PLAYER, 3, 5, 0, 1, 1);
          }
          else if (character[PLAYER].view == 8) { //from Tree Dweller view
            SetCharacterView(PLAYER, 10);
            AnimateCharacterEx(PLAYER, 0, 5, 0, 1, 1);
          }
          else if (cPlayer.View == 14) { //from bird
            cPlayer.LockView(10);
            cPlayer.Animate(4, 5, eOnce, eBlock, eBackwards);
          }
          else if (cPlayer.View == 16) { //from dragon
             cPlayer.LockView(10);
             cPlayer.Animate(5, 5, eOnce, eBlock, eBackwards);
          }
          else if (cPlayer.View == 22) { //from seer
            EnableCursorMode(eModeInteract);
            cPlayer.LockView(10);
            cPlayer.Animate(6, 5, eOnce, eBlock, eBackwards);
          }
        SetCharacterView(PLAYER, 10);
        if (GetGlobalInt(2) == 1) {
          AnimateCharacterEx(PLAYER, 2, 5, 0, 0, 1);
          SetCharacterViewEx(PLAYER, 6, 0, ALIGN_CENTRE);
          cPlayer.SetWalkSpeed(5, 5);
          SetCursorMode(0);
        }
        else{
          AnimateCharacterEx(PLAYER, 1, 5, 0, 0, 1);
          SetCharacterViewEx(PLAYER, 1, 0, ALIGN_CENTRE);
          cPlayer.SetWalkSpeed(5, 5);
          SetCursorMode(0);
        }
}


It's supposed to be an animation sequence that shows transformation into a human from various other forms... yes, i realize some of the script is AGS 2.62 and some is AGS 2.72... but that shouldn't make a difference. Does it? That's the last thing I have to try yet, and then I'm lost.

Any help is appreciated!

And a side question which is not as important... my .chm help file (the manual) doesn't work anymore. Is this because I have IE7 now instead of IE6? Thanks again.
#70
I agree with Khris. When I started AGS, I stayed as far away from the scripting language as possible. However, I realized that a lot of the things I wanted to do in my game couldn't be done just in the interaction editor. I followed the tutorial in the AGS manual and now, though I'm by far no expert, I at least know what people are talking about in these forums ;).

So, I'd bigtime recommend taking the time to go through the scripting tutorials in the manual. After all, if you do get stuck, the great AGS community is here to help.
#71
I can try the workaround and see how that affects my game. Otherwise, I'll just wait for an updated version of AGSÃ,  ;) Thanks for your help!
#72
Just a quick question... Is it possible to set antiglide on/off for just one character instead of for the whole game? I know you can change the game options, but I'm talking about for one specific character.
#73
Thanks alynn, I tried your code, and after a little bit of editing (adding a lockview to stop animation) I got it to work perfectly. And thanks for the idleview help, too... I wouldn't have checked there  :P

Thanks everyone else for your help!
#74
I tried to do what you suggested, changing the blockingstyle and objects, and I tried having it in repeat, among other things. They don't work. The only thing I can think of doing is making a whole new view, but I don't want to do that unless absolutely necessary. Isn't there some way I can change the character.x value or something while he's moving to make him face a certain direction? The best way I can describe it is having the character do a moonwalk.

Also, i have a question about blinking views. I want there to be a bird which is always in the air. In other words, when the bird is not moving anywhere (standing), I want him to be flapping his wings repeatedly. I tried to use blinking view and the blinkinterval property, but it doesn't make the player do anything. Is that because the blinking view can't be the same as the normal view?

Thanks for any help.
#75
In my game, the main character climbs up a ladder, and then back down again later. The going up part is easy; I just have cplayer.walk(...) and he goes the right way. But when he comes down again, he's not facing the ladder. I tried using FaceLocation before he moves, and I also tried animate the character and move him at the same time. These didn't work. Any suggestions?
#76
I used the search function to see if it was possible to make the game play part in greyscale. I found out it couldn't, but it recommended using TintScreen(100, 50, 0) to make the screen look like an aged photo. (This is the topic.) However, when I go to the rooms where the Tintscreen has effect and I display a message, the mouse cursor gets rid of the tintscreen effect around it. Is there any way to change this?
#77
If you want to have it happen in every room, yes, then it would go under the global script. (under repeatedly_execute, I believe). However, if you want to have it happen only in one room, then it goes in that room's script under repeatedly_execute.
#78
Okay, so is there a specific type of file that is best for sprites, since they are not compressed? (Other than jpegs... they look really bad.Ã, :P)

(Oh, by the way: Happy Birthday, strazer!)
#79
Thank you, this is helpful. I have figured out the volume slider. However, I would like to know what the default game speed is. Can somebody tell me, or show me how to make it display on the screen?

EDIT: Never mind, I figured it out. You have to set the debug feature Frames per Second, and that's the game speed. (Correct me if I'm wrong.)
#80
I am a huge fan of the King's Quest Series, and would like to integrate the basic format into my game. One of the things I am having the most trouble with are the sliders. From the research that I've done, I know that I am supposed to use the GetSliderValue command in the interface_click section of the global script. Other than that, I am clueless as to what I am supposed to script. I need sliders specifically for game speed and music volume. If anyone can help, that would be greatly appreciated.
SMF spam blocked by CleanTalk