| 
		
	
		| tonitoni1998   Member
 
 Posts: 163
 Threads: 54
 Joined: Oct 2012
 Reputation: 
1
 | 
			| how can i change what the map is like when he dies? 
 
				i want the player to respawn at a point of the map, and the map is supposed to look the same as before. and everything happens again etc. do i need "CreateDataCache" for this? i already have an idea of it, but im not sure though.
			 
 When you are looking for someone, to do the scripting for your Custom Story, ask me! |  |  
	| 02-22-2013, 06:09 PM |  |  
	
		| OriginalUsername   Posting Freak
 
 Posts: 896
 Threads: 42
 Joined: Feb 2013
 Reputation: 
34
 | 
			| RE: how can i change what the map is like when he dies? 
 
				 (02-22-2013, 06:09 PM)tonitoni1998 Wrote:  i want the player to respawn at a point of the map, and the map is supposed to look the same as before. and everything happens again etc. do i need "CreateDataCache" for this? i already have an idea of it, but im not sure though. 
You could try this stuff out before you post a thread..
 
I would make a copy of the map and load him in there, it's maybe not the best way but it works.
			 |  |  
	| 02-22-2013, 06:35 PM |  |  
	
		| Statyk   Schrödinger's Mod
 
 Posts: 4,390
 Threads: 72
 Joined: Sep 2011
 Reputation: 
241
 | 
			| RE: how can i change what the map is like when he dies? 
 
				You need to create a checkpoint before the place the player will die at and in that checkpoint function, there is a callback feature (labelled "DEATHMAP" in my example). Give it a function to load the new map. When the player dies, it will call that checkpoint and will load the new map. 
Example:
 void OnStart(){
 AddEntityCollideCallback("Player", "CPArea", "checkpoint1_func", true, 1); //area the player walks into to create the checkpoint
 }
 
 void checkpoint1_func(string &in asparent, string &in aschild, int alstate)
 {
 CheckPoint("checkpoint1", "PlayerStartArea_1", "DEATHMAP", "DeathHintCategory", "DeathHintEntry"); //checkpoint with callback for new map
 }
 
 void DEATHMAP(string &in asname, int alcount)
 {
 ChangeMap("MapName", "PlayerStartPos", "StartSound", "EndSound"); //loading new map upon death
 }
Use Ctrl+F to find the functions here so you can get a better understanding of the strings and whatnot:
http://wiki.frictionalgames.com/hpl2/amn..._functions
				
(This post was last modified: 02-22-2013, 08:16 PM by Statyk.)
 |  |  
	| 02-22-2013, 08:15 PM |  |  
	
		| tonitoni1998   Member
 
 Posts: 163
 Threads: 54
 Joined: Oct 2012
 Reputation: 
1
 | 
			| RE: how can i change what the map is like when he dies? 
 
				 (02-22-2013, 08:15 PM)Statyk Wrote:  You need to create a checkpoint before the place the player will die at and in that checkpoint function, there is a callback feature (labelled "DEATHMAP" in my example). Give it a function to load the new map. When the player dies, it will call that checkpoint and will load the new map.
 Example:
 
 void OnStart(){
 AddEntityCollideCallback("Player", "CPArea", "checkpoint1_func", true, 1); //area the player walks into to create the checkpoint
 }
 
 void checkpoint1_func(string &in asparent, string &in aschild, int alstate)
 {
 CheckPoint("checkpoint1", "PlayerStartArea_1", "DEATHMAP", "DeathHintCategory", "DeathHintEntry"); //checkpoint with callback for new map
 }
 
 void DEATHMAP(string &in asname, int alcount)
 {
 ChangeMap("MapName", "PlayerStartPos", "StartSound", "EndSound"); //loading new map upon death
 }
Use Ctrl+F to find the functions here so you can get a better understanding of the strings and whatnot:
 http://wiki.frictionalgames.com/hpl2/amn..._functions
 
thanks that was what i am looking for    
 When you are looking for someone, to do the scripting for your Custom Story, ask me! |  |  
	| 02-23-2013, 12:41 AM |  |  |