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
How to detect the ending of Game
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: How to detect the ending of Game
By dying, each robot will be giving a +1 to a specified attribute:
The girl will look at this attribute and when you're near her, she would check:
Code: Select all
ModifyAttribute("NAME", 1, "Player");
Code: Select all
if(GetAttribute("NAME", "Player") = 5)
{
AND do the things you wanna do
}
else
{
Say that you have to kill them all
}
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: How to detect the ending of Game
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
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?
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
Can you show me the code how do I activate it.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.
thx
Re: How to detect the ending of Game
can anyone help me?
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: How to detect the ending of Game
Code: Select all
SetEventState("Enemy1Dead", true);
