Help with inventory on hotspot

Started by En garde!, Fri 08/04/2005 06:12:50

Previous topic - Next topic

En garde!

Right, I need a hotspot to trigger an animation on a character when an inventory item interacts with it.

This is the code I used on the hotspot:

  // script for hotspot1: Use inventory on hotspot
if (character[GetPlayerCharacter()].activeinv == 1) 
SetCharacterIdle (0, -1, -1);
SetCharacterView (0, 11);
AnimateCharacter (0, 0, 3, 0);

But it does nothing. Where's the problem? Can anybody help?

Scummbuddy


Ã,  // script for hotspot1: Use inventory on hotspot
if (character[GetPlayerCharacter()].activeinv == 1)Ã, 
{
SetCharacterIdle (0, -1, -1);
SetCharacterView (0, 11);
AnimateCharacter (0, 0, 3, 0);
}
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

En garde!

Still not working. It wouldn't accept the changes unles y erased a braket.

Now it looks like this;



#sectionstart hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE
function hotspot1_a(){
  // script for hotspot1: Use inventory on hotspot
if (character[GetPlayerCharacter()].activeinv == 1)
SetCharacterIdle (0, -1, -1);
SetCharacterView (0, 11);
AnimateCharacter (0, 0, 3, 0);
}
#sectionend hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE


And still nothing.

Ashen

#3
And it should look like:

#sectionstart hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE
function hotspot1_a(){
  // script for hotspot1: Use inventory on hotspot
if (character[GetPlayerCharacter()].activeinv == 1) { // Scummbuddy's bracket
  SetCharacterIdle (0, -1, -1);
  SetCharacterView (0, 11);
  AnimateCharacter (0, 0, 3, 0);
} // Scummbuddy's other bracket
}
#sectionend hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE
(Which, now that I've fixed the bold type, is much the same as khrismuc's.)

Other things to check (if you haven't already):
Is '1' the right item number?
Is '0' the right character? I find it easier to use their script names (EGO), rather than numbers.
Is view 11, loop 0 the right loop?
What if you use AnimateCharacterEx (0, 0, 3, 0,1, 0);, to make the animation blocking? It might be, since your script isn't blocking, something happens to 'cancel' the animation before it runs.

And, out of interest, what's the SetCharacterIdle (0, -1, -1); for? Do you need to set the delay to -1, given that you're disabling the view anyway?
I know what you're thinking ... Don't think that.

Khris

It should look like this:

#sectionstart hotspot1_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function hotspot1_a(){
Ã,  // script for hotspot1: Use inventory on hotspot
if (character[GetPlayerCharacter()].activeinv == 1)
{
SetCharacterIdle (0, -1, -1);
SetCharacterView (0, 11);
AnimateCharacter (0, 0, 3, 0);
Ã,  }
}
#sectionend hotspot1_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE

SMF spam blocked by CleanTalk