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


Thread Rating:
  • 5 Vote(s) - 3.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting, need urgent help!
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#61
RE: Scripting, need urgent help!

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-

Ba-da bing, ba-da boom.
07-24-2011, 04:23 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#62
RE: Scripting, need urgent help!

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

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 04:27 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#63
RE: Scripting, need urgent help!

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.

Ba-da bing, ba-da boom.
(This post was last modified: 07-24-2011, 04:29 AM by JenniferOrange.)
07-24-2011, 04:27 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#64
RE: Scripting, need urgent help!

Uh oh. Im confused now.

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 04:35 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#65
RE: Scripting, need urgent help!

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

Ba-da bing, ba-da boom.
07-24-2011, 04:43 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#66
RE: Scripting, need urgent help!

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?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 04:51 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#67
RE: Scripting, need urgent help!

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.

Ba-da bing, ba-da boom.
07-24-2011, 05:03 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#68
RE: Scripting, need urgent help!

How does it know where to freeze you?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 05:18 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#69
RE: Scripting, need urgent help!

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


Attached Files
.jpg   11.jpg (Size: 182.11 KB / Downloads: 101)

Ba-da bing, ba-da boom.
07-24-2011, 05:22 AM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#70
RE: Scripting, need urgent help!

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/thi...xt/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:
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!

(This post was last modified: 07-24-2011, 05:41 AM by DRedshot.)
07-24-2011, 05:28 AM
Find




Users browsing this thread: 2 Guest(s)