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

#1
Quote from: GarageGothic on Wed 17/02/2010 16:45:44
Check out the Tween module, it lets you do non-blocking fades without worrying about scripting your own timer.

I don't know if I'm ready to spoil myself with modules yet. Maybe after I've messed around with it some more, I'll give it a try. Thanks for the suggestion, I've saved the link.

EDIT:

Hey, check it out, it works now. I just moved the Jiva commands is all.

Code: ags

function die() {
    StopMusic();
    PlayMusic(5);
    cJiva1.ChangeRoom(player.Room, player.x, player.y);
    cJiva1.Walk(Random(340), 0, eNoBlock, eAnywhere);
    int trans = player.Transparency;
while (trans < 100) {
  trans++;
  player.Transparency = trans;
  Wait(1);
}
    gDead.Visible = true;
    gDead.Centre();
    mouse.Mode = eModePointer;
}


It looks great, thanks guys.
#2
Well, I almost have it working. And it looks pretty good except my NPC (Jiva1) doesn't Walk anywhere. I think it's because of the Wait(1). I need that for the transparency. If I eBlock Jiva1's Walk, then he will walk fine but player will never fade out. It's just several Jiva1s after another coming out of him forever. It looks bizarre. I was hoping that while player fade's out, Jiva1 floats out. Other than that it looks fine. I suppose I'll have to implement a timer in there somehow. Any suggestions on that?

Code: ags

function die() {
    StopMusic();
    PlayMusic(5);
    int trans = player.Transparency;
while (trans < 100) {
  trans++;
  player.Transparency = trans;
  cJiva1.ChangeRoom(player.Room, player.x, player.y);
  cJiva1.Walk(Random(340), 0, eNoBlock, eAnywhere);
  Wait(1);
}
    gDead.Visible = true;
    gDead.Centre();
    mouse.Mode = eModePointer;
}


With the above code, he appears and animates, he just doesn't move to any location.
#3
Whenever my playable character dies in the game, I wanted him to fade out, while his soul (now in his position floats off the screen. Originally, I thought the soul would just be another view. But I don't know how to fade one view into another, so I devised making the soul an NPC and well, basically, here's the die function I made in the global...

Code: ags

function die() {
    StopMusic();
    PlayMusic(5);
    int trans = player.Transparency;
while (trans < 100) {
  trans++;
  player.Transparency = trans;
  cJiva1.FollowCharacter(player, FOLLOW_EXACTLY, 1);
  cJiva1.Walk(Random(340), 0, eNoBlock, eAnywhere);
  Wait(1);
}
    gDead.Visible = true;
    gDead.Centre();
    mouse.Mode = eModePointer;
}


Because I don't know what room the player will be in or what screen position he'll be in when he dies, it's difficult for me to figure how to bring the NPC (Jiva1)  in. The reason I've used FollowExactly is so that he'll appear directly behind the player. And then after the player fade's out, there's the NPC floating away. But again, how do I script "bring cJiva1 into player's current room on player's current position"?

I was up all night working on this and am ready to give up on it altogether.
#4
Quote from: NsMn on Sun 14/02/2010 19:05:37
what you need is a Label. Create one and then use

Code: ags
LabelName.Text="You were attacked by Sally the Sandworm. Nom nom nom";



My game crashed with the following message: ---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x0043FBE7 ; program pointer is +379, ACI version 3.12.1074, gtags (147,3)

AGS cannot continue, this exception was fatal. Please note...etc.

It did the same when I was experimenting with using Displays for the same purpose. Here's my script...

Code: ags

  if (IsTimerExpired(3)){
    StopMusic();
    PlayMusic(5);
    gDead.Visible = true;
    gDead.Centre();
    LabelDead.Text="blah";
  }


EDIT:

My bad! The crash has nothing to do with the label at all. It crashes without it, though I can't remember doing anything different since the last time I tested it, which is pretty frequent. I'll get to the bottom of it.

EDIT ONCE MORE:

Ha Ha! It works! Silly me. I was trying to choose a font I don't have, that's why it crashed. It works perfectly. Thanks a lot man!
#5
Sorry to be having another problem so soon (I've actually had several but solved them using available resources), can't find any info on this one though...

I have a GUI called gDead which would appear when the player dies. It enables him to restore or quit. That works fine. Basically, I would very much like it to display a different message according to the way in which he dies. For example, a chicken pecks him to death, so it would say "You 'pecked' the wrong the choice" or something corny along those lines (the Quest for Glory games used to do the same). I already made a text box on my GUI even though I understand this is for the player to enter text. Here's what I have in my GlobalScript under the repeatedly_execute:

Code: ags

  if (IsTimerExpired(3)){
    StopMusic();
    PlayMusic(5);
    gDead.Visible = true;
    gDead.Centre();
  }


I was hoping I could put a command at the end specifying what text I'd like displayed, but I don't see anything in the call box, nor would I expect it to be that easy. Any ideas? Thanks.
#6
Good call. First I forgot the eAnywhere, then when I got that, I forgot the speed. I knew it was a simple eff-up on my part. Thanks everyone.
#7
Well I tried the eAnywhere, and this time it crashes with the following message:
Error: Object.Move: Invalid BLOCKING parameter

Code: ags

function hImpact_Interact()
{
cPup.Walk(397, 349, eBlock);
cPup.FaceLocation(373, 212, eBlock);
Wait(10);
cPup.SetWalkSpeed(20, 20);
cPup.AnimationSpeed = 1;
cPup.Walk(374, 255, eBlock);
PlaySound(5);
cPup.SetWalkSpeed(6, 6);
cPup.AnimationSpeed = 4;
cPup.Move(376, 265, eBlock);
oFrame.Move(158, 161, eBlock, eAnywhere);
}


When I leave the blocking out, it neither crashes or freezes, but my object doesn't move. What concerns me is that when I begin typing oFrame as a command, it is not usually listed in the pop-up list, but oFrame_Interact is. However sometimes oFrame is listed even though I don't do anything different. I've already made sure that oFrame is labeled correctly.

EDIT:

Okay, I went ahead and deleted the oFrame.Move command, deleted the oFrame_Interact function, re-typed the oFrame.Move command, then reapplied the oFrame_Interact function. Now everything looks exactly the same, except it works fine. All the interact function had under it was a walk-to and a display message but for some reason it was the source of the problem, not sure how though. But anyway, now it works.
#8
Basically, after the player interacts with a hotspot, I have animations that perform perfectly, until an object is supposed to move, then my game freezes. Also, when I was typing the script command: oFrame, it gave me a choice of "oFrame_Interact" and when I typed the period, it automatically put in "oFrame_Interact" and I don't know why, but that may have something to do with the problem. Here is my code...

Code: ags

function hImpact_Interact()
{
cPup.Walk(397, 349, eBlock);
cPup.FaceLocation(373, 212, eBlock);
Wait(10);
cPup.SetWalkSpeed(20, 20);
cPup.AnimationSpeed = 1;
cPup.Walk(374, 255, eBlock);
PlaySound(5);
cPup.SetWalkSpeed(6, 6);
cPup.AnimationSpeed = 4;
cPup.Move(376, 265, eBlock);
oFrame.Move(358, 161, 1, eBlock);
}


It's probably something simple I'm not seeing. I'm returning to AGS after a hiatus and maybe I've forgotten a few things. I've already consulted the manual and did a search on the forums and have not came up on a solution. Anyone got any ideas? Much appreciated.
#9
Hi. First off, I apologize if this has been covered. But I've searched the forums to no end. All I want to do, is assign keys to play particular sounds. In the global script under the function on_key_press I have
if (keycode == 'A') PlaySound(1);
I am replacing the mouse modes that are set with the default, as I have no playable character anyway and am trying to turn my keyboard into a musical instrument. I've also tried
if (keycode == eKeyA) PlaySound(1);
What am I doing wrong?

Code: ags

function on_key_press(eKeyCode keycode) {
  // The following is called before "if game is paused keycode=0", so
  // it'll happen even when the game is paused.
  
  if ((keycode == eKeyEscape) && gRestartYN.Visible) {
    //Use ESC to cancel restart.
    gRestartYN.Visible = false; 
    gIconbar.Visible = true;
    // If the panel's not ON, then the player must have gotten here by tapping F9,
    // therefore his cursor needs restoring. If the panel IS on, then it doesn't,
    // because it's already a pointer. Get used to thinking like this!!
    if (!gPanel.Visible) mouse.UseDefaultGraphic(); 
    return;
  }
  if ((keycode == eKeyEscape) && gPanel.Visible) {
    // Use ESC to turn the panel off.
    gPanel.Visible = false; 
    mouse.UseDefaultGraphic();
    gIconbar.Visible = true;
    return;
  }
  if ((keycode == eKeyEscape) && (gSaveGame.Visible))
  {
    // Use ESC to close the save game dialog
    close_save_game_dialog();
    return;
  }
  if ((keycode == eKeyEscape) && (gRestoreGame.Visible))
  {
    // Use ESC to close the restore game dialog
    close_restore_game_dialog();
    return;
  }
  
  if (keycode == eKeyReturn) { 
    // ENTER, in this case merely confirms restart
    if (gRestartYN.Visible) RestartGame();
  }

  if (IsGamePaused() || (IsInterfaceEnabled() == 0))
  {
    // If the game is paused with a modal GUI on the
    // screen, or the player interface is disabled in
    // a cut scene, ignore any keypresses.
    return;
  }

  // FUNCTION KEYS AND SYSTEM SHORTCUTS
  if (keycode == eKeyEscape) {
    // ESC
    gPanel.Visible = true; 
    gIconbar.Visible = false;
    mouse.UseModeGraphic(eModePointer);
  }
  if (keycode == eKeyCtrlQ)  QuitGame(1);   // Ctrl-Q
  if (keycode == eKeyF5) show_save_game_dialog();   // F5
  if (keycode == eKeyF7) show_restore_game_dialog();  // F7
  if (keycode == eKeyF9) {
    // F9, asks the player to confirm restarting (so much better to always confirm first)
    gRestartYN.Visible = true;  
    gIconbar.Visible = false;
    mouse.UseModeGraphic(eModePointer);
  }
  if (keycode == eKeyF12) SaveScreenShot("scrnshot.bmp");  // F12
  if (keycode == eKeyTab)   show_inventory_window();  // Tab, show inventory

  // GAME COMMAND SHORTCUTS
  if (keycode == 'A') PlaySound(1);
  if (keycode == 'L') mouse.Mode=eModeLookat; //Note that all we do here is set modes.
  if (keycode == 'U') mouse.Mode=eModeInteract; //If you want something else to happen, such as GUI buttons highlighting,
  if (keycode == 'T') mouse.Mode=eModeTalkto; //you'll need some more scripting done.
  if (keycode == 'I') mouse.Mode=eModeUseinv; //But this will, as-is, give you some standard keyboard shortcuts your players will very much appreciate.

  // For extra cursor modes, such as pick up, feel free to add as you will.
  // Uncomment the line below if you use the "Pick Up" mode.
  //if (keycode == 'P' || keycode == 'G') mouse.Mode=eModePickup; 

  // DEBUG FUNCTIONS
  if (keycode == eKeyCtrlS)  Debug(0,0);  // Ctrl-S, give all inventory
  if (keycode == eKeyCtrlV)  Debug(1,0);  // Ctrl-V, version
  if (keycode == eKeyCtrlA)  Debug(2,0);  // Ctrl-A, show walkable areas
  if (keycode == eKeyCtrlX)  Debug(3,0);  // Ctrl-X, teleport to room
  if (keycode == eKeyCtrlW && game.debug_mode) 
    player.PlaceOnWalkableArea(); //Ctrl-W, move to walkable area 
}


Alright, there it is. But all it is is just the default script. The only modification I've made so far is changing the keycode 'A' to playing a sound. The sound is an mpg in my Sounds folder titled, sound1
#10
I'm not contributing to any solution, but I just wanted to add on this subject that I've noticed an option in the general settings panel that mentions saving games with screenshots and have wondered about it. I thought AGS handled it automatically and I had clicked it to true with no results. I guess there's more to it eh?
#11
QuoteIt looks like
a) all other images are cropped to the top-left image's dimensions if they're bigger
b) moved inwards if they're smaller.

Right, I've noticed that. I'm playing around with importing different sized sprites now, because my text is not centered but closer to the left bottom edges. However it produces a strange effect, indescribable really.

EDIT: Finally I've got it the way I want it. I've had to use 4 border images: 15x15 for the Left middle & bottom, 25x15 for the Bottom center, 22x15 for the Right bottom and center, and a transparent for the 3 tops. So if anyone runs into the same problem I have, here's the solution. Thank you Kris for pointing me in the right direction.
NOTE: Changing the dimensions in the GUI properties doesn't seem to produce any effect at all.
#12
I've already made my custom text window. I used a transparent image to cover the border images. So then, does that mean, the larger the border images, the larger the margins? For my 8 border images there are 4 layout measurements: Height, Left, Top, Width.  They all seem to have inconsistent values. Do I need to increase all of them? For the image in the bottom center I tried increasing the height by 80, and there was no change at all.

EDIT: As far as I can tell, the top and left refers to the positioning of the image, such as distance from the top and left. I think the height and width is the actual size of each image. I just tried replacing my transparent sprite with a solid black one (the same color as my window), and still after changing the values of height and width, I don't see any change.

Just imported a larger sprite and I can see a dramatic change, however, my text remains closer to the bottom and left edges than the top and right. Would I then have to import slightly smaller sprites for those edges? Let me see...

Hmm, that looks a little weird. Well, I'll play with it some more tomorrow. Basically I just don't know if I'm going about this the long and wacky way so I just thought I'd ask you guys if you knew a simpler way. Thanks.
#13
The text in my text windows is awfully close to the edge, and I was wondering if there is a way to set the margins. Since I recently imported a font I wanted, it looks much worse, but I didn't like it even with the default font and would like to adjust it somehow. I have found many threads concerning text windows, but none seem to address the issue of margins or alignment. Thanks.
#14
General Discussion / Re: About Dreams...
Mon 18/05/2009 05:33:37
This is an old thread but I wanted to make mention of the sleep paralysis. I've had it at least a hundred times to be sure. I was very interested in the phenomenon, so I used to keep a journal every time it happened, making note of every condition and factor that can contribute to it. Most of the times I've had it, I've gone to bed late and had been extremely tired. Also, when I drink too much coffee before bed I sometimes have it. I found that once I break free of it and go back to sleep I re-enter the state. However, if I change sleeping positions, it usually won't reoccur. Perhaps the most interesting thing about it is while I was keeping the journal, I was having it more and more regularly. For some reason an idea struck me that if I stopped documented it and paying attention to it, I wouldn't have so much and so I stopped my journal and the paralysis stopped with it. At least for a while. Now I have it occasionally. And it is still terrorfying and I'll never get used to the experience. I have noticed also that while in the paralyzed state, sound is received much louder and warped than in the normal state.

I should also mention to those who have never experienced it, it is not a dream in the usual sense. The feeling of panic and terror come from the realization that you are awake and lying in bed but cannot move. The paraysis occurs upon awakening. Sometimes I'm given the impression that I can move a little, but I suspect this is a trick of the mind to reassure itself. I should like to video tape myself one day while under to see if I really can move a little.

I apologize to anyone who has a problem with people replying to ancient threads, but I'm new to this forum and was reading this thread and wanted to say something.
#15
QuoteNever hurts to learn new functions and ways to use them.
True that. It's my wish to learn everything I possibly can. And you guys are a huge help. Thanks again.
#16
Kris' suggestions worked beautifully. I did not know about Timers. Thank you. As for Trent's suggestion of the DoOnceOnly, when I was reading about it in the manual, they present the example in an "if" statement, and was wondering where I would place it; in the room script or in the global? I'm just not very clear on that. Here's my two scripts as they are right now:

the global
Code: ags
function cButt_Interact()
{
cPup.Walk(479, 218, eBlock);
cButt.Walk(500, 127);
cButt.AddWaypoint(557, 303);
cButt.AddWaypoint(441, 385);
cButt.AddWaypoint(37, 353);
SetTimer(1, 280);
}

the room
Code: ags
function room_RepExec()
{
if (IsTimerExpired(1)) {
  oFrogEatFly.SetView(16);
  oFrogEatFly.Animate(0, 2, eOnce, eBlock);
  cButt.ChangeRoom(2, 583, 450);
  oFrogEatFly.SetView(17);
  oFrogEatFly.Animate(0, 2, eOnce);
  }
}

So I'm not very clear on how to use the DoOnceOnly, despite having read about it in the manual. Also, Trent, you mentioned the use of Regions. cButt is a NPC. Is it true that NPC's can activate regions? Because wouldn't the Region Function, WalksOnto, for example, apply only to the playable character? Sorry guys if I'm making this more complicated than it really is. I'm trying to understand scripting the best I can. And yes, Mr.Matti, I'll modify my posts from now on, I can see how multiple posts can be annoying and space consuming. Thanks guys.
#17
NO! I was completely wrong. I still see that Wait cursor. I guess it's the blocking on the animation, I don't know. I just don't know anymore.
#18
AHA HA HA! I did it! I gave my object an extra standing frame with a delay of 280 in place of the Wait command. It looks awesome. By the way NsMn, thanks for the tip about object
  • in the global, I'd still be lost without that. Until next time...
#19
I threw a Wait command on there and now it works. I guess it tries to run the if stuff while my character is still walking, when it wouldn't meet the conditions. Initially, I thought when those conditions became available then it would run the rest of the script. My new code:
Code: ags
function cButt_Interact()
{
cPup.Walk(479, 218, eBlock);
cButt.Walk(500, 127);
cButt.AddWaypoint(557, 303);
cButt.AddWaypoint(441, 385);
cButt.AddWaypoint(37, 353);
Wait(280);
if (cButt.Moving == false) {
  object[0].SetView(16);
  object[0].Animate(0, 0, eOnce, eBlock);
  cButt.ChangeRoom(2, 583, 450);
  object[0].SetView(17);
  object[0].Animate(0, 0, eOnce, eBlock);
  }
}

However, I really don't like using Wait or any blocking because then the player expects something to happen and the eventuality of the frog eating the butterfly becomes obvious. If anyone knows a way or a trick to continue the gameplay during the butterfly's (cButt) long flight but not necessarily through my quick object animation, please let me know. Thanks.
#20
No, the object still doesn't animate. Here's the code:
Code: ags
function cButt_Interact()
{
cPup.Walk(479, 218, eBlock);
cButt.Walk(500, 127);
cButt.AddWaypoint(557, 303);
cButt.AddWaypoint(441, 385);
cButt.AddWaypoint(37, 353);
cButt.Clickable = false;
if ((cButt.Clickable == false)&&(cButt.Moving == false)) {
  object[0].SetView(16);
  object[0].Animate(0, 0, eOnce, eBlock);
  cButt.ChangeRoom(2, 583, 450);
  object[0].SetView(17);
  object[0].Animate(0, 0, eOnce, eBlock);
  cButt.Clickable = true;
  }
}

I have objects in other rooms also with the number 0, how does it know which object to animate?
SMF spam blocked by CleanTalk