Frictional Games Forum (read-only)
Scripting, need urgent help! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Scripting, need urgent help! (/thread-9259.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

So far I've got this:
Spoiler below!
void OnStart()
{
AddEntityCoolideCallback("Player", "monster_death", "MonsterFunc1", true, 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("monster_grunt" , true);
SetPlayerActive(false);
}

but that will only disable the player and let the monster kill him.. I have never worked with credits before but I'm determined to figure out how for you!!!! -is on a mission-


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

Thats what I want. The end of the demo is your death, but how do I make it say "The End" at least?


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

So I did some snooping and found one of Kyle's examples:
Spoiler below!
void OnStart()
{
SetLocalVarInt("Var01", 0);
AddUseItemCallback("", "Key01", "level_wood_1", "Cred01", true);
SetEntityPlayerInteractCallback("level_wood_1", "Cred02", false);
}
void Cred01(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
SetLocalVarInt("Var01", 1);
}
void Cred02(string &in asEntity)
{
if (GetLocalVarInt("Var01") == 1)
{
StartCredits("", true, "Credits", "End", 10);
}
}

He said it's meant that, when you unlock the door, the credits start. I don't know how to work credits! >.<
Oh, in that case, we can use SetDeathHint(string& asTextCategory, string& asTextEntry); and have it say THE END.. but how to make it so the player doesn't spawn back to the beginning I'm clueless on.


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

Uh oh. Im confused now.


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

Maybe you should post a new thread out there describing what you want, I'm sure a senior member is around to help.


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

Did this:

void OnStart()
{
AddEntityCoolideCallback("Player", "monster_death", "MonsterFunc1", true, 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("monster_grunt" , true);
SetPlayerActive(false);
}

Actually work?


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

That's actually supposed to be AddEntityCollideCallback* my bad.
After adding a ShowEnemyPlayerPosition, yes it did, I walked into the area, was unable to move, and the monster broke down the door and ate me. After I died the message displayed "You have to carry on.." and re-spawned me back to the start, but I still couldn't move.


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

How does it know where to freeze you?


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

I added a script area right in front of the door (that's what monster_death is) and named it monster_death..


RE: Scripting, need urgent help! - DRedshot - 07-24-2011

maybe you could add a checkpoint, then when you die, make it roll the credits right away, you may have to look into checkpoints, 'cos i've never actually used them myself, but i know that they execute when you die, and can be used to set death hints. If you use notepad++ with the .hps plugins (http://wiki.frictionalgames.com/hpl2/third_party_tools/text/notepad) you should just be able to type checkpoint, and use arrow keys untill you find the right function. hope this helps Smile
yep, i found the function on the wiki:

here it is:

CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

Sets a checkpoint at which the player will respawn in case he dies.
Callback syntax: void MyFunc(string &in asName, int alCount)
Count is 0 on the first checkpoint load!

asName - the internal name
asStartPos - the name of the StartPos in the editor
asCallback - the function to call when the player dies/respawns
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file

so in your case the code will go like this:
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "monster_death", "MonsterFunc1", true, 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("monster_grunt" , true);
SetPlayerActive(false);
CheckPoint ("EndGame", "Player_Start", "StartCredits", "DeathHintCategory", "DeathHintEntry");
}
void StartCredits(string &in asName , int &in alState)
{
StartCredits("", true, "Credits", "End", 10);
}

DeathHintCategory is the category name of your choice in the .lang file
DeathHintEntry is the name of your choice, and the text will be "The End" in your case
Credits is the category for your credits in the .lang file
End is the entry for your credits also in .lang

ps: I have copied some of the code above from jenniferOrange, All of the stuff after "SetPlayerActive(false);" is new stuff

Hope this helps you out!