Page 1 of 1

How to detect the ending of Game

Posted: Mon Mar 29, 2010 10:48 am
by planebus
Hi guys.

In my game, I have 5 robots and a girl which need to be rescued by me.
Here is my two plans
first. if I do not kill all of the robots and touch the girl, she will tell my like "you need to kill all the robot" automatically.
second. if I do kill all of the robots and touch the girl, The game will display like "you win " and end the game.

How do I do that ?
thx

Re: How to detect the ending of Game

Posted: Mon Mar 29, 2010 3:59 pm
by metal_head
By dying, each robot will be giving a +1 to a specified attribute:

Code: Select all

ModifyAttribute("NAME", 1, "Player");
The girl will look at this attribute and when you're near her, she would check:

Code: Select all

if(GetAttribute("NAME", "Player") = 5)
{
AND do the things you wanna do
}
else
{
Say that you have to kill them all
}

Re: How to detect the ending of Game

Posted: Mon Mar 29, 2010 8:12 pm
by QuestOfDreams
To end the game you need to use a ChangeLevel entity and leave its szNewLevel entry blank. When the player has completed his mission, activate it.

Re: How to detect the ending of Game

Posted: Wed Mar 31, 2010 7:57 am
by planebus
I have try the code, but it seems don't work
I also try to debug to see the change of attribute, but the result is the same, namely 0.

Death[ ()
{
debug(GetAttribute("name", "Player"));//output 0
ModifyAttribute("name", 1, "Player");
debug(GetAttribute("name", "Player"));//also output 0

AnimateStop("die", 0.5, "");
SetEventState("Enemy1Dead", true);
}]

any kind of problem in it?

Re: How to detect the ending of Game

Posted: Wed Mar 31, 2010 8:06 am
by planebus
QuestOfDreams wrote:To end the game you need to use a ChangeLevel entity and leave its szNewLevel entry blank. When the player has completed his mission, activate it.
Can you show me the code how do I activate it.
thx

Re: How to detect the ending of Game

Posted: Fri Apr 09, 2010 7:11 am
by planebus
can anyone help me?

Re: How to detect the ending of Game

Posted: Tue Apr 20, 2010 7:47 pm
by metal_head

Code: Select all

SetEventState("Enemy1Dead", true);
You're activating a trigger, called "Enemy1Dead". You should put a trigger with the same name in the level and than associate it with the ChangeLevel entity :)