Problem(s) with scripting the behavior of... an angry bee.

Started by Fitz, Mon 25/04/2011 18:59:38

Previous topic - Next topic

Sephiroth

Can you try to remove everything from rep_exec and just put:

Code: ags

 if(!player.Moving)
 {
   player.FaceCharacter(cStrayBee1, eNoBlock);
   Display("I'm facing the bee");
 }


If nothing displays when you stop, the function isn't linked properly, in this case just remove the property text in the room event panel, and then hit the "..." button again to re-link it.

Edit: one more thing, you added "sting = 1;" when the sting is supposed to occur. It should be when the bee lands on the player body, then the sting will occur automatically after 15 sec idling.

Fitz

It displays it right away. Except it blocks every other animation on the screen.

And while I did that, I forgot to paste the original code that was there into any text processor for keeping - and now if went heidi. I knew if I stayed up and keep trying to do something, I would end up messing something up. The good thing is I have the last big scripting session backed up.

I tried another thing: I put your script into a new room, with no scripts in it yet, with a different character there. Gray faces that one alright wherever it goes. But it does nothing aside from that. Just walks to and fro. Could it be that the size here matters? The bee is just 4x4 pixels, the other character is much bigger.

Sephiroth

I've sent a PM, regarding your question I don't think the size matters but I'm gonna run a quick test and will edit my post afterward.

Fitz

I did a little test - I removed almost ALL scripts that resulted in any activity in the room, so there was absolutely nothing else moving or happening. Still, the character didn't face the bee. However, in a similarly empty environment in the other room, he faced the passing character every time.

Sephiroth

Yeah there's something strange, that's why I suggested to send the whole game file so I can have a closer look at it, I could hopefully figure out what's going wrong without having to flood the forum  :P But I would understand if you don't want to of course.

Edit: The problem was coming from the UP/DOWN loops being just copies of the right and left loops, making the player think he's facing right when he's actually facing up and result in strange behaviour.

Will tweak the code a bit more, because having the character face something is considered as a movement, (Edit) so the trick was to change the character loop to make it look like he's facing without modifying player.Moving variable, so we can detect if player is idle and have him face anything at the same time, also made sure the facing direction is either left or right only.

SMF spam blocked by CleanTalk