Page 1 of 1

Misfiring Timer

PostPosted: Wed Jan 16, 2013 2:47 am
by bamby1983
I created a timer that is activated when two actors collide. While the collision and the corresponding timer code work properly, the timer seems to be executing the same code when my actor walks through a small area on the other end of the screen. The region is too far away for there to possibly be a collision and I have confirmed that the collision does not occur (I added a sound to the collision code and it did not play when this issue occurred). It appears that something is causing the timer to fire when the actor walks through this region on the screen. There are no actors and nothing else calls the timer, so I'm not sure why this is occurring. Here are the relevant extracts of the code I have so far.

I'm not sure if it matters but the timer below was originally created with a delay of 250 ms and is being reassigned a new delay value programatically in the following code.


Collision Event Code:
Code: Select all
if (statsUnit_1[1]<1) // Capping the maximum delay at 1 second
    CreateTimer("Waypoint", "Delay Waypoint", statsUnit_1[1]*300);
else
    CreateTimer("Waypoint", "Delay Waypoint", 1000);



Timer Code:
Code: Select all
    PlaySound2("data/Event_Accomplished.wav", 0.04, 1, 0);
    ChangeAnimation("Waypoint", "Waypoint_Expand", FORWARD);
    Speech.animpos+=1;
    ChangeTransparency("Btn_Speech_Next", 0);



Animation Finish Event Code:
Code: Select all
ChangeTransparency("Event Actor", 1);
ChangeAnimation("Event Actor", "Waypoint", FORWARD);
DestroyTimer("Delay Waypoint");

Re: Misfiring Timer

PostPosted: Wed Jan 16, 2013 3:18 am
by skydereign
The most likely thing is that you are missing something. Can you post the ged showing the problem?

Re: Misfiring Timer

PostPosted: Thu Jan 17, 2013 1:35 am
by bamby1983
Sure, the ged file is attached.

Re: Misfiring Timer

PostPosted: Thu Jan 17, 2013 1:57 am
by skydereign
That ged won't work properly without graphics. The waypoint cannot collide, and therefore the timer is never activated. If you don't want to release your actual game data, then I suggest making a small version of the problem (which you may find the solution for your problem by doing so) and posting it here.

Re: Misfiring Timer

PostPosted: Thu Jan 17, 2013 3:56 am
by bamby1983
I don't mind releasing the actual game data. It's just that the game is nearly 9 MB and the attachment limit is 2 MB here.

I'll try to upload the game online somewhere and post the link here.

Re: Misfiring Timer

PostPosted: Thu Jan 17, 2013 3:59 am
by skydereign
You could also remove all the irrelevant actors, and save as to create a new file (in a different directory, so the data directory only has the relevant graphics). And upload that.

Re: Misfiring Timer

PostPosted: Thu Jan 17, 2013 4:27 am
by bamby1983
Looks like the forums allowed me to upload my attachment here! Cool! :)

Steps to replicate this issue:
Open the file "Training Level.ged"
Enter Game Mode
A speech box will pop up less than 2 seconds after the game launches. Follow the instructions in this speech box
Except for one instance, you'll find yourself simply be clicking the "Next" button
There is a small spot somewhere in the area within the red circle (please refer to the attached screenshot titled "Area.png") that triggers the timer event even though it is not supposed to work that way. The timer event is ONLY supposed to be triggered when the soldier either collides with the waypoint actor (it will appear once you click through speech bubbles a few times) or if he is already standing in the region within the waypoint. When this occurs, you'll see the waypoint explode outwards and a sound clip will play.

Re: Misfiring Timer

PostPosted: Thu Jan 17, 2013 5:31 am
by skydereign
The reason is your tree actor has a collision event with the soldier. It creates waypoint's timer. Remove that, and it should work.

Re: Misfiring Timer

PostPosted: Thu Jan 17, 2013 12:38 pm
by bamby1983
Aaah thank you! I dunno how that happened but I probably had the tree actor selected and thought I was working on the waypoint. :(