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
How to end custom story as a Demo?
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#31
RE: How to end custom story as a Demo?

This is so troublesome D:<
07-15-2011, 01:51 AM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#32
RE: How to end custom story as a Demo?

you could try this:
I have two possible solutions, if the first doesn't work, try the other

1. so you want it so that when you use the key on the level door, it unlocks. Sorry if someone else has posted this but couldn't you just do
void OnStart()
{
AddUseItemCallback("key" , "levelDoor" , "StartCredits" , true);
}
void StartCredits(asItem , asEntity)
{
StartCredits("" , "" , "");
}
most of the function names are wrong, because i cant remember them off the top of my head.
Im guessing that you have already tried the above, and also i think you said that you wanted the credits to start when you click on the door. so try this:

2. create an area just in front of the door, add a use item callback so when you use the key on the Door, the callback calls. - set boolautodestroy true
Spoiler below!
void OnStart()
{
AddUseItemCallback("key" , "mydoor" , "unlock" , true);
}

then for the callback make it so that when you use the key on the door, a local variable is set to 1

Spoiler below!
void unlock(string &in asItem, string &in asEntity)
{
SetLocalVarInt("IsDoorUnlocked" , 1);
}

finally, in your level editor, set the door locked, and under player interact calbacks, add a callback called eg: StartCredits
then in the editor add the code:
Spoiler below!
void StartCredits(string &in asEntity)
{
if(GetLocalVarInt("IsDoorUnlocked") == 1){
StartCredits("" , "" , "");
// whatever else you wanna do
}
}

again not all te code is perfect, so if it says fatal error(which it will do in that state) just look through the code, try to solve it, hope this helps Big Grin


Edit: I suppose you wouldn't even need to make an area in front of the door - just change "mydoorarea" to "mydoor" in the useitemcallback Smile just make sure you dont actually unlock the level door

(This post was last modified: 07-15-2011, 11:27 AM by DRedshot.)
07-15-2011, 11:21 AM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#33
RE: How to end custom story as a Demo?

hmm.. got an error saying
(162, 1) Expected ';'
Which is pretty impossible considering the fact the the only thing on row 162 is '{ syntax error somewhere?

void UseKeyOnDoor_6(string &in asItem, string &in asEntity)
{
    SetLocalVarInt("IsDoorunLocked", 1);
    SetLevelDoorLocked("labdoor", false);
    PlaySoundAtEntity("", "unlock_door", "labdoor", 0, false);
    RemoveItem("labkey_1");
}

void UsedKeyOnDoor_10(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("lloydsoffice", false, true);
    PlaySoundAtEntity("", "unlock_door", "lloydsoffice", 0, false);
    RemoveItem("lloydskey_1");
    SetMessage("Message", "lloydsdooropen", 0);
}

void StartCredits(string &in asEntity)
{
If(GetLocalVarInt("IsDoorunLocked") == 1)
{
FadeOut(2.0f);
StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}
}
07-16-2011, 08:28 PM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#34
RE: How to end custom story as a Demo?

your if statement has a capital 'I', it must be lowercase to work
'if(GetLocalVarInt("IsDoorunLocked") == 1)'

Not 'If(GetLocalVarInt("IsDoorunLocked") == 1)'

07-16-2011, 09:21 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#35
RE: How to end custom story as a Demo?

IT DOESN"T WORK!! >Sad THis is getting rediculous...
07-16-2011, 10:06 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#36
RE: How to end custom story as a Demo?

Don't use that kind of method then. Just make a collidecallback and when you collide with that box the story ends and the credits roll.

[Image: 44917299.jpg]Dubstep <3
07-16-2011, 10:20 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#37
RE: How to end custom story as a Demo?

Here's the main problem, getting the credits to "roll", I'll go with the entire map full of credits method for a while, see if I could fix it, it plays the music, the screen fades to black, but the credits themselves don't show up.
07-16-2011, 10:33 PM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#38
RE: How to end custom story as a Demo?

What is the problem? I cant see anything else wrong with the script. If the problem is that you go through the level door when you click on it, comment out the line: SetLevelDoorLocked("labdoor", false);
and add it in again once you've uploaded the demo, that is, if you are still using my script. Also, if that doesn't work, you have probably named something wrong in your level editor/ .lang file

07-16-2011, 10:34 PM
Find
Zypherzemus Offline
Member

Posts: 94
Threads: 7
Joined: Jul 2011
Reputation: 0
#39
RE: How to end custom story as a Demo?

I've done what you've suggested, but it still won't work, I checked both the .lang and .hps files to see if they matched several times, they both match. I don't believe anything is wrong with the .lang file.
take a look?
07-16-2011, 10:53 PM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#40
RE: How to end custom story as a Demo?

Ok, does your AddUseItemCallback look word for word exactly like this?

AddUseItemCallback("Unlock" , "labkey_1" , "labdoor" , "UseKeyOnDoor_6" , true);

also, in void OnStart() add

SetLocalVarInt("IsDoorunLocked", 0);

if its still messing up change the UseKeyOnDoor_6 part of the script to:

void UseKeyOnDoor_6(string &in asItem, string &in asEntity)
{
SetLocalVarInt("IsDoorunLocked", 1);
SetLevelDoorLocked(asEntity, false);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}

also, if none of these suggestions work, you may aswell try this --

try making a script area cover the door, rename the door to "randomnamehere" and call the script area "labdoor" hopefully that will work...


07-16-2011, 11:07 PM
Find




Users browsing this thread: 1 Guest(s)