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

#1121
Glad it works. :)
#1122
Where have you put the "AreCharactersColliding" code?
#1123
Yep, my AGS crashes too if I try to import them. It works after I opened and saved them again in the GIMP.
#1124
#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  // put anything you want to happen every game cycle here
}if ( IsKeyPressed ( 377 ) == 1 )
// right cursor key pressed

Remove that brace and put it at the end of the rep_ex function:

}
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
#1125
Works fine here.
How and where do you import it exactly?
What colour depth and resolution do your games have?
Could you please upload the gif you're trying to use?
#1126
No prob.
#1127
It's because the second-to-last bold closing brace I added is missing in your code:

Code: ags

    if (button == 4) {
      if (GetPlayerCharacter() == SOF) DisplaySpeech(SOF, "You're already playing as me.");
      else {
        SetPlayerCharacter(SOF);
        GUIOff (GUI3);
        SetDefaultCursor();
      }
    }

// missing closing brace here so GUI4 gets included in GUI3:

    if (interface == GUI4) {
      if (button ==0) {
        GUIOn(3);
        SetMouseCursor(6);
      }


Use proper indentation and you will catch such mistakes better.
#1128
Which line does the error message point to?
Btw, this code only works with AGS v2.7 and above.
#1129
  if (interface == GUI3) {

    if (button == 0) {
      if (GetPlayerCharacter() == EGO) DisplaySpeech(EGO, "You're already playing as me.");
      else {
        SetPlayerCharacter(EGO);
        GUIOff (GUI3);
        SetDefaultCursor();
      }
    }

    if (button == 1) {
      if (GetPlayerCharacter() == KOKO) DisplaySpeech(KOKO, "You're already playing as me.");
      else {
        SetPlayerCharacter(KOKO);
        GUIOff (GUI3);
        SetDefaultCursor();
      }
    }

    if (button == 2) {
      if (GetPlayerCharacter() == ZIRI) DisplaySpeech(ZIRI, "You're already playing as me.");
      else {
        SetPlayerCharacter(ZIRI);
        GUIOff (GUI3);
        SetDefaultCursor();
      }
    }

    if (button == 3) {
      if (GetPlayerCharacter() == KAJ) DisplaySpeech(KAJ, "You're already playing as me.");
      else {
        SetPlayerCharacter(KAJ);
        GUIOff (GUI3);
        SetDefaultCursor();
      }
    }

    if (button == 4) {
      if (GetPlayerCharacter() == SOF) DisplaySpeech(SOF, "You're already playing as me.");
      else {
        SetPlayerCharacter(SOF);
        GUIOff (GUI3);
        SetDefaultCursor();
      }
    }

  }

  if (interface == GUI4) {
    if (button ==0) {
      GUIOn(3);
      SetMouseCursor(6);
    }
  }
#1130
Quote from: sameeralord on Tue 21/06/2005 12:58:58Thanks for the help but I still don't know how to do it. I'm new to this sripting business and could you please explain bit more.

Where you have to put the code depends on when you want the character start chasing the player.
If you want it to start at the beginning of the game, put it into the game_start function (menu "Script" -> "game_start").
If you want it to happen when the player interacts with a certain object, for example:
- Load the room
- Go to the Room/Objects pane
- Select the object
- Click the "Interaction..." button
- Right-click "Interact with object"
- Choose "New action..."
- Select "Run script"
- Click the "Edit script..." button
- Paste the code

Quote from: sameeralord on Tue 21/06/2005 12:58:58By the way how do I do something like you got 10 minutes or you'll die. Style in abstructed 10 minutes.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=17017

Edit:

Code: ags

  cArmyguya.FollowCharacter(player);


Code: ags

  if (cArmyguya.IsColldingWithChar(player) == true) {
    player.ChangeRoom(6);
  }
#1132
AGS supports this. Go to General settings and change the speech style to Sierra-style. The character talking view has to be this portrait.
#1133
Quote
How do you script that when you are playing the first adult croc (EGO) and clicks on his GUI button nothing will happen or maybe execute a DisplaySpeech commando: "Hey, you're already playing as me."?

AGS v2.7:

Code: ags

  if (player == cEgo) cEgo.Say("You're already playing as me.");
  else cEgo.SetAsPlayer();


AGS <=v2.62:

Code: ags

  if (GetPlayerCharacter() == EGO) DisplaySpeech(EGO, "You're already playing as me.");
  else SetPlayerCharacter(EGO);
#1134
What are you having problems with, specifically? If you get an error message, please post it.
#1135
Post if you have something to show, this is pointless.
#1136
This is probably the default behaviour for right-clicks on inventory items. You can customize this by checking the "Handle inventory clicks in script" checkbox in the General settings and adding something like this to your global on_mouse_click function:

Code: ags

//...
//}
  else if (button == eMouseLeftInv) { // if left mouse button clicked on an inv item
    inventory[game.inv_activated].RunInteraction(mouse.Mode);
  }
  else if (button == eMouseRightInv) { // if right mouse button clicked on an inv item
    inventory[game.inv_activated].RunInteraction(eModeLookAt); // this is the standard behaviour, change as desired
  }
//else {   // right-click, so cycle cursor
//...

#1137
Making a character follow another:

Code: ags

  cWelder.FollowCharacter(player); // check manual for options, also check out game.following_room_timer variable


Check continously if characters are colliding (Menu "Script" -> "repeatedly_execute"):

Code: ags

  if (cWelder.IsColldingWithChar(player) == true) {
    Display("Game over!");
  }
#1138
Try this:

Code: ags

// room script

#define AREA_NUM 2
#define AREA_SCALING_TOP 100
#define AREA_SCALING_BOTTOM 10
#define AREA_EDGE_TOP 100
#define AREA_EDGE_BOTTOM 190

function repeatedly_execute_always() {
  //...

  if (GetWalkableAreaAt(player.x - GetViewportX(), player.y - GetViewportY()) == AREA_NUM) {
    int scaling = AREA_SCALING_BOTTOM + (((AREA_EDGE_BOTTOM - player.y) * (AREA_SCALING_TOP - AREA_SCALING_BOTTOM)) / (AREA_EDGE_BOTTOM - AREA_EDGE_TOP));
    SetAreaScaling(AREA_NUM, scaling, scaling);
  }

  //...
}
#1139
1.) You can set the background to animate by adding background frames to the room, then use SetBackgroundFrame(0); in "Player enters screen (before fadein)" to pause the animation at the specified frame and finally use SetBackgroundFrame(-1); to start the animation.

If you need different delays for each frame, check out this thread.

2.) You can change the transition behaviour in the General settings pane, but if you only need it for one particular situation, you can do this:

Code: ags

  SetNextScreenTransition(eTransitionInstant);
  player.ChangeRoom(1);
SMF spam blocked by CleanTalk