Posters Conditions and Combo's

Started by matredman, Mon 16/02/2004 00:49:22

Previous topic - Next topic

matredman

 ???

Dear All,

What I mean to achieve: That my character can try using different posters/flyers with 3/4 different 'sticky' parts of a wall and the right combination will solve a puzzle (after asking an adviser to have a look-character). The posters also look different to be ajusted to suit perspectives(wall angles).

The Problem: After trying to use graphicsview functions I found it could only do so much. My way of approaching the idea fresh was to have the sticky wall areas as objects, and the posters are objects(obtained elsewhere). Now, I made the first set of posters as invisible objects over the sticky bits, and had them made visible with inventory interactions, this worked fine, and I had my character walking about fine ajusting the combo with only one poster! BUT it was then time to try working on having the second poster option, let alone third! I have become stuck as to how I can lay down the right systems and conditions for building such a puzzle. Remembering that each poster will be three objects in their own right (for perspective sake).

Sorry to be a rambling beginner! But this is what a forum is about I guess !hoorah!

(actually, maybe I should only have the combo on two sticky area's on one room - and one or two elsewhere due to the 10object limit)

Wolfgang Abenteuer

#1
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

matredman

 :)
Thankyou kindly for the very detailed/lengthy advice!

You have read correctly into what I mean to achieve.

It appears I'll need to work harder on my scripting practice.
I can't fathom how it works with this

if (IsObjectOn(0) == 0)   -whats with the if and the == 0)



{     -whats this for



SetObjectGraphic(0,10);  - now this I got ok
ObjectOn(0);    -why would it be turning on object (0)?
}
else { //Don't allow the player to put another poster on the wall.
Display("There is already a poster on this wall.");
}


Dont go to too much trouble, though, I really will/should be locking myself away for a while to study the scripting more, but no doubt I'll be back to the forum.
Thanks

matredman

HHHAANG ON!

I'm being a stupid. Forget that last post.
I just found out out that stuff in the tutorial. Silly me. HOWEVER, I don't really get how to specify in "use inventory with hotspot". which inventory gets used? How to specify a response for each attempt at inventory use. And how to make my character loose the right thing.

Now Is it best to have the "sticky" area first a HOTSPOT. that becomes a visible/active "OBJECT" when the posters are placed onto it?

Wolfgang Abenteuer

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

matredman

"You are a gentleman and a scholar, thankyou."

SMF spam blocked by CleanTalk