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

#21
Yes, I would probably make each "sticky" area a hotspot, and have the objects (posters) placed on top of it, and the objects will turn on once you put posters on the sticky spots.

For using inventory on a hotspot, go to the hotspot interaction screen and look for "Use inventory on hotspot".  Double-click it to make the action editor window appear.  From the drop-down box, select "Conditional - if inventory item was used".  Then click the "Change" button and enter the inventory item number for poster #1 (the number next to it on the Inventory items tab in the editor).  Then put in the code for the character to walk up to the wall (MoveCharacterBlocking, or you could just assign a walk-to point for the hotspot and then use MoveCharacterToHotspot instead), then another code to put the poster on the wall (ObjectOn), and finally one to lose the inventory item (LoseInventory).  Do that for each poster on each sticky spot, and you're set. :)

~Wolfgang
#22
When you first start up the program, you'll get three different options:  Start a new game, Load an existing game, and Load a recently edited game.  You can't do it from within another game, though (that is, there's no option for "New Game" under the drop-down menus).

~Wolfgang
#23
Okay, after reading through this thread and your other one, I think I know what you're trying to achieve.  Correct me if I'm wrong at any point here:

You have three posters, and three or four different walls you can put them on, correct?  Using room perspective, a poster placed on the left wall, for example, would look different than the same poster placed on the right wall.  Am I right so far?  K...so what you're trying to do is get each poster to show up where the player puts it, right?  Like the player can put poster 1 on the centre wall, poster 2 on the left wall, poster 3 on the right wall, etc. correct?  But you've run out of objects?  Is that your concern?  Or is the poster just not showing up correctly in certain places?

If your posters are the same size, what you can do to save objects is just have one object for each poster "spot" (the sticky parts on the wall), and just use SetObjectGraphic depending on which poster the player put on that particular wall section.

Try something like this:

Under the "use inventory on hotspot", for poster 1, wall 1:

Code: ags
if (IsObjectOn(0) == 0) { //if there's not already a poster on that wall
SetObjectGraphic(0,10); //whatever your sprite and object #s are
ObjectOn(0);
}
else { //Don't allow the player to put another poster on the wall.
Display("There is already a poster on this wall.");
}


For the same hotspot, poster 2:

Code: ags
if (IsObjectOn(0) == 0) {
SetObjectGraphic(0,11);
ObjectOn(0);
}
else {
Display("There is already a poster on this wall.");
}


poster 3:

Code: ags
if (IsObjectOn(0) == 0) {
SetObjectGraphic(0,12);
ObjectOn(0);
}
else {
Display("There is already a poster on this wall.");
}


Wall 2, poster 1:

Code: ags
if (IsObjectOn(1) == 0) {
SetObjectGraphic(1,13);
ObjectOn(1);
}
else {
Display("There is already a poster on this wall.");
}


...and so forth for all three walls, and for each poster on that wall.  Now, for your other problem of being able to take the posters back down off of the wall, what you'd do is:

For "interact object" on wall 1:

Code: ags
ObjectOff(0);
Display("You take the poster off of the wall.");
if (GetObjectGraphic(0) == 10) {
AddInventory(1); //or whatever the inventory # of poster 1 is
}
else if (GetObjectGraphic(0) == 11) {
AddInventory(2);
}
else if (GetObjectGraphic(0) == 12) {
AddInventory(3);
}


...And the same for each object.  That will make the player take the poster off the wall and put it back in inventory depending on which poster was put up there.

As for how to script the puzzle itself, just assign an int that determines if the player has all of the posters in the correct location.  For example, if poster 2 was the correct one for the first wall (object 0), you could do it like this (I'll use int posterpuzzle):

Code: ags
if (IsObjectOn(0) == 0) {
SetObjectGraphic(0,11);
ObjectOn(0);
posterpuzzle ++;
if (posterpuzzle == 3) { //all three posters are in the correct place
//Puzzle solved!
}
//otherwise, it just adds 1 to the value of posterpuzzle and allows the
//player to move on to the next wall
}
else {
Display("There is already a poster on this wall.");
}


Then, of course, you have to remember to decrement the variable should the player take the correct poster off the wall:

Code: ags
else if (GetObjectGraphic(0) == 11) {
AddInventory(2);
posterpuzzle --;
}


Put those last two blocks of code in the proper section for both putting up (first block) of the correct poster and also the removal (second block) of it.

Is that kind of what you meant or am I totally reading it wrong?

~Wolfgang
#24
If it's saying that it's already defined, that means you probably already have a function dialog_request somewhere else in your global script.  Use Ctrl+F to find it and either get rid of one or combine them somehow.

~Wolfgang
#25
I don't know how many AGS accepts, but you cannot use too many MoveCharacterPath commands at once.  With that in the repeatedly execute, it's adding a new one every 1/40 of a second.  Not good. :P

What you can do is, as soon as you have the creature appear in the room then use MoveCharacterPath.  Like if you've interacted with something and caused the creature to appear.  Or, if you need the creature(s) to appear at random, do it like this:

repeatedly execute

if (character[CREATURE].room != character[EGO].room) {
 character[CREATURE].room = character[EGO].room;
 character[CREATURE].x = 160; //or whatever
 character[CREATURE].y = 140; //or whatever
 MoveCharacterPath(CREATURE,159,173);
 MoveCharacterPath(CREATURE,168,120);
}

That way the sequence will only happen one time, since the if statement becomes false as soon as CREATURE appears in the room.

~Wolfgang
#26
Depends on when you want the object to appear.  If you want it to show up as soon as the player enters the screen, put it in the "before fadein" section.  If you want it to happen after the player interacts with a room object, put it under that object's interaction.  If you want it to appear when a player looks at a hotspot, put it in the "look at hotspot" section, and so on.

~Wolfgang
#27
character[CHARID].room
character[CHARID].x
character[CHARID].y

Put that in the "before fadein" if you want it to happen without the player seeing the character appear (meaning the character's already there when the screen fades in).

~Wolfgang
#28
To stop your first problem, put a return after the @s in the second dialog, like:

// dialog script file
@S // dialog startup entry point
return
@1 // option 1

I'm not quite sure what you mean by having a command show a hidden option.  Do you mean you're trying to use option-on at some point?  If that's the case, try to put the return before the option-on line and see if that helps. *shrugs*

~Wolfgang
#29
I'm guessing that you mean that the character does not animate until you speak with someone.  Here's the reason for that:

If you put something in the repeatedly_execute part of a script, it will get run every game cycle (normally 40 times per second).  In this case, you used AnimateCharacter, so the character will begin at a certain frame of animation and then continue on.  Problem is, that is resetting each time the game cycles (again, normally 40 times per second), so the character is starting back at the first frame of their animation each time.  The reason that the animation continues as normal when you speak with someone is likely because it's a blocking command (meaning it pauses the game, and stops the repeatedly_execute from cycling), so the character is able to continue his animation as normal, until you're done speaking and the repeatedly_execute resumes.  Am I right so far?

How to fix it:

What you'll need to do is put the AnimateCharacter line somewhere other than the repeatedly_execute section.  If you want it to happen as soon as you enter the screen, put it in the "player enters screen after fadein" part.  If you want it to happen at another time, like after you've picked up an object for example, then put the line at the end of the object interaction, and so on.  If you want the animation to happen only one time, and then stop, set the last value of AnimateCharacter to 0.  If you want it to keep animating over and over, set it to 1 instead.

...I probably confused you even more, didn't I? :P

~Wolfgang
#30
Couldn't you just assign a variable to each cursor mode when you move over the hotspot?  Like:

if (GetCursorMode() == MODE_WALK) {
 prevcursor = 1;
}
else if (GetCursorMode() == MODE_LOOK) {
 prevcursor = 2;
}
//etc.
SetCursorMode(#);

Then, when you move off of that hotspot (or rather, on to the hotspot surrounding it):

if (prevcursor == 1) {
 SetCursorMode(MODE_WALK);
}
else if (prevcursor == 2) {
 SetCursorMode(MODE_LOOK);
}
//etc.

Would that work?

~Wolfgang
#31
You have to import each individual frame of the animation as a separate sprite, create a view using those animations, then use AnimateObject to, well, animate the object. :)

~Wolfgang
#32
Uh...it shouldn't.  MoveCharacterBlocking should be the only one that blocks.  By "blocking", you mean the game changes to the Wait cursor and you can't do any interactions, right?  Are you trying to move the player character or someone else?

~Wolfgang
#33
MoveCharacter, MoveCharacterDirect, and MoveCharacterPath are also non-blocking.

~Wolfgang
#34
MoveObject and MoveObjectDirect are both non-blocking functions.  Was there something else you needed it to do?  ???

~Wolfgang
#35
It should actually look like this:

function dialog_request (int dialog) {
 if (dialog == 1) {
   ChangeCharacterView(Q,7);
 }
}

The "run-script 1" from the dialogue script passes the number "1" into the dialog_request function.  Therefore, you need to tell AGS what to do when the value of that is 1 (hence the if (dialog == 1) { line).

~Wolfgang
#36
The easy way to solve that problem is to simply put an if (IsGamePaused() == 0) { around the portion of the repeatedly execute that makes the counter count up.  That way, as soon as someone pauses the game, brings up a GUI, causes a blocking command, the counter will no longer count up.

~Wolfgang
#37
Do you mean you need it to walk to given coordinates when the WALK icon is clicked on a certain hotspot, rather than simply walking to mouse.x, mouse.y?  If it were me, what I'd do is make another separate cursor mode (one of the custom ones) and then have the cursor mode change to that when you move the mouse over one of those hotspots that are supposed to react to the walk cursor.  You could even use the same graphic as you do for the walk cursor.  Using the walk icon for interactions other than simply walking has always been a bit difficult for me to do, so I've found it easier to just use a new cursor mode and change the hotspot interaction to the "Any click on hotspot", then specify the given cursor mode (just use the if (GetCursorMode() == #) { line at the beginning of the "Any click" interaction to rule out the other cursor modes).  That way, the walk icon will work like normal, and the custom cursor mode can handle everything else.

That may be backtracking a bit, though, but I guess I'm not quite sure what you need the Walk icon to do differently than it normally does. *shrugs*

~Wolfgang
#38
Wait, which room does he keep walking on?  Room 1 or room 3?  Just to get it straight, is this what you're trying to do?:

Player starts on room 1
Player walks to the edge of room 1 (or to a specific point in room 1)
Player changes to room 3

...or are you doing something else?

~Wolfgang
#39
Probably because if his x,y position is set off-screen, then it's also not on a walkable area.  If you try to use MoveCharacterToHotspot, it will obey the walkable areas and if the character isn't currently on a walkable area, he won't move.  Try using MoveCharacterBlocking and specify the walk-to x,y coordinates instead, and set the Direct value to 1, or just use MoveCharacterDirect if you don't need the command to be blocking.

~Wolfgang
#40
You could try making two background frames, one with your text in full white and one as a completely black background.  Set the background frame of the room to the completely black frame.  Then, just use RawDrawFrameTransparency to gradually fade in the text frame at different levels, from 0% (text gone) to 100% (text white).  If you have more than one text message you want to fade in, just make a separate background for each message and use the same black background for fading.

Don't know if that will work, but it's worth a try, I suppose! :)

~Wolfgang
SMF spam blocked by CleanTalk