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?
Ã, // script for hotspot1: Use inventory on hotspot
if (character[GetPlayerCharacter()].activeinv == 1)Ã,Â
{
SetCharacterIdle (0, -1, -1);
SetCharacterView (0, 11);
AnimateCharacter (0, 0, 3, 0);
}
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.
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?
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