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
Need help with this scripting.
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#1
Need help with this scripting.

Hey guys. I am working on a custom story and there is this part where you are in a hallway and a grunt is patrolling it. You have to sneak across him in order to get to the other room. But the thing i want to do is that if the player fails to sneak across the hallway and dies, I want the player respawn and try sneak pass him again. (like a videogames these days. if you die, you start from a checkpoint and you have to do the part again.) I just cant seem to do it. When I die, i do start at the assigned checkpoint, but the script areas no longer work and the grunt doesn't spawn anymore. Is there a way to do it? Please help. Thanks!
06-29-2012, 07:18 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#2
RE: Need help with this scripting.

Might just refer you to http://www.frictionalgames.com/forum/thr...age-2.html
06-29-2012, 07:22 PM
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#3
RE: Need help with this scripting.

(06-29-2012, 07:22 PM)FastHunteR Wrote: Might just refer you to http://www.frictionalgames.com/forum/thr...age-2.html
i tried it but i cant seem to get it to work. Here it is:


void OnEnter()
{
AddEntityCollideCallback("Player", "ActivateSpawn_1", "Respawn_1", true, 1);
}


void Respawn_1(string &in asParent, string &in asChild, int alState)
{
CheckPoint("","PlayerRespawnArea_1" ,"TryAgainOne", "DeathHints", "DeathHint1");
}


void TryAgainOne(string &in asParent, string &in asChild, int alState)
{
CreateEntityAtArea("hallway_grunt", "", "monster_area1", false);
}

And if i get the monster to work, is there a way to get a script area to spawn again?
06-29-2012, 07:39 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#4
RE: Need help with this scripting.

wrong callback syntax at TryAgainOne.
right one is:
void TryAgainOne(string &in asName, int alCount)
Also, you forgot the entity file at CreateEntityAtArea:
CreateEntityAtArea("hallway_grunt", "servant_grunt.ent", "monster_area1", false);
And your second question, what do you mean by script area? I don't understand your question.
06-29-2012, 07:47 PM
Find
EXAWOLT Offline
Member

Posts: 113
Threads: 14
Joined: Apr 2012
Reputation: 3
#5
RE: Need help with this scripting.

if you want the area to work several times, just change the true to false.
instead of creating an enemy at a entity, i suggest to set out one in the editor and make him inactive, and when colliding with the area, the monster will be activated, and if you die, the monsters will always dissappear but when you collides with the area it will respawn.
SetEntityActive("Monster", true);

simply nuff said




(This post was last modified: 06-29-2012, 07:50 PM by EXAWOLT.)
06-29-2012, 07:48 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#6
RE: Need help with this scripting.

It will respawn? Good to know, thought it wouldn't.
One more thing though, does OnEnter() play again when you respawn?
(This post was last modified: 06-29-2012, 08:03 PM by Cruzore.)
06-29-2012, 07:51 PM
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#7
RE: Need help with this scripting.

(06-29-2012, 07:47 PM)FastHunteR Wrote: wrong callback syntax at TryAgainOne.
right one is:
void TryAgainOne(string &in asName, int alCount)
Also, you forgot the entity file at CreateEntityAtArea:
CreateEntityAtArea("hallway_grunt", "servant_grunt.ent", "monster_area1", false);
And your second question, what do you mean by script area? I don't understand your question.
alright, i got the monster to spawn again, but how do i get him to spawn where he first came from instead of the spot where he killed me? And for the other question, i want the script areas to activate again after the player dies. Ex: the player walks down a hallway and goes through a script area, which cause the screen to fade and forcing the player to put away his lantern., i want it so that if the player dies, all this would happen again when he went through a second time. It sounds weird when i put it in words, so i found a video that would help describe it.

Notice as he goes though the part at 6:43 but dies later on, but at 7:34 when he respawns all the things happen again, like the screen turning black.



06-29-2012, 08:03 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#8
RE: Need help with this scripting.

Exawolt's solution should fix both. So, anyone knows if OnEnter() plays again after you respawn?
06-29-2012, 08:06 PM
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#9
RE: Need help with this scripting.

(06-29-2012, 07:48 PM)EXAWOLT Wrote: if you want the area to work several times, just change the true to false.
instead of creating an enemy at a entity, i suggest to set out one in the editor and make him inactive, and when colliding with the area, the monster will be activated, and if you die, the monsters will always dissappear but when you collides with the area it will respawn.
SetEntityActive("Monster", true);
I tried it but he wont even spawn when i collide with the area anymore

(06-29-2012, 07:48 PM)EXAWOLT Wrote: if you want the area to work several times, just change the true to false.
instead of creating an enemy at a entity, i suggest to set out one in the editor and make him inactive, and when colliding with the area, the monster will be activated, and if you die, the monsters will always dissappear but when you collides with the area it will respawn.
SetEntityActive("Monster", true);
Heres a pic
[Image: ?action=view&current=helppic.png]


i want it so that if the player fails, everything resets, such as the enemy pos and the fadeout script area
(This post was last modified: 06-29-2012, 08:21 PM by HoyChampoy.)
06-29-2012, 08:06 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: Need help with this scripting.

If the grunt kills the player, it won't activate again. The monsters were designed to not prevent the player from progressing, and dynamically created monsters don't follow path nodes. You'll need to have monsters in store to "reactivate" them.

Tutorials: From Noob to Pro
06-29-2012, 08:22 PM
Website Find




Users browsing this thread: 3 Guest(s)