Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Checkpoints and autosave help
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#1
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
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
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.
PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaMonsterRespawn""MonsterRespawn"true0);
}

void MonsterRespawn(string &in asParentstring &in asChildint 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
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: Checkpoints and autosave help

Ehem:

Fixed:

PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaMonsterRespawn""MonsterRespawn"true0);
}

void MonsterRespawn(string &in asParentstring &in asChildint 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]

Aculy iz dolan.
(This post was last modified: 05-02-2013, 03:56 PM by The chaser.)
05-02-2013, 01:53 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
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.
PHP Code: (Select All)
void MonsterRespawn(string &in asParentstring &in asChildint alState); <This one 

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 05-02-2013, 01:59 PM by PutraenusAlivius.)
05-02-2013, 01:58 PM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#5
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 Smile 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
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#6
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
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: Checkpoints and autosave help

Yes, just:

PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaMonsterRespawn""MonsterRespawn"true0);
}

void MonsterRespawn(string &in asParentstring &in asChildint 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 asNameint 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]

Aculy iz dolan.
05-03-2013, 01:18 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#8
RE: Checkpoints and autosave help

(05-03-2013, 01:18 PM)The chaser Wrote: Yes, just:

PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaMonsterRespawn""MonsterRespawn"true0);
}

void MonsterRespawn(string &in asParentstring &in asChildint 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 asNameint 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.
PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""ScriptAreaMonsterRespawn""MonsterRespawn"true0);
}

void MonsterRespawn(string &in asParentstring &in asChildint 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 asNameint alCount)
{
SetEntityActive("Musicarea"true);
AddEntityCollideCallback("Player""Musicarea""PlayMusic"true1);
}

void PlayMusic(string &in asParentstring &in asChildint alState)
{
PlayMusic("Yourmusic.ogg"true111false);


"Veni, vidi, vici."
"I came, I saw, I conquered."
05-03-2013, 02:43 PM
Find




Users browsing this thread: 1 Guest(s)