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
I can't get my script to work D:
Wrathborn771 Offline
Junior Member

Posts: 45
Threads: 10
Joined: Jun 2012
Reputation: 0
#17
RE: I can't get my script to work D:

(07-01-2012, 11:59 AM)FastHunteR Wrote: So you're looking for explanations too? Sure thing. SetEntityCallbackFunc is probably the hardest to understand of all the callbacks, I hate that callback so much...
So, let's start.
Let's assume you have a "you can't get out of the room with the grunt" one, but there are other ways too.
So, you got a room with a door the player enter through, that door is called "mansion_1"
Then, the note is named "Thanks" and the enemy is called "bro_1".
Also, i'll assume you don't have any custom credits music, so i'll choose the probably best of the main one(alexander one)
At first, the complete script. Then, i'll explain it as good as I can:
PHP Code: (Select All)
void OnStart()
{
SetEntityCallbackFunc("Thanks""OnPickup");
}
void OnPickup(string &in asEntitystring &in type)
{
if(
asEntity == "Thanks")
{
SetEntityActive("bro_1"true);
SetSwingDoorClosed("mansion_1"truetrue);
SetSwingDoorLocked("mansion_1"truetrue);
AddTimer("TimerDeath"0.5"IfDeathLoop");
}
}
void IfDeathLoop(string &in asTimer)
{
AddTimer("TimerDeath"0.5"IfDeathLoop");
if(
GetPlayerHealth() <= 0)
{
RemoveTimer("TimerDeath");
StartCredits("ending_alexander.ogg"false"Ending""MainCredits"9001);
}

extra_english.lang file:
Your Description of the story here.



Your credits here(special thanks and such)


NameofyourNote
TextofyourNote
So, for the explanation:
At first, we got a OnPickup Callback for the note. First the name of entity(the note) and then the function "OnPickup". You can't change the name of the function.
then, we got the callback syntax you should easily get from the script functions page. We first check is the picked up entity that note? If so, then we set the monster you place somewhere in the level editor inactive active, close and lock the door(not sure if this one will work, try it out. If not, ask again) and add a timer that actives in 0.5 seconds. Then, in that function, we add that timer again in 0.5 seconds, creating an infinite loop(This is needed because you want the credits to roll right when you die. You can't do it any other way I think.) In this loop, we first deactive the timer(just in case) and check if the player health is lower or equal to 0(not sure if it could go even below, that's why lower). If it is, then the credits roll(music is alexander ending one, and the 9001 is because if you go any other number than 0-2, then there won't be a code at the bottom(the ones for the super secret.rar file).
For the .lang file, we first got the Description of your custom story, then the entry for the ending, then the entry for your note(go on the note and check which entry you selected, and paste it there. Category should always be Journal)
Any more questions? If so, feel free to ask.


Thank you, thankyouthankyou THANK YOU! It worked just as I wanted it to ;D
Reputation to you, good sir. Smile
07-01-2012, 01:02 PM
Find


Messages In This Thread
RE: I can't get my script to work D: - by Datguy5 - 06-28-2012, 10:36 PM
RE: I can't get my script to work D: - by Datguy5 - 06-29-2012, 12:01 AM
RE: I can't get my script to work D: - by Datguy5 - 06-30-2012, 03:39 PM
RE: I can't get my script to work D: - by EXAWOLT - 06-30-2012, 03:48 PM
RE: I can't get my script to work D: - by EXAWOLT - 06-30-2012, 04:49 PM
RE: I can't get my script to work D: - by Cruzore - 06-30-2012, 04:51 PM
RE: I can't get my script to work D: - by Cruzore - 07-01-2012, 12:25 AM
RE: I can't get my script to work D: - by Cruzore - 07-01-2012, 11:59 AM
RE: I can't get my script to work D: - by Wrathborn771 - 07-01-2012, 01:02 PM



Users browsing this thread: 1 Guest(s)