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

#81
Thought I should say that I've made a patch for this game. Changed the story a bit and changed some sprites. It's available here.
;)
#82
Never mind code works. Explaination in above post.
#83
Wow, that was fast. Thanks Akatosh, however I'm having a problem. Here's my code.

Code: ags

function wackCheck(int Char) {
  spot = Random(3);
  Char = Random(1); // I have two characters at the moment and need them to randomly appear
  cJess.Transparency = 100;
  cDaniel.Transparency = 100;
  
  if (spot == 0) {
  character[Char].x = 60;
  character[Char].y = 287;
  }
  else if (spot == 1) {
    character[Char].x = 448;
    character[Char].y = 143;
  }
  else if (spot == 2) {
    character[Char].x = 224;
    character[Char].y = 128;
  }
  else {
    character[Char].x = 314;
    character[Char].y = 378;
  }
  character[Char].Transparency = 0;
  SetTimer(2, 80); //Reset timer
}


I call the funtion with
Code: ags

wackCheck(0); // The 0 is there because I HAVE to specify an integer


The problem is that only the character with the ID of 0 (cJess) appears (still appears at one of the random coordinates, so that's not a problem). Otherwise neither character appears. Is this because character[Char] is getting called differently everytime the line appears?

EDIT - Never mind. Code above works perfectly. cDaniel wasn't in the room. Sorry about that.
#84
I'm making a Wack-a-Mole type game, but I'm making sprites in the likeness of people I know, thus I have more than 1 character. I've already put a function pre-setting the coordinates for the character to appear.

Code: ags

function wackCheck() { // I'm guessing that something has to go in the parenthesis.
  spot = Random(3); // spot is defined in the global script header as it's used in rooms as well as the global script
  
    if (spot == 0) {
    Char.x = 60;
    Char.y = 287;
  }
    else if (spot == 1) {
      Char.x = 448;
      Char.y = 143;
    }
    else if (spot == 2) {
      Char.x = 224;
      Char.y = 128;
    }
    else {
      Char.x = 314;
      Char.y = 378;
    }
    Char.Transparency = 0;
}


How can I tell the function that 'Char' represents a random character?
#85
Thank you both for that.
Using Mazoliin's method. Seems more logical to make it a character function.
#86
I've made a function which enables gravity depending on a boolean (which is a global variable). This is the code:

Code: ags

//Boolean is called gravOn

function Gravity(int ground, int pixelFall) //ground is where the floor meets the wall. pixelFall is how many pixels the character will drop
{  
  if (gravOn == true) {
    if (player.y < ground) {
      player.y += pixelFall;
    }
  }
}


What I want to know is how to set it for just the one character and setting which character in the function parameters.

EG.
Code: ags

Gravity(player, 313, 3);


How would I set it up so I can choose a character based on their script-o name?
#87
You can split the game resource files when it's finished. There's an option in general settings to split the game into to x MB chunks. Don't know if that would help any though. Haven't used it myself. Also, what format are the videos? AVIs tend to be very large. You could convert them to MPG or OGG Theora.
#88
Steps:

1. Enter name.
2. Press submit button.
3. Enter this code for the button:

Code: ags

player.Name = textbox.Text;


For displaying the character's name on a label:

Code: ags

label.Text = String.Format("%s", player.Name);


Hope it helps.  ;)
#89
When I try to build/debug my game I get this error:

Dialog 1(55): Error (line 55): buffer exceeded: you probably have a missing closing bracket on a previous line

I tried to find out where I went wrong, but I can't see anything I may have done.
I've marked where line 55 is in the code below.


Code: ags

 if (GetGlobalInt(0) == 0) {
   cStk.Say("If you need me I'll be in the library.");
   player.Say("OK.";
   cStk.Walk(5, 164, eNoBlock);
   Wait(120);
   player.FaceCharacter(cStk, eBlock);
   cStk.Walk(5, 164, eBlock);
   cStk.Transparency = 100;
   cStk.FaceLocation(cStk.x, cStk.y-1, eBlock);
   cStk.ChangeRoom(3, 293, 104);
   cStk.Transparency = 0;
   SetGlobalInt(0, 1);
   dExplainations.Start();
 }
 else {
   player.Say("Bye.");
   cStk.Say("See ya."); //Line 55
 }


What have I done?  :-\

EDIT: Never mind. Fixed it. Notice that under the If it says: player.Say("OK.";
Sorry for wasting a topic.  :-[
#90
Just do this which is much easier:

When you need to enter the name:

Code: ags

player.Name = Game.InputBox("!Enter your name:");


Then when you have to show the name in speech or a message:

Code: ags

Display("Hello %s", player.Name);

cNpc.Say("Hello %s", player.Name);


If you need to show it on a label:

Code: ags

lblName.Text = String.Format("Player's name: %s", player.Name);
#91
Quote from: ESGmaster on Tue 24/02/2009 04:02:31
function iRUGERP94_UseInv()
{
  if (player.ActiveInventory.Name=i9mmclip10);
  {
     Ruger_P94_Ammo = Ruger_P94_Ammo + 10;
     player.LoseInventory (i9mmclip10);
  }
   else Display ("No");
}

It should be:

Code: ags

function iRUGERP94_UseInv() {
  if (player.ActiveInventory.Name == i9mmclip10) {
    Ruger_P94_Ammo = Ruger_P94_Ammo + 10;
    player.LoseInventory(i9mmclip10);
  }
  else {
    Display("No");
  }
}


(Braces are moved around so you can understand the last part of the message below)

You need 2 equals signs when checking a variable and 1 equals sign when setting a variable. You also don't need a semicolon ( ; ) when you are writing functions. Basically, when writing a function (in this case it's ActiveInventory) you need a brace (both opening and closing) instead of a semicolon.

It's hard for me to explain. Do you understand what I mean?
#92
If you are trying to run a key press outside of on_key_press you need to use IsKeyPressed. Search for it in the manual, but here's a sample code anyway.

Code: ags

if (IsKeyPressed(65) == 1) { // If 'A' is pressed
  //run script here
}


Look in the manual for ASCII Code Table to see what key codes correspond to what keys.

I hope this has been helpful. It's harder to explain than I thought.  :P
#93
Quote from: Metalowy on Tue 20/01/2009 20:23:32
gGui2.Visible = false didnt work (little improvisation ;))

Change false to true.
Turn the Iconbar off (the walk, talk, interact GUI) off, type this into game_start in your GlobalScript:

Code: ags

gIconbar.Visible = false;


Then to turn it back on type true instead of false.
#94
Your problem is here:

Code: ags

 if (oBlacksquare.Visible = true)


It should be:

Code: ags

if (oBlacksquare.Visible == true)


When checking a variable you need a double "=" sign. When setting a variable you only need one.
By the way, if an object is invisible then you can't click on it anyway so I don't see why you need the check in the first place.
#95
That's brilliant dkh. Good work.
#96
Check your grammar. It's game, not Game. Small 'G'. Programming languages are fussy about that stuff.  ;) As the error says: (remember, capital letters are important).
#97
The problem is that you're displaying the pause after the character's line. I don't think Ghost's second method would work at all in any condition. Try this:

1. Remove the code Ghost gave you from game_start

2.
Code: ags

function hPots_Look()
{
  game.text_speed = 10; //Makes speech stay on screen longer, but you can make it lower if you want
  cEgo.Walk(375, 315, eBlock, eWalkableAreas);
  cEgo.Say("Empty pots.");
  //Wait(80);
  cEgo.FaceLocation(352, 378, eBlock);
  game.text_speed = 15; // Set text speed back to it's default setting.
  cEgo.Say("I guess there was something in them but not anymore.");
}


Is that what you were after?
#98
With AGS as is it's not possible, but there was a module I found a while back that allowed you to do this. I don't remember what it was called and, because of that, can't find it in the module forum (though I thought I'd remember it when I saw it). Search for yourself. It should still be there.
#99
It's saying "Unidentified symbol 'y'" Because this is what you have:

Code: ags

function hHotspot6_Interact()
{
   if (door_unlocked) player.ChangeRoom(2, x, y); // The letters in the brackets of the change room function are the problem here.
   else player.Say("The door is locked.");
}


Change those to the coordinates you want the player to teleport to in room 2.

E.G:
Code: ags

function hHotspot6_Interact()
{
   if (door_unlocked) player.ChangeRoom(2, 160, 140);
   else player.Say("The door is locked.");
}
#100
General Discussion / Re: Christmas Thanks!
Wed 24/12/2008 07:17:14
Merry Christmas everyone and Happy New Year.  ;D
SMF spam blocked by CleanTalk