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:
EXAWOLT Offline
Member

Posts: 113
Threads: 14
Joined: Apr 2012
Reputation: 3
#11
RE: I can't get my script to work D:

SetEntityCallbackFunc("note", "OnPickup");
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("monster", true);
}

simply nuff said




(This post was last modified: 06-30-2012, 04:50 PM by EXAWOLT.)
06-30-2012, 04:49 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#12
RE: I can't get my script to work D:

SetEntityCallbackFunc("note", "OnPickup");
void OnPickup(string &in asEntity, string &in type)
{
if(asEntity == "note")
{
}
}
Needed when you want more than 1 callbacks for OnPickup, which you will most likely have later.
06-30-2012, 04:51 PM
Find
Wrathborn771 Offline
Junior Member

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

(06-30-2012, 04:51 PM)FastHunteR Wrote: SetEntityCallbackFunc("note", "OnPickup");
void OnPickup(string &in asEntity, string &in type)
{
if(asEntity == "note")
{
}
}
Needed when you want more than 1 callbacks for OnPickup, which you will most likely have later.
Didn't work when I tried it tho. Can you try to create the final complete script that I need for the story?
I want a monster to spawn when picking up a note and kills the player, and the credits to pop up when dying.
The name of the note should be "Thanks", the name of the monster should be "bro_1".
Thanks
-Wrathborn
06-30-2012, 11:57 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#14
RE: I can't get my script to work D:

How exactly do you want him to die? Is it some sort of "You can't get out" kill, a FadeOut one, or a SetPlayerhealth to 0 one? It depends on how you want to have it. Also, it's better when you do it yourself, as that increases your scripting knowledge far better than copying the whole script from others. And if you want your story to be at least intermediate and not shit, you will probably need more than 3 functions and their callbacks, and don't expect anyone to write all that for you, except when you make a whole team, with a scripter, mapper, story writer and such.

Think, before you speak Google, before you post
07-01-2012, 12:25 AM
Find
Wrathborn771 Offline
Junior Member

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

(07-01-2012, 12:25 AM)FastHunteR Wrote: How exactly do you want him to die? Is it some sort of "You can't get out" kill, a FadeOut one, or a SetPlayerhealth to 0 one? It depends on how you want to have it. Also, it's better when you do it yourself, as that increases your scripting knowledge far better than copying the whole script from others. And if you want your story to be at least intermediate and not shit, you will probably need more than 3 functions and their callbacks, and don't expect anyone to write all that for you, except when you make a whole team, with a scripter, mapper, story writer and such.
THIS IS THE FIRST TIME I SCRIPT.
Therefore I'm having serious problems, and I don't know how to get a script without asking.

And this CS is just 3 maps, a test.
No story, no nothing. Just mapping and basic scripting, aswell as a few imported pictures on the walls. So I can get a hang of it, and become better.

You see how it ended up as shit when I tried to create my own script, and I didn't know wtf to do because there was no fucking info on google about that error I got.

So please, can you either create that script for me, or tell me how to create it? Because that thread I found wasn't particuarly good for noobs.
07-01-2012, 10:38 AM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#16
RE: I can't get my script to work D:

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:
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Your Description of the story here.</Entry>

</CATEGORY>
<CATEGORY Name="Ending">
<Entry Name="MainCredits">Your credits here(special thanks and such) </Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_YourNoteEntryHere_Name">NameofyourNote</Entry>
<Entry Name="Note_YourNoteEntryHere_Text">TextofyourNote</Entry>
</CATEGORY>
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.

Think, before you speak Google, before you post
(This post was last modified: 07-01-2012, 12:00 PM by Cruzore.)
07-01-2012, 11:59 AM
Find
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




Users browsing this thread: 3 Guest(s)