Hi
Somehow trying to only add to score just once.
if (cspit.PPCollidesWithO(obottle1))
{
aBOTTLE_SMASH3.Play();
aCheer.Play();
object[11].Visible=true;
if (Game.DoOnceOnly("bottle1")) // does not work
Points=(Points +1);
object[0].SetView(7, 0);
object[0].Animate(0, 4, eRepeat, eNoBlock);
cspit.Move(cspit.x + 0, cspit.y + 120, eNoBlock, eWalkableAreas);
cspit.FollowCharacter(cEgo, FOLLOW_EXACTLY);
}
[/coder]
Hm, at first sight I can see no reason why only 4 points are added instead of 5. But in my opinion you don't need the first part of the script at all, where you check repeatedly if an object is visible and then add points. You can simply put the addition in the second part where you check for collision. Something like this:
if (cspit.PPCollidesWithO(obottle1))
{
aBOTTLE_SMASH3.Play();
aCheer.Play();
object[11].Visible=true;
object[0].SetView(7, 0);
object[0].Animate(0, 4, eRepeat, eNoBlock);
cspit.Move(cspit.x + 0, cspit.y + 120, eNoBlock, eWalkableAreas);
cspit.FollowCharacter(cEgo, FOLLOW_EXACTLY);
if (Game.DoOnceOnly("bottle1b"))
{
Points=(Points +1);
}
}
Comment out the first part of the script and add the "Points +1" part to the collision checks. Maybe this will do the trick.
Also note that when you set up the timer in the third part of the script, int ran=Random(2); will create a random number from 0 to 2, which means 0, 1 or 2. So this line:
else if (ran == 3)
will never be true.
Oh, and please don't double post.
i forget to take random int out.. cheers
Also the Game.DoOnceOnly is NOT working as it can score more than once!
if (cspit.PPCollidesWithO(obottle1))
{
aBOTTLE_SMASH3.Play();
aCheer.Play();
object[11].Visible=true;
object[0].SetView(7, 0);
object[0].Animate(0, 4, eRepeat, eNoBlock);
cspit.Move(cspit.x + 0, cspit.y + 120, eNoBlock, eWalkableAreas);
cspit.FollowCharacter(cEgo, FOLLOW_EXACTLY);
if (Game.DoOnceOnly("bottle1a"))
{
Points=(Points +1);
}}
This is marked as solved, but you said that Game.DoOnceOnly is still not working. Game.DoOnceOnly does work. It will never return true more than once for the same string token during a single run of your game. Ever.
Hi Monkey
Each string is different and it all works now.
I just had an overload :=
cheers
steptoe
Btw, instead of Points=(Points +1) you can just write Points ++, or, if more is added, Points += x.
Thanks for all your replies guys
:=