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

#21
There already is a KeyboardMovement Module which seems to work OK, but the more the merrier I suppose - especailly if you can add to it somehow.

I think the current Coding Comp would've been a good place for some of these ideas - maybe whoever wins it can extend the RPG theme?
#22
Positively Pythagorean!
Can you actually use the ^ operator like that, though? If so - or if you used Maths.RaiseToPower - that'd give you the advantage of a circular checking area (wouldn't it? my maths is a bit rusty), which would probably be more accurate than the square.

buloght:
Would it not be more efficient still to pass the character(s) and a distance, and have Intersect() work out px1, py1, etc ...?

Code: ags

if (Intersect(who, 20) == true) {
...
}


Code: ags

function Intersect(int chara, int distance) {
  int x1 = player.x - distance;
  int x2 = player.x + distance;
  int y1 = player.y - distance;
  int y2 = player.y + distance;
  if (character[chara].x < x1) return false;
  if (character[chara].x > x2) return false;
  if (character[chara].y < y1) return false;
  if (character[chara].y > y2) return false;
  return true;
}


I know I've missed a few parameters out, but frankly they confused me some.
#23
I think the manual is quite exact: ASCII Codes.
It's nice to have the letters broken down like that, but - although it's not mentioned - letters, numbers and space can be refered to without using the exact code - just surround them with apostrophes (') e.g.:
Code: ags

if (IsKeyPressed('X') == 1) {

NOTE: As it says in the manual, all letters must be uppercase. Although you can use lowercase letters in strings e.g. with StrSetCharAt() (they're 97 - 122), all keypresses are handled as uppercase - 'x' wouldn't work. And, obviously, things like backspace, Ctrl-Q, return and so on can't be used this way.


Akumayo, I'm not sure if it'll work properly with those OR operators (||), I think they all need to be &&. At least, that's the way I've always done it, and it works - feel free to ignore me if ORs work as well.

To make it simpler than checking every possible characters, you could use a while loop, e.g. (off the top of my head, and totally untested):
Code: ags

//on_key_press
if (keycode == 'X') {
  int who;
  while (who < MAX_NUM_CHARACTERS) { // Set the number as needed, use a define, or GetGameParameter
    if (character[who].Room == player.Room) { // Make sure they're in the same room
      if ((player.x <= (character[who].x + 20) && player.x >= (character[who].x - 20)) && (player.y <= (character[who].y + 20) && player.y >= (character[who].y - 20))) {
        //If character[who] is within 20 pixels of player, talk to them, and stop checking.
        character[who].RunInteraction(eModeTalkto);
        return;
      }
    who ++;
  }
}


You could possibly add a check to see it the character has a talkto interaction. And you might also want to check which way the player is facing, in case you have a situation where more than one character is near enough to the player to trigger the interaction. (NOTE: Currently, it'll only talk to the character with the lowest number - if character[4]
and character[7] are both there, 7 will be ignored - another good reason to add those checks.)
#24
Two things:
First, change the 'default' colour of the label on the ACTION GUI to dark green (2 should do it).

Then, open the Global Script ('Script -> Edit Global Script'  or Ctrl-G), and scroll down to around line 30.
You should see two lines like this:
Code: ags
#define ACTION_LABEL_COLOR_NORMAL	 5//	Used in highlighting the action bar.
#define ACTION_LABEL_COLOR_HIGHLIGHTED 	13

Change the 5 to 2, and the 13 to 10.

You might have/want to play with the numbers a little, to get exactly the shades you want - get the numbers from the 'Palette' window of the editor - but that should be it.
#25
For some reason you've got two if (interface == MAINGUI) conditions, and two for if (interface == INVENTORY). The INVENTORY ones aren't so important - there don't seem to be any conflicts, it just looks odd. However, one of the MAINGUI's isn't closed properly so everything down to the second INVENTORY condition ('Close down the Inventory') probably won't run (Ctrl-B to check braces, to see what I mean).

Try changing (I've added some comments):
Code: ags

  if (interface == MAINGUI) { // NOTE: MAINGUI opened

// Setting cursor modes:
//-----------------------------------------------------
    if (button == 0)  SetMode(GIVE);
    if (button == 1)  SetMode(PICKUP);
    if (button == 2)  SetMode(USE);
    if (button == 3)  SetMode(OPEN);
    if (button == 4)  SetMode(LOOK);
    if (button == 5)  SetMode(PUSH);
    if (button == 6)  SetMode(CLOSE);
    if (button == 7)  SetMode(TALK);
    if (button == 8)  SetMode(PULL);
   
//-----------------------------------------------------
    if (interface == MAINGUI) { // NOTE: MAINGUI opened again, for some reason
      if (button == 9)  GUIOn(INVENTORY);
    } // NOTE: Second MAINGUI closed
//-----------------------------------------------------   

// Options GUI
//-----------------------------------------------------
if (interface == OPTIONS) { // NOTE: First MAINGUI _still open_


to:

Code: ags

  if (interface == MAINGUI) { // NOTE: MAINGUI opened
// Setting cursor modes:
//-----------------------------------------------------
    if (button == 0)  SetMode(GIVE);
    if (button == 1)  SetMode(PICKUP);
    if (button == 2)  SetMode(USE);
    if (button == 3)  SetMode(OPEN);
    if (button == 4)  SetMode(LOOK);
    if (button == 5)  SetMode(PUSH);
    if (button == 6)  SetMode(CLOSE);
    if (button == 7)  SetMode(TALK);
    if (button == 8)  SetMode(PULL); 
//-----------------------------------------------------
    if (button == 9)  GUIOn(INVENTORY);
  } // NOTE: MAINGUI closed
//-----------------------------------------------------   

// Options GUI
//-----------------------------------------------------
if (interface == OPTIONS) {


I can't see why you can't turn the INVENTORY GUI off, though - unless there's another problem with the braces somewhere. It's probably worth giving them a thorough checking - when in doubt, always check your braces.
#26
You need to limit the NewRoom commands to running when a mode other OPEN or CLOSE is used. Try:
Code: ags

if (UsedMode(CLOSE)){
   if (GetPlayerCharacter() == BERN){
     MoveCharacterToObject(BERN,1);
     }
   if (GetPlayerCharacter() == LAVE){
     MoveCharacterToObject(LAVE,1);
     }
   if (GetPlayerCharacter() == HOAG){
     MoveCharacterToObject(HOAG,1);
     }
  PlaySound(30);
  ObjectOn(1); 
  DisableHotspot(1);
}

else if (UsedMode(OPEN)) Display("It's already open.");  

else NewRoomEx(4,74, 115); 


Also, couldn't you condense the 'CLOSE' condition to:
Code: ags

if (UsedMode(CLOSE)){
  MoveCharacterToObject(GetPlayerCharacter(),1);
  PlaySound(30);
  ObjectOn(1); 
  DisableHotspot(1);
}

instead of those if.. statements, since it does the same whichever character you're using.
#27
That's because it's a game template, not a GUI. You'll have to start a new game using that template (as Scummy just said) to get at the GUI - you can always export it from there if you want to use it in a game you've already started, but keep in mind there's probably some related scripting you'll need to copy over as well.
#28
I think your last question was a bit vague, which is why no-one answered. Read the GUI section of the BFAQ, and maybe Darth mandarbs Custom Inventory thread, for some pointers, then ask back if there's something specific you don't undersatnd.

1. To stop it appearing on start up, got to the GUI window, and set the 'Visible' property to 'Popup Modal'. OR, leave it set to 'Normal', and add a GUIOff() command to the game_start function, or in the Player enters screen (before fade-in) of the first room. Then, you'll need to have something (e.g. akey press, or a button on another GUI) that turns it on when you want it.

2. You probably need to set up the interactions for the different modes for each inventory item, on the Inventory' window of the editor. By default, 'Use'ing the item will set it as active, and changes the cursor graphic to reflect that.
#29
I think it's something like this (but with the right GlobalInts, and GUI / Label numbers, of course):

(in rep_ex)
string mana;
string exp;
StrFormat (mana, "%d", GetGlobalInt (2));
StrFormat (exp, "%d", GetGlobalInt (3));
SetLabelText (0, 1, mana);
SetLabelText (0, 2, exp);

And make two blank labels on the GUI.
#30
Hey, been registered for about a week, lurking for a couple months, posted around a bit, just thought I'd post up with the other newbies. Hope to be around for a while, and I may even make a game, eventually.
SMF spam blocked by CleanTalk