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?
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


Messages In This Thread
RE: How to end custom story as a Demo? - by xtron - 07-14-2011, 03:11 AM
RE: How to end custom story as a Demo? - by xtron - 07-14-2011, 12:30 PM
RE: How to end custom story as a Demo? - by xtron - 07-14-2011, 05:54 PM
RE: How to end custom story as a Demo? - by xtron - 07-14-2011, 07:38 PM
RE: How to end custom story as a Demo? - by xtron - 07-14-2011, 09:20 PM
RE: How to end custom story as a Demo? - by xtron - 07-15-2011, 12:20 AM
RE: How to end custom story as a Demo? - by xtron - 07-15-2011, 01:00 AM
RE: How to end custom story as a Demo? - by DRedshot - 07-15-2011, 11:21 AM
RE: How to end custom story as a Demo? - by xtron - 07-16-2011, 10:20 PM



Users browsing this thread: 1 Guest(s)