Game authors and players, please read this thread!

Author Topic: Using an Hotspot like a Region?  (Read 670 times)  Share 

Using an Hotspot like a Region?
« on: 03 Mar 2009, 03:52 »
Right now I have a part in my game that I want the player to walk over a certain area and when he walks on it the floor boards creak and he backs up saying something about the floor being squeaky then the player can use an inventory item say like grease to turn off the effect of the squeeky floor is there an easy way to do this without using very much code or none at all?

Trent R

  • "I am the weapon" -Richard Cypher
    • I can help with AGS tutoring
    •  
    • I can help with scripting
    •  
Re: Using an Hotspot like a Region?
« Reply #1 on: 03 Mar 2009, 04:00 »
Well, there is a event for standing on a hotspot. Why can't you just use that?

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.

Current Project: The Wanderer
On Hold: Hero of the Rune

Re: Using an Hotspot like a Region?
« Reply #2 on: 03 Mar 2009, 04:29 »
That works somewhat but if you walk to another point bu just say using something on the other side of the room it does not stop the player it allows them to go right over it.

Trent R

  • "I am the weapon" -Richard Cypher
    • I can help with AGS tutoring
    •  
    • I can help with scripting
    •  
Re: Using an Hotspot like a Region?
« Reply #3 on: 03 Mar 2009, 04:40 »
Perhaps something like
[code]
//room_rep_exec
Hotspot *hotty=Hotspot.GetAtScreenXY(player.x, player.y);
bool greasedfloor;

if (hotty==hCreakyFloor && !greasedfloor) {
  //Can't step there!
}
[/code]
But, Khris or someone else will probably soon come by and give you something better. := Cause they're cool like that.

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.

Current Project: The Wanderer
On Hold: Hero of the Rune

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: Using an Hotspot like a Region?
« Reply #4 on: 03 Mar 2009, 10:39 »
Unfortunately, blocking walks won't trigger region events until after the player has stopped moving, correct.

It's possible to do a rep_ex check, but it's even better to send the player off non-blocking.
I've written a module called GotThere to achieve this.

Here's the link & short explanation:
http://www.bigbluecup.com/yabb/index.php?topic=36383.msg477380#msg477380
(The downside: if you want the game to work consistent, you'll have to adjust all your existing interaction funtions)
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"

Re: Using an Hotspot like a Region?
« Reply #5 on: 03 Mar 2009, 13:35 »
Quote
without using very much code

As a workaround, using lots of code, could you add in a condition to the Interact function for each object on the other side of the room that requires a walk-up-and-interact animation??

[code]
if (bOiledFloorboards)
{
  // walk across, you're fine
  // interact with the whatnot on the other side as intended
}
else
{
   if (bTestedFloorboard)
   {
   cChar.Say("If I walk over there, that damned floorboard'll start squeaking again.");
   }
   else
   {
    // engineer a walk just as far as the floorboard
    // play squeak effect
    // back off
    bTestedFloorboard = true;
    }
}
[/code]

??

Depends on how many objects you've got on the other side of the room, I  suppose.


Vince Twelve

  • Why can't I hold all these trophies?
    • Best Innovation Award Winner 2006, for 'What Linus Bruckman Sees When His Eyes Are Closed'
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
  • Vince Twelve worked on a game that was nominated for an AGS Award!Vince Twelve worked on a game that won an AGS Award!
Re: Using an Hotspot like a Region?
« Reply #6 on: 03 Mar 2009, 19:05 »
I did the very thing thezombiecow is suggesting in the game I'm making. 

I had a section of the floor that could not be walked over until certain conditions were met.  I put the proper code into the playerWalksOntoRegion function ("Oh no I can't walk here!" etc), and then for each hotspot on the other side of that region, I checked if the conditions had been met, and if not, had the player only walk just as far as the edge of the region and stop.  That would trigger the playerWalksOntoRegion function.

Since I had only four interactable items beyond that region of the floor, this was a simple and effective solution.

Re: Using an Hotspot like a Region?
« Reply #7 on: 04 Mar 2009, 09:36 »
Quote
I did the very thing thezombiecow is suggesting in the game I'm making. 

Awesome. Hope it works out for you ;)

Vince Twelve

  • Why can't I hold all these trophies?
    • Best Innovation Award Winner 2006, for 'What Linus Bruckman Sees When His Eyes Are Closed'
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
  • Vince Twelve worked on a game that was nominated for an AGS Award!Vince Twelve worked on a game that won an AGS Award!
Re: Using an Hotspot like a Region?
« Reply #8 on: 04 Mar 2009, 14:39 »
Well, I did it several months ago, so it is working out for me just fine.  Thanks.  ;)

Re: Using an Hotspot like a Region?
« Reply #9 on: 04 Mar 2009, 15:30 »
Aaaaaaah.

Vince Twelve

  • Why can't I hold all these trophies?
    • Best Innovation Award Winner 2006, for 'What Linus Bruckman Sees When His Eyes Are Closed'
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
  • Vince Twelve worked on a game that was nominated for an AGS Award!Vince Twelve worked on a game that won an AGS Award!
Re: Using an Hotspot like a Region?
« Reply #10 on: 04 Mar 2009, 15:40 »
Then again, I am a time traveler...

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Admins
  • RON PAUL JUST GOT HUGE!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with AGS tutoring
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
  • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Re: Using an Hotspot like a Region?
« Reply #11 on: 05 Mar 2009, 04:15 »
He came from the past to save the future...


Seriously though, you could just not have any walk-to interactions beyond the board (ie, the player must manually walk to within a certain distance for take/interact stuff to occur).  This easily resolves the issue of blocked walk because you won't have any (except for walking away from the board, obviously).