| 
		
	
		| vanjavk   Member
 
 Posts: 54
 Threads: 5
 Joined: Sep 2010
 Reputation: 
0
 | 
			|  After player Died restart Map HeLpiE Help 
 
				Okey I was wondering is it possible to make when player dies for map just map to restart, i mean with all scripts, so like restarting game but not to restart game from first map,  
hope you understand what i'm saying, 
also if that's not possible i don't know how to make player when dies to spawn on different location    
so when PLAYER DIES restart Map not whole thing,  
OR (if that's not possible) 
To make when player dies spawn on different position
			
 
				
(This post was last modified: 04-18-2011, 04:04 PM by vanjavk.)
 |  |  
	| 04-18-2011, 03:47 PM |  |  
	
		| nkmol   Senior Member
 
 Posts: 252
 Threads: 19
 Joined: Feb 2011
 Reputation: 
4
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				i think when you use , 
void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound); 
it will restart the current map whith all the scripts, not 100% sure.
 
u could use like :
 if (GetPlayerHealth == 0){
 ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
 }
try to experiment whith this    |  |  
	| 04-18-2011, 05:54 PM |  |  
	
		| vanjavk   Member
 
 Posts: 54
 Threads: 5
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				 (04-18-2011, 05:54 PM)nkmol Wrote:  i think when you use ,void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
 it will restart the current map whith all the scripts, not 100% sure.
 
 u could use like :
 
 
 if (GetPlayerHealth == 0){
 ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
 }
try to experiment whith this
  Thanks for resposnse but i got error on line 32 1 (line when If starts) errror with If like it can't start with if? 
(i never worked with IF before   )
			 
 |  |  
	| 04-18-2011, 09:24 PM |  |  
	
		| Dalroc   Member
 
 Posts: 57
 Threads: 2
 Joined: Mar 2011
 Reputation: 
0
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				Post your script mate    |  |  
	| 04-18-2011, 10:51 PM |  |  
	
		| vanjavk   Member
 
 Posts: 54
 Threads: 5
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				 (04-18-2011, 10:51 PM)Dalroc Wrote:  Post your script mate  this is some of code..void OnStart()
 {
 AddEntityCollideCallback("Player", "OpenCloseTrigger1", "CollideOpenCloseTrigger1", true, 0);
 AddEntityCollideCallback("Player", "AreaIForgot", "CollideAreaIForgot", true, 1);;
 AddUseItemCallback("useexit", "key_tomb_rusty_5", "prison_1", "UseKey",true);
 AddEntityCollideCallback("Player", "AreaIForgot1", "CollideAreaIForgot1", true, 1);
 AddEntityCollideCallback("Player", "AreaIForgot2", "CollideAreaIForgot2", true, 1);
 AddEntityCollideCallback("Player", "AreaIForgot3", "CollideAreaIForgot3", true, 1);
 AddEntityCollideCallback("Player", "AreaIForgot4", "CollideAreaIForgot4", true, 1);
 AddEntityCollideCallback("Player", "AreaIForgot6", "CollideAreaIForgot6", true, 1);
 AddEntityCollideCallback("Player", "AreaIForgot5", "CollideAreaIForgot5", true, 1);
 AddEntityCollideCallback("Player", "AreaKnife", "CollideAreaKnife", true, 1);
 AddEntityCollideCallback("Player", "fallingtele", "Teleport", false, 1);
 AddEntityCollideCallback("Player", "aghagh", "Teleport", false, 1);
 AddEntityCollideCallback("Player", "Creak", "CollideAreaCreak", false, 1);
 AddEntityCollideCallback("Player", "AreaGiveMeTheKnifeAndKillTheMonster", "CollideAreaAreaGiveMeTheKnifeAndKillTheMonster", true, 1);
 AddEntityCollideCallback("Player", "OutCreak", "CollideAreaOutCreak", false, -1);
 AddEntityCollideCallback("servant_grunt_1", "kinfeer_1", "KillGrunt", true, 1);
 
 }
 //killing monster
 void KillGrunt(string &in asParent, string &in asChild, int alState)
 {
 FadeEnemyToSmoke(asParent, true);
 }
 void aghagh(string &in asTimer)
 {
 SetMessage("Message", "Text1", 0);
 GiveSanityBoost ();
 }
 
 if (GetPlayerHealth == 0)
 {
 ChangeMap("DUNGEON", "PlayerStartArea_1", "", "");
 }
 
 
 // wood creak
 void CollideAreaCreak(string &in asParent, string &in asChild, int alState)
 {
 AddEffectVoice("creak.ogg", "creak.ogg", "Voice", "creak", false, "", 0, 0);
 }
 ...
 
 |  |  
	| 04-19-2011, 12:06 PM |  |  
	
		| Rownbear   Member
 
 Posts: 157
 Threads: 13
 Joined: Apr 2011
 Reputation: 
2
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				Hmm i've tried playing around with the GetPlayerHealth(); but I can't get it to work either
			 |  |  
	| 04-19-2011, 12:44 PM |  |  
	
		| Dalroc   Member
 
 Posts: 57
 Threads: 2
 Joined: Mar 2011
 Reputation: 
0
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				You have to have the If condition inside of a function.
 EDIT: Also, I suggest you use better names for your functions than "aghagh" or it will just get messy whe nyou start getting a lot of functions.
 
				
(This post was last modified: 04-19-2011, 01:03 PM by Dalroc.)
 |  |  
	| 04-19-2011, 01:02 PM |  |  
	
		| vanjavk   Member
 
 Posts: 54
 Threads: 5
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				 (04-19-2011, 01:02 PM)Dalroc Wrote:  You have to have the If condition inside of a function.
 EDIT: Also, I suggest you use better names for your functions than "aghagh" or it will just get messy whe nyou start getting a lot of functions.
 
uhm how exactly, sorry but i never worked with IF before so i don't know how to set it   (
 
btw that's the only messy name in whole story xD
			 
 |  |  
	| 04-19-2011, 01:11 PM |  |  
	
		| nkmol   Senior Member
 
 Posts: 252
 Threads: 19
 Joined: Feb 2011
 Reputation: 
4
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				it is the same as a normal command, you could see it as a command in command for now    
you need the,  
void callback 
{ 
//scripting stuff 
if//your if script 
{ 
//script for the if 
} 
}
 
as an example, in one of my maps i made a simple if script    void OnEnter(){
 SetEntityConnectionStateChangeCallback("lever_small01_1", "LeverChange");
 }
 
 void LeverChange(string &in EntityName, int alState)
 {
 AddDebugMessage("lever_small01_1" + "'s current state: " + alState, false);
 
 if (alState == -1)
 {
 PlaySoundAtEntity("Elec_light", "27_tunnel_elec.snt", "chandelier_simple_short_1", 0.5f, false);
 SetLightVisible("PointLight_2", true);
 SetLampLit("chandelier_simple_short_1", true, true);
 }
 }
AND DON'T COPY THIS! xD  
this is for a lever script, that will set some electric light on    
if you get a error, first think about what could be the problem and when you can't solve it, ask it here. But first think by yourself (A)
			
				
(This post was last modified: 04-19-2011, 06:06 PM by nkmol.)
 |  |  
	| 04-19-2011, 06:06 PM |  |  
	
		| vanjavk   Member
 
 Posts: 54
 Threads: 5
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: After player Died restart Map HeLpiE Help 
 
				thankssss   
 |  |  
	| 04-19-2011, 07:34 PM |  |  |