| 
		
	
		| serbusfish   Member
 
 Posts: 211
 Threads: 75
 Joined: Aug 2012
 Reputation: 
0
 | 
			| Checkpoints and autosave help 
 
				First of all i'm wanting to put a checkpoint in place so that if a monster kills you you respawn close by but the monster is gone. I know this is like the default thing that happens but I cant figure it out, I have a player start area in place, im just not sure what to do with this:
 void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);
 
 Do I put this in the part of the script that spawns the monster? And what would I put for the 'string& asCallback' bit?
 
 -------------------------------------------------------------------
 
 Second question, I was just wondering how the 'void AutoSave();' command works, do I put this at the beginning of a map or the end? And if say, items have been collected, if the player exits and reloads will the game have saved this or do I need to put auto save commands in the scripts after item pickups? And do I need to assign start areas or will it just start at the place you exit at?
 
 |  |  
	| 05-02-2013, 12:50 PM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Checkpoints and autosave help 
 
				Create a script area at the place where the Player would be respawning and name it "ScriptAreaMonsterRespawn" without the quotation marks. 
After that, put an in-active enemy at the place of the original one called "EnemyInActive" without the quoatation marks.
 
Now, copy paste the following script.
 void OnStart(){
 AddEntityCollideCallback("Player", "ScriptAreaMonsterRespawn", "MonsterRespawn", true, 0);
 }
 
 void MonsterRespawn(string &in asParent, string &in asChild, int alState);
 {
 SetEntityActive("EnemyInActive", true);
 }
 
And I do not know about the AutoSave thing. Just put in on the void OnEnter() part.  
Just put that s**t in. I'm just following FG's scripts.
			
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 05-02-2013, 12:57 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Checkpoints and autosave help 
 
				Ehem: 
Fixed:
 void OnStart(){
 AddEntityCollideCallback("Player", "ScriptAreaMonsterRespawn", "MonsterRespawn", true, 0);
 }
 
 void MonsterRespawn(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("EnemyInActive", true);
 CheckPoint ("Checkpoint_1", "PlayerStartArea_checkpoint", "", "DeathHintCategory", "DeathHintEntry");  ///Put the PlayerStartArea_checkpoint right where the script area is.
 }
 
Edit: Fixed.
			
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan.
				
(This post was last modified: 05-02-2013, 03:56 PM by The chaser.)
 |  |  
	| 05-02-2013, 01:53 PM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Checkpoints and autosave help 
 
				Right. 
BTW, at this code, after the closing ), there's a ; 
You should remove them. This is the mentioned code.
 void MonsterRespawn(string &in asParent, string &in asChild, int alState); <This one 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 05-02-2013, 01:58 PM |  |  
	
		| serbusfish   Member
 
 Posts: 211
 Threads: 75
 Joined: Aug 2012
 Reputation: 
0
 | 
			| RE: Checkpoints and autosave help 
 
				Ah right that makes total sense now I see it written down, although I wouldn't have know to do any of that extra stuff with the script boxes    Thanks guys, i'll give it a try in a bit.
			
 
				
(This post was last modified: 05-02-2013, 05:00 PM by serbusfish.)
 |  |  
	| 05-02-2013, 03:04 PM |  |  
	
		| serbusfish   Member
 
 Posts: 211
 Threads: 75
 Joined: Aug 2012
 Reputation: 
0
 | 
			| RE: Checkpoints and autosave help 
 
				Hmmm i'm confused, shouldn't 'SetEntityActive' be false so the enemy isnt there after respawn? 
 Also i'm using alternative music when the enemy arrives, so I used the command StopMusic to stop the normal level music then play the enemy music. However as it stands now I respawn and no music is playing at all.
 
 Is there a way to activate a script area on respawn, that way I can tell it to start playing the regular level music again when you collide with it?
 
 
				
(This post was last modified: 05-02-2013, 05:39 PM by serbusfish.)
 |  |  
	| 05-02-2013, 05:37 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Checkpoints and autosave help 
 
				Yes, just: void OnStart(){
 AddEntityCollideCallback("Player", "ScriptAreaMonsterRespawn", "MonsterRespawn", true, 0);
 }
 
 void MonsterRespawn(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("EnemyInActive", true);
 CheckPoint ("Checkpoint_1", "PlayerStartArea_checkpoint", "CheckDaPoint", "DeathHintCategory", "DeathHintEntry");  ///Put the PlayerStartArea_checkpoint right where the script area is.
 }
 
 void CheckDaPoint (string &in asName, int alCount)
 {
 SetEntityActive("Musicarea", true);
 AddEntityCollideCallback("Player, "Musicarea", "PlayMusische", true, 1);
 }
 
 void Musische (string &in asParent, string &in asChild, int alState)
 {
 PlayMusic("Yourmusic.ogg", true, 1, 1, 1, false);
 }
 
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 05-03-2013, 01:18 PM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Checkpoints and autosave help 
 
				 (05-03-2013, 01:18 PM)The chaser Wrote:  Yes, just:
 
 void OnStart(){
 AddEntityCollideCallback("Player", "ScriptAreaMonsterRespawn", "MonsterRespawn", true, 0);
 }
 
 void MonsterRespawn(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("EnemyInActive", true);
 CheckPoint ("Checkpoint_1", "PlayerStartArea_checkpoint", "CheckDaPoint", "DeathHintCategory", "DeathHintEntry");  ///Put the PlayerStartArea_checkpoint right where the script area is.
 }
 
 void CheckDaPoint (string &in asName, int alCount)
 {
 SetEntityActive("Musicarea", true);
 AddEntityCollideCallback("Player, "Musicarea", "PlayMusische", true, 1);
 }
 
 void Musische (string &in asParent, string &in asChild, int alState)
 {
 PlayMusic("Yourmusic.ogg", true, 1, 1, 1, false);
 }
 
 Just a little bit of a fix from the chaser's script.
 void OnStart(){
 AddEntityCollideCallback("Player", "ScriptAreaMonsterRespawn", "MonsterRespawn", true, 0);
 }
 
 void MonsterRespawn(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("EnemyInActive", true);
 CheckPoint ("Checkpoint_1", "PlayerStartArea_checkpoint", "CheckDaPoint", "DeathHintCategory", "DeathHintEntry");  ///Put the PlayerStartArea_checkpoint right where the script area is.
 }
 
 void CheckDaPoint(string &in asName, int alCount)
 {
 SetEntityActive("Musicarea", true);
 AddEntityCollideCallback("Player", "Musicarea", "PlayMusic", true, 1);
 }
 
 void PlayMusic(string &in asParent, string &in asChild, int alState)
 {
 PlayMusic("Yourmusic.ogg", true, 1, 1, 1, false);
 }
 
 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 05-03-2013, 02:43 PM |  |  |