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 - Wolfgang Abenteuer

#1
I don't know if this would cause it, but you may have put the hotspot walk-to point outside of a walkable area, so either your character never finishes moving or he moves out of a walkable area and then is unable to get back when control is returned to the player.  Put the walk-to point in the middle of a walkable area instead or make the walkable area bigger so that the walk-to point is completely INSIDE it and see if that helps.

~Wolfgang
#2
Minimi is correct - NewRoom and NewRoomEx are for the player character only.Ã,  For NPCs, just use the character variable character[CHARID].room = #.Ã,  When the NPC walks onto the region, simply use character[CHARID].room = # (where "#" is the room number you want the NPC to appear on).Ã,  If you want to put the NPC in a specific place on the new screen, then use character[CHARID].x = # and character[CHARID].y = # immediately after the [CHARID].room line and BEFORE the NewRoomEx command (or whatever command you use to make the player change screens).Ã,  Once the new screen fades in, the NPC should be in that room at the coordinates you specified.

~Wolfgang
#3
Your braces don't match up is why.

function unhandled_event (int what, int type) {
Ã,  if (what == 1) { //if Hotspot
Ã,  Ã,  if (type == 4) { // if Talk To Hotspot
Ã,  Ã,  Ã,  Display ("That can't speak, duh.");
Ã,  Ã,  }
Ã,  Ã,  if (type == 2) { // if Pick Up Hotspot
Ã,  Ã,  Ã,  Display ("I can't pick that up!");
Ã,  Ã,  Ã,  Ã,  Ã,  if (type == 3) { // if Use inventry with Hotspot
Ã,  Ã,  Ã,  Display ("That wouldn't do anything useful.");
Ã,  Ã,  }
Ã,  }
Ã,  }
Ã,  if (what == 2) { //if Object
Ã,  Ã,  if (type == 2) { // if Talk To Object
Ã,  Ã,  Ã,  Display ("That can't speak, duh.");
Ã,  Ã,  }
Ã,  Ã,  if (type == 5) { // if Pick Up Object
Ã,  Ã,  Ã,  Display ("I can't pick that up!");
Ã,  Ã,  }
Ã,  Ã,  Ã,  if (type == 3) { // if use inventry with Object
Ã,  Ã,  Ã,  Display ("That wouldn't do anything useful.");
Ã,  Ã,  }
Ã,  }
}
Ã,  if (what == 5) { //if Inventry item
Ã,  Ã,  if (type == 3) { //if inventry item on another
Ã,  Ã,  Ã,  Display ("Those two things wouldn't work together.");
}

The function unhandled_event function terminates with the closing brace I've bolded.Ã,  Everything after that is outside the the function (and essentially in "limbo") so the game can't understand why there's an "if" statement in the middle of nowhere.Ã,  Put another closing brace at the end, like Mr Flibble suggested, and delete the one that I've bolded.Ã,  Also, you might want to move one of the three brackets at the end of the if (what == 1) statement and put it above the if (type == 3) { // if Use inventry with Hotspot line, because those two conditionals aren't properly closed and will cause problems when they go to be executed.

Edit:Ã,  Essentially, make it look like this:
Code: ags
function unhandled_event (int what, int type) {
Ã,  if (what == 1) { //if Hotspot
Ã,  Ã,  if (type == 4) { // if Talk To Hotspot
Ã,  Ã,  Ã,  Display ("That can't speak, duh.");
Ã,  Ã,  }
Ã,  Ã,  if (type == 2) { // if Pick Up Hotspot
Ã,  Ã,  Ã,  Display ("I can't pick that up!");
Ã,  Ã,  }
Ã,  Ã,  if (type == 3) { // if Use inventry with Hotspot
Ã,  Ã,  Ã,  Display ("That wouldn't do anything useful.");
Ã,  Ã,  }
Ã,  }
Ã,  if (what == 2) { //if Object
Ã,  Ã,  if (type == 2) { // if Talk To Object
Ã,  Ã,  Ã,  Display ("That can't speak, duh.");
Ã,  Ã,  }
Ã,  Ã,  if (type == 5) { // if Pick Up Object
Ã,  Ã,  Ã,  Display ("I can't pick that up!");
Ã,  Ã,  }
Ã,  Ã,  if (type == 3) { // if use inventry with Object
Ã,  Ã,  Ã,  Display ("That wouldn't do anything useful.");
Ã,  Ã,  }
Ã,  }
Ã,  if (what == 5) { //if Inventry item
Ã,  Ã,  if (type == 3) { //if inventry item on another
Ã,  Ã,  Ã,  Display ("Those two things wouldn't work together.");
Ã,  Ã,  }
Ã,  }
}


~Wolfgang
#4
You may have to play around with the key's speed in the MoveObjectDirect statement in order to make it so the key doesn't just "disappear" (i.e. move really fast to its destination and just seem to disappear).Ã,  Start out with a really slow value and increase until you find a speed that best suits the scene.

So, what exactly is it you want to happen in the scene?Ã,  The key is on the bookshelf, the player walks over with the crowbar, lifts the crowbar up, knocks the key down, then once the key is on the floor, the character bends down and picks up the key?Ã,  Is that kind of what you're trying for?Ã,  That would be done somewhat like this:

if (character[EGO].activeinv == 1) { //if 1 is the number of the crowbar
Ã,  ChangeCharacterView(EGO,1); //changes the character's view to the crowbar-using view
Ã,  AnimateCharacter(EGO,0,5,0); //lifts the crowbar up
Ã,  while (character[EGO].animating == 1) {
Ã,  Ã,  Wait(1);
Ã,  }
Ã,  MoveObjectDirect(0,200,150,5); //key falls to the ground
Ã,  while (IsObjectMoving(0) == 1) {
Ã,  Ã,  Wait(1);
Ã,  }

Ã,  AnimateCharacter(EGO,1,5,0); //puts the crowbar away and picks up the key
Ã,  while (character[EGO].animating == 1) {
Ã,  Ã,  Wait(1);
Ã,  }
Ã,  ObjectOff(0); //key has been picked up, so turn it off
Ã,  AddInventory(0); //give the key to the player

Ã,  AnimateCharacter(EGO,2,5,0); //character stands back up
Ã,  while (character[EGO].animating == 1) {
Ã,  Ã,  Wait(1);
Ã,  }
Ã,  ChangeCharacterView(EGO,0); //return the character to his normal walking view
}

That should be the whole process, including any animations for the character you may need.Ã,  Of course, the key part itself is rather simple (just the bolded part), but I'm not quite sure what it is exactly you were having problems with.Ã,  Just the key falling or the whole sequence?Ã,  Do you mean the key stayed at the top of the dresser and didn't fall to the floor or it simply disappeared altogether?

~Wolfgang
#5
Okay, I'm not 100% sure what you are trying to do here.Ã,  You say you want to click on a hotspot and have it give the player an item (oranges)?Ã,  But only if the dialogue is active?Ã,  Why would you need a dialogue for that?

As for the SetGlobalInt(6,40) line, the numbers he got off the top of his head, really.Ã,  That command would set the value of GlobalInt #6 to 40.Ã,  There are GlobalInts from 0-499 available, and as far as I know they can be set as high as you want.Ã,  For a simple "switch" to determine if the player should get one thing or should not, you really only need a value of 0 or 1.

So, for example, if you had a dialogue script that said this (and I'm just making this up right now because I'm not sure what it is you're trying to do):

Code: ags
@S
return
@1 //Make oranges available
narrator: You can get oranges now.
set-globalint 0 1
return
@2 //Don't make oranges available yet
narrator: You can't get the oranges yet.
return


Then once the hotspot is clicked on, do this:

Code: ags
if (GetGlobalInt(0) == 1) {
Ã,  //add your inventory code for oranges and whatever else you want to do here
}
else {
Ã,  //you know the rest here already
}


Notice that in the dialogue script, I used set-globalint 0 1, which set GlobalInt #0 to a value of 1.Ã,  Then in the other script, I checked to see if the value of GlobalInt #0 was set to one and run the inventory code for the oranges if it is, or do nothing if it's not.

Is that kind of what you had in mind?

~Wolfgang
#6
It looks to me, after matching up all of your brackets, that everything is encompassed within the else if (value == 7) { conditional, so any value after that won't ever get executed.Ã,  Try deleting one of the three brackets at the very end of the dialog_request script and putting it in the line above the else if (value == 8){ line instead and see if that fixes it.

Edit: Damn smilies...

~Wolfgang
#7
Code: ags

Ã,  else if ((monthno < 12)) {
Ã,  Ã,  monthno += 1;
Ã,  } else {
Ã,  Ã,  yearno += 1;
Ã,  Ã,  monthno = 1;
Ã,  }
}


This part looks like the problem.Ã,  Since it's a standard if statement and its only conditional is that monthno < 12, it'll get run every time the button is pressed and monthno is less than 12, which would be almost the whole time.Ã,  Each time it'll add one to monthno in addition to adding one to dayno earlier in the script.Ã,  You might just want to break out month 12 into a different else if { statement by itself, rather than having it in there twice (once earlier on, with all of the other 31-day months, and again at the end).Ã,  Just something like:


Code: ags
if (monthno == 12) {
Ã,  if (dayno < 31) {
Ã,  Ã,  dayno ++;
Ã,  }
Ã,  else {
Ã,  Ã,  dayno = 1;
Ã,  Ã,  monthno = 1;
Ã,  Ã,  yearno ++;
Ã,  }
}


That way, only the one code will get run, instead of two.Ã,  Would that work?

~Wolfgang
#8
Right, but you need to first define the integer before you can use it.  Just put:

int itemclicked;

in the top of the room script (just click the double-brackets button in the room editor for that room and type it at the very top, before any room functions are declared).

~Wolfgang
#9
As long as you define the integer in the global script, then export it, and import it into the script header (not the header for each room), it should work just fine.Ã,  Any script, whether local or global, will be able to read from and modify that variable.

~Wolfgang
#10
What you have to do is set some sort of variable that tells the game if the player has clicked the inventory item on the object.Ã,  Something like this:

Under the "If inventory item was used on object" script:

itemclicked = 1;
//Whatever other code you need


Then under the hotspot interaction:

if (itemclicked == 0) { //Player HASN'T clicked the item on the object
Ã,  //Run whatever code goes here
}
else if (itemclicked == 1) { //Player HAS clicked the item on the object
Ã,  //Run whatever code goes here
}


~Wolfgang
#11
Are you sure Roger is on a walkable area?  If he's not, that would explain why he's not moving at all.

Also, I believe most GUIs pause the game when brought up - all except maybe the ones set to "Normal" or "Persistant", so that could be the reason there.

What exactly is it you're trying to do?

~Wolfgang
#12
Under the "Game" drop-down menu in the editor, there's an option to change the game resolution.

~Wolfgang
#13
An object may not appear if you haven't assigned it a graphic (although, I believe if that's the case it'll show up as the blue cup default graphic), you put it BEHIND a walk-behind area and the baseline for it was set "above" (lower y value) that of the walk-behind, you didn't check the "Initially visible" box (which you say you did, so that's not why), or something in the script can turn the object off.Ã,  My guess in your case is that it was the walk-behind thing, because chances are you didn't mess around with too much scripting.Ã,  Simply setting the baseline for the object at the bottom of the screen will make it appear, although it'll look funny when you try to have something move in front of it. *shrugs*

~Wolfgang
#14
Quote from: Hotspot on Sun 06/06/2004 08:19:11
I have a suggestion, but instead of starting a new thread Im just gonna post it here mkay?

Well, in my game everytime the player does an unscripted interaction with an object (such as TALK on a bookcase) if displays a message along the lines of: 'I wont dignify that with an answer'. To do this I cannot find any way other than using a global int to check if the interaction was scripted. This is all fine but I have to remember to put this in each interaction. Would it be possible to have 'Any Non-scripted Click on Hotspot/Object'. This isnt urgent, but would be nice to cut down on the repeated if (GetGlobalInt () == *){ etc.

Have you tried using unhandled_event?  Just set it up once in your global script and it's set for the rest of your entire game.  Quite a handy thing.  Or are you thinking of something else?

~Wolfgang
#15
Advanced Technical Forum / Re:What's Wrong?
Sat 06/03/2004 07:42:31
Maybe you shouldn't put it in the repeatedly_execute of the room.  I'm guessing what happens is that when you press <Enter>, whatever you typed in is entered into the given string, and then the repeatedly_execute checks each game cycle to see if that string matches one of your Said() lines (which it will), thus repeating the line over and over again. *shrugs*

~Wolfgang
#16
When someone says "int", they're referring to a variable ("int" is actually short for "integer"), and the values of variables can be used in any number of things.

The "1" you've put is simply the GlobalInt you're using.  AGS currently supports up to 500 GlobalInts (numbered from 0 to 499), so you could have used NewRoom(GetGlobalInt(499)); and it would have worked, so long as you used SetGlobalInt(499, character[EGO].room); before.

In navynuke's example, if I'm reading it correctly, he has you set a GlobalInt to the value of the room you're currently in when you're using the map, and then when you're done with the map it returns you to the room number represented by the value of that GlobalInt.  Probably something like this:

//script for using the map:
SetGlobalInt(1,character[EGO].room);
--Sets the value of GlobalInt 1 to the room number of the current room

NewRoom(100);
--Goes to room 100, or whatever room the "map" is

//script for clicking anywhere on the map that doesn't teleport you to somewhere specific -- this would likely be hotspot 0:
NewRoom(GetGlobalInt(1));
--Goes to whatever room number is specified in the value of GlobalInt 1

Looking at it systematically, here's what happened:

•The player is in a room (we'll say room 10 for example), when he decides to use the map.
•As soon as the map is used, GlobalInt 1 is set to 10 (the current room number) and the map opens and teleports the player to the map room, in this case room 100.
•Once the player is on the map screen, he decides to return to the room he was in, rather than teleporting somewhere else.  He is returned to whichever room number is stored in GlobalInt 1 (10 in this case).

~Wolfgang
#17
Sure.  You just have to use run-script x under the correct dialogue option, and then script something under that value (whatever number you chose "x" to be) in the function dialog_request in the global script.  The dialog_request function is scripted just like everything else, so you can do anything you want to within a dialogue, including changing rooms.

For simply adding an inventory item, though, you don't even need to go through all that hassle.  Just use add-inv x ("x" being the item number) within the dialogue script.

~Wolfgang
#18
If you're changing a global variable in a room script, you need to export it from the global script and then into that room script first.  Just put export GUNdistract; at the end of your global script, and then import int GUNdistract; into the room file (if you only want it for that one room), or the script header (if you want it for more than just one room).

~Wolfgang
#19
1) Where you have the character leave the room, try using
character[EGO].room = character[EGO].prevroom
If you haven't actually moved the character on the map screen at all, he will still retain his x,y coordinates from the first room, so that shouldn't be a problem.

2) Yup.  You can edit the room descriptions in the editor, but the filenames need to be roomxxx.crm

3) Hmm...never tried that.  Someone else will have to field that one for you. :)

4) You need to use on_key_press and assign a function to each arrow key's ASCII value.  I'm not sure exactly what you're trying to script so I really can't be any more specific than that ATM, but that's basically how you assign keyboard keys to do things within AGS.

5) I have always wondered that one myself! :P

~Wolfgang
#20
You mean you want them to instantly appear at specific coordinates in the new room?  If that's the case, just use NewRoomEx instead of NewRoom.

~Wolfgang
SMF spam blocked by CleanTalk