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

#2641
Search and you shall recieve:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=16833.0

Ignore my post, it doesn't work - scroll down to Scorpiorus', which has a downloadable example. As jetxl said though, it takes a bit of advanced programming, and you might want to master the basics first.
#2642
In the interaction editor, Conditional - If inventory item was used, in scripting use an if statement, and the player.activeinv variable, e.g.
Code: ags

if (player.activeinv == 1) { // if the key is item 1 
  DisplaySpeech (NPC, "Thanks! In you go.");
  NewRoom (2);
  // Or whatever you want to happen
}
#2643
Actually, there's a simpler way: NewRoomNPC(CHAR, ROOM, X, Y);
In the interaction editor, you want Character - Move NPC to a different room and Character - Move character.

And, it would take too long to explain the 'whole GUI thing' - it's a very broad subject. Like Goot said, read through the manual first, then you can ask again if you have any specific questions.
#2644
I think you want SetSliderValue(GUI, OBJECT, VALUE), e.g.
Code: ags

if (player_inwater == 1)
{
   if (counter < 99)
      counter++;
   else
   {
      player_air--;
      SetSliderValue (AIRGUI, 0, player_air);
      counter = 0;
   }
}
#2645
It's hard to say exactly, without seeing the spoilers (or maybe I'm just nosey), but the two most obviouss ways would seem to be:
Make a 'Bending and Talking' view, then change to that temporarily.
Code: ags

SetCharacterSpeechView (0, BENDTALK);
DisplaySpeech (0, "Hey, how'd this get here?");
SetCharacterSpeechView (0, TALK);


Or, some combination of AnimateCharacter/Ex and DisplaySpeechBackground, e.g (not tested, so don't quote me on this):
Code: ags

SetCharacterView (0, 6); // Assuming view 6 has the anim you want
DisplaySpeechBackground (0, "Hmm, what have we here?");
AnimateCharacterEx (0, character[0].loop, 3, 0, 0, 1); // Character will animate while saying last line.
AddInventory (3);
DisplaySpeech (0, "I found a spoon. Good for me!"); // Clears the background speech. 
//Could also be more AnimateCharEx & DisplaySpeechBG commands.
ReleaseCharacterView (0);

It might take a little fiddling to sync up the animation and the pause you need to make the speech readable. I think there've been a few posts in the past dealing with animations during DisplaySpeechBackground, so search up one of them for more details.
#2646
I'm just glad someone else can see it blurring, I thought my eyes had broken.
Posting the code as text would probably be easier, but from what I can make out:

1) You can use Character numbers instead of names in SetCharacterView, so I don't think Zooty's suggestion works. Is it definately character 0 you want to change? It might be worth changing it to the script name anyway - it makes it easier to see what commands link to what character.
2) It looks like you've got some DisplaySpeech commands in there? I don't think SetCharacterView affects the speech view, so you may need to change that to 6 at the beginning (and back again afterwards, of course).

Although, when the code's readable, it may be something completely different.
#2647
I think you're right,  the repeated FaceCharacter commands are blocking the idle view from happening
I've tested this, so I'm fairly sure it works. Whether it's exactly what you want ...

First, in the 'Player enters room' interaction, create a timer:
Code: ags

SetTimer (1, GetGameSpeed()*30);

Assuming you want 30 seconds between animations - I think that's the default. If not, change GetGameSpeed()*30 to GetGameSpeed()*whatever.

Then, in rep_ex:
Code: ags

if (IsTimerExpired (1)==1) {
  SetCharacterView (BOY, IDLEVIEW);
  AnimateCharacter (BOY, character[BOY].loop, 3,0);
  ReleaseCharacterView (BOY);
  SetTimer (1, GetGameSpeed()*30);
}

else if (character[BOY].animating == 0) FaceCharacter (BOY, EGO);  //i.e. won't run during idle anim

Changing IDLEVIEW the the number of the view you want to use, and GetGameSpeed()*30 if needed.
#2648
I don't know if you can do it through the Interaction Editor, you probably have to use scripting. Look these up:
GetHotspotAt (character[CHARID].x, character[CHARID].y);
GetWalkableAreaAt (character[CHARID].x, character[CHARID].y);


e.g. (in repeatedly_execute):
Code: ags

if (GetHotspotAt (player.x, player.y) == 1) {
  //Do something
}
else if (GetHotspotAt (player.x, player.y) == 2) {
  //Do something else
}

#2649
Beginners' Technical Questions / Re: Enemies
Wed 23/02/2005 13:44:19
You might find these functions handy:
AreCharactersColliding (char1, char2);
AreThingsOverlapping (thing1, thing2);


AreThingsOverlapping might be better, as it allows you slightly more control over how close they are before it's triggered. AreCharactersColliding uses baselines, and the results are sometimes a little odd (check the manual for more details).
#2650
For non-changing view:
SetCharacterView locks the view, so it can only be changed by another script command, and not the 'change player view when on this area' box. (This is explained better in the SetCharacterView entry in the manual.) Try using ChangeCharacterView (EGO, 10) instead. Who knows, that might even fix the other problem. I doubt it, but you never know.
#2651
I knew that. Honest. When I said 'you', I meant 'the person using the code', it just looked like I meant you because yours was the last post. Yeah, that's it. Anyway, unless you're the 'other forum member who needed help', the code's for some third person anyway.

Whatever, glad I could help.
#2652
Radiant:
But doesn't a map have to be 256 colour to import, even though it only uses the 16? I tried that (saving as 16 colour) a while ago, and it said there was a problem with the colour depths. Mind you, that was with an earlier version, so it might've changed now.

EDIT: It does, in fact, work. Sorry, just ignore this post.
#2653
Unless it's just the program I'm using, all your colours are in the last 16 pallete slots (240 - 255), which makes them out-of-bounds for map imports (as TerranRich and Gilbot have said). The palette in this version should be about right (again, with the program I'm using - an old version of Paint Shop Pro):
http://www.2dadventure.com/ags/walkmask2.pcx
#2654
I'm not sure, but there might also be a problem with the 'or' functions in the rep_ex - at least, I usually get one when I use so many conditons, but that might just be me.
Anyway, couldn't you simplify it to:
Code: ags

function repeatedly_execute() {
  // put anything you want to happen every game cycle here
  if ((overhotspot == 0) && (GetLocationType (mouse.x, mouse.y) != 0)){
  //if the mouse is over a hotspot, object, or character
    overhotspot = 1;
  }
  else { //if the mouse isn't over a hotspot, object, or character
    overhotspot = 0;
  }
}


In fact, you could probably just use GetLocationType in on_mouse-click, and skip the rep_ex bit completely.

Code: ags

function on_mouse_click(int button) {
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button==LEFT) {
    if (GetLocationType (mouse.x, mouse.y) != 0) { // if the mouse is over a hotspot, object, or character
      ProcessClick (mouse.x, mouse.y, GetCursorMode ());
      if (GetCursorMode () != MODE_USE) SetCursorMode (MODE_USE);
    }
    else ProcessClick (mouse.x, mouse.y, MODE_WALK); // if the mouse isn't over a hotspot, object, or character
  }
  else if (button==RIGHT) {  //Look at the thing.
    ProcessClick(mouse.x, mouse.y, MODE_LOOK);
  }
}

I've compressed the code a little as well, hope you don't mind. I tested it, and it works for me. If it doesn't work for you for some reason, or if I've got the wrong end of the stick, just ignore it.
#2655
Before anyone else says it: RTFM. Particularly the 'Importing your own sprite graphics' section:
Quote
If you move the mouse over the image, you'll notice a rectangle following the cursor around. This is the portion of the image that will be imported when you click the left mouse button. To resize the rectangle, click and drag the right mouse button. Or, you can import the entire image with the "Grab entire image" button.
#2656
So, is this solved, or not?
I think Radiant's sugestion was to use SetGUIClickable (GUI, clickable) to deactivate the other onscreen GUIs. If so, it might work, but it'd be a bit cumbersome, IMO. (If that wasn't it - Sorry Radiant.)

What if you add something to on_mouse_click to make it ignore off-GUI clicks, like this:

Code: ags

function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if ((IsGUIOn (GUINAME)) && (GetGuiAt (mouse.x, mouse.y) != GUINAME)) {
    // GUI is open, but hasn't been clicked on, so do nothing
  }
  // could add more 'else if's if you have this problem with other GUIs
  else if (button == LEFT) {
  // etc ....


LENGTHY EDIT:
(I know it's been a while, but I had computer problems, and only just found this thread again. That's why I'm editing, rather than making a new post.)
I think this is about the first time I've posted something I wasn't totally sure of without bothering to test it, and look what happens...

I think the basic idea can be salvaged though, if you forget on_mouse_click, and edit interface_click:
Code: ags

function interface_click(int interface, int button) {
  if (IsGUIOn (QUITGUI) == 1){
    if (interface == QUITGUI) {
      if (button == 1) QuitGame (0);
    else GUIOff (QUITGUI);
    }
  }
  else {
    //all other GUI scripts
    //only runs when QUITGUI isn't on
  }
}


I've tested this version, and it works fine except with buttons set to 'Set Cursor Mode', which don't use interface_click. I'm also not sure how it'd work in OO scripting, since interface_click is now obsolete.
#2657
Beginners' Technical Questions / Re: GUI help
Mon 14/02/2005 13:23:09
You've pasted it outside of interface_click, and missed out a few braces. It should be more like this:
Code: ags

function interface_click(int interface, int button) {
Ã,  if (interface == CLICKGUI) {
Ã,  Ã,  if (button == 0) {
Ã,  Ã,  Ã,  if (GetGUIAt (15, 55) != CLICKGUI) {// i.e. only the button is showing
Ã,  Ã,  Ã,  Ã,  SetGUIPosition (CLICKGUI, 0, 50);
Ã,  Ã,  Ã,  }
Ã,  Ã, Ã,  Ã, else { // Whole GUI is visible
Ã,  Ã,  Ã,  Ã,  SetGUIPosition (CLICKGUI, -190, 50);
Ã,  Ã, Ã,  Ã, }
Ã,  Ã,  }
Ã,  }
Ã,  if (interface == ICONBAR) {


Can knock up a template for you though, if you'd like?

EDIT:
Template is RIGHT HERE. Also includes a read me, with a bit of explanation. Let me know if there's anything you don't understand.
#2658
Bum. I think I can see why, now - constantly re-setting the cursor mode, when not over the region, probably 'stalls' the animation. Didn't think about that.
How about:
Code: ags

if(GetRegionAt(mouse.x,mouse.y)==1){
  if (GetGlobalInt (1) == 0) { 
    SaveCursorForLocationChange();
    SetCursorMode( 8 );
    SetGlobalInt (1, 1);
}
else SetGlobalInt (1,0);

To get the SaveCursor/ChangeCursor bit to only run once.
#2659
The problem looks to be, since it's in repeatedly_execute, the SaveCursorForLocationChange is called again, after the SetCursorMode.

What if you try:
Code: ags

if(GetRegionAt(mouse.x,mouse.y)==1){
  SetMouseCursor ( 8 );
}
else SetDefaultCursor ();
#2660
Beginners' Technical Questions / Re: GUI help
Mon 14/02/2005 12:56:39
What have you tried?

I think you need SetGUIPostion (GUI, x, y);, (or the OO equivalent, if you're using that). The problem is, in pre-beta versions, I don't think there's a way to get the GUi co-ords, so you'll probably have to use GetGuiAt (x,y);

Suppose the full GUI is called CLICKGUI, and is at 0, 50 when fully displayed (top left corner against the left of the screen, 50 pixels down), and is 200 wide. The 'Click' button is button 0, and 10 pixels wide.

You need to add SetGUIPosition (CLICKGUI, -190, 50); to game_start, since the editor doesn't seem to like negative numbers.
Then, in interface_click:
Code: ags

if (button == 0) {
  if (GetGUIAt (15, 55) != CLICKGUI) {// i.e. only the button is showing
    SetGUIPosition (CLICKGUI, 0, 50);
  }
  else { // Whole GUI is visible
    SetGUIPosition (CLICKGUI, -190, 50);
  }
}

This would make the GUI 'jump' out and back, but it'd be easy enough to make it scroll out if you wanted.

The OO version would be something like:
Code: ags

  if (gClickgui.X == -190) gClickGui.X = 0:
  else gClickgui.X = -190;
SMF spam blocked by CleanTalk