Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to end custom story as a Demo?
Author Message
xtron Offline
Senior Member

Posts: 402
Joined: May 2011
Reputation: 2
Post: #21
RE: How to end custom story as a Demo?

Could you please give me a description on how you want it?.

or

You can add me on msn or skype.

msn: mattias_dionysus@hotmail.com
skype: xuxz0r
steam: xuxz0r

[Image: 44917299.jpg]Dubstep <3
07-14-2011 05:54 PM
Find all posts by this user Quote this message in a reply
Snuffalofagus Offline
Member

Posts: 94
Joined: Jul 2011
Reputation: 0
Post: #22
RE: How to end custom story as a Demo?

I'd add you on steam, but I don't have enough games yet.

Here is what I want to happen.
When you first start off the hub level, all level doors are locked except one, you enter that level door, then come out and open another, then you get the key to a swing door in the hub level which has the key to the last level door (end of demo) All I want to happen is when you unlock the door, the screen fades to black and then the credits start.
07-14-2011 06:21 PM
Find all posts by this user Quote this message in a reply
xtron Offline
Senior Member

Posts: 402
Joined: May 2011
Reputation: 2
Post: #23
RE: How to end custom story as a Demo?

void OnStart()
{
AddUseItemCallback("", "key1", "door1", "unlock_door", true);
}

void unlock_door(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, false);
if(GetSwingDoorLocked("door1") == false)
    {
    AddTimer("", 2.5f, "timer_credits");
    FadeOut(2);
    }
}

void timer_credits (string &in astimer)
{
    StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}

Change key1 to the key name and door1 to the door name.

When you insert the key unlock_door will check if the door is locked and if it's not the screen will fadeout and play the credits.

[Image: 44917299.jpg]Dubstep <3
07-14-2011 07:38 PM
Find all posts by this user Quote this message in a reply
Snuffalofagus Offline
Member

Posts: 94
Joined: Jul 2011
Reputation: 0
Post: #24
RE: How to end custom story as a Demo?

(07-14-2011 07:38 PM)xtron Wrote:  
void OnStart()
{
AddUseItemCallback("", "key1", "door1", "unlock_door", true);
}

void unlock_door(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, false);
if(GetSwingDoorLocked("door1") == false)
    {
    AddTimer("", 2.5f, "timer_credits");
    FadeOut(2);
    }
}

void timer_credits (string &in astimer)
{
    StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}

Change key1 to the key name and door1 to the door name.

When you insert the key unlock_door will check if the door is locked and if it's not the screen will fadeout and play the credits.

The thing is, it's not a swing door, it's a level door
07-14-2011 08:15 PM
Find all posts by this user Quote this message in a reply
convolution223 Offline
Member

Posts: 79
Joined: Jul 2011
Reputation: 0
Post: #25
RE: How to end custom story as a Demo?

(07-14-2011 07:26 AM)Snuffalofagus Wrote:  
(07-14-2011 07:13 AM)convolution223 Wrote:  
(07-14-2011 07:08 AM)Snuffalofagus Wrote:  EEK, I'm not very good with variables and such.
Hmm...
AddLocalVarInt? or SetLocalVarInt?
and would I need to make a new .hps file strictly for local variables? (kinda like global variables)
and If not, where would the command(s) go? OnStart, or OnEnter?
sorry for all the questions, I'd rather ask them now and not bug you later y'know?

:o wait... you need to make a new .hps file for global variables? I was trying to use global variables I set up in one map in a different map and it wasn't working, but are you sure you set up another .hps file? what would it be called and what would it look like (or just point me to where i can find an example from the main game, please)?

It's very simple. You use the "(Add, Set, etc.)GlobalVar(Int, Float, String, etc.) and place it in the .hps file. It's supposed to be named "global.hps"
and it's only one section.
Here:
void OnGameStart()
{

}

THANK YOU. Big Grin
07-14-2011 08:57 PM
Find all posts by this user Quote this message in a reply
xtron Offline
Senior Member

Posts: 402
Joined: May 2011
Reputation: 2
Post: #26
RE: How to end custom story as a Demo?

void OnStart()
{
SetEntityPlayerInteractCallback("door1", "func_credits", false);
}

void func_credits(string &in asEntity)
{
StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}

how about that?

[Image: 44917299.jpg]Dubstep <3
(This post was last modified: 07-14-2011 09:24 PM by xtron.)
07-14-2011 09:20 PM
Find all posts by this user Quote this message in a reply
Snuffalofagus Offline
Member

Posts: 94
Joined: Jul 2011
Reputation: 0
Post: #27
RE: How to end custom story as a Demo?

(07-14-2011 09:20 PM)xtron Wrote:  
void OnStart()
{
SetEntityPlayerInteractCallback("door1", "func_credits", false);
}

void func_credits(string &in asEntity)
{
StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}

how about that?
That would work but, I don't want the demo to end before the door is unlocked.
Ex: You're exploring the area and come across the locked level door, you try to open it, it's locked, then the credits start playing.
(Thats not what I want to happen)
Using that command would trigger it.
07-14-2011 09:33 PM
Find all posts by this user Quote this message in a reply
xtron Offline
Senior Member

Posts: 402
Joined: May 2011
Reputation: 2
Post: #28
RE: How to end custom story as a Demo?

but, how about:
void OnStart()
{
SetEntityPlayerInteractCallback("door1", "func_credits", false);
}

void func_credits(string &in asEntity)
{
if(GetLevelDoorLocked("door1") == false)
{
StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}
}

[Image: 44917299.jpg]Dubstep <3
07-15-2011 12:20 AM
Find all posts by this user Quote this message in a reply
Snuffalofagus Offline
Member

Posts: 94
Joined: Jul 2011
Reputation: 0
Post: #29
RE: How to end custom story as a Demo?

FATAL ERROR:
(136, 5) No matching signatures to 'GetLevelDoorLocked(string@&)
(136, 35) No conversion from bool to int available.
/////////////////////////////
// Run first time starting map
void OnStart()
{
    AddEntityCollideCallback("Player", "ScriptArea_1", "LightArea", true, 1);
    AddEntityCollideCallback("Player", "ScriptArea_2", "LightArea_2", true, 1);
        if (HasItem("girlsdormkey_1") == true)
     {
          RemoveItem("girlsdormkey_1");
          GiveItem("girlsdormkey_1", "key_tower.ent", "girlsdormkey", "", 1.0f);
     }
}

void LightArea(string &in asParent, string &in asChild, int alState)
{
    SetGlobalVarInt("music", 1);
    AddTimer("", 1.0f, "lightarea_1");
    AddTimer("", 2.0f, "lightarea_2");
    AddTimer("", 3.0f, "lightarea_3");
    AddTimer("", 4.0f, "lightarea_4");
}

void lightarea_1(string &in asTimer)
{
    SetLampLit("torch_static_green_8", true, true);
    SetLampLit("torch_static_green_1", true, true);
}

void lightarea_2(string &in asTimer)
{
    SetLampLit("torch_static_green_7", true, true);
    SetLampLit("torch_static_green_2", true, true);
}

void lightarea_3(string &in asTimer)
{
    SetLampLit("torch_static_green_6", true, true);
    SetLampLit("torch_static_green_3", true, true);
}

void lightarea_4(string &in asTimer)
{
    SetLampLit("torch_static_green_5", true, true);
    SetLampLit("torch_static_green_4", true, true);
}

void LightArea_2(string &in asParent, string &in asChild, int alState)
{
    AddTimer("", 0.5f, "lightarea_5");
    AddTimer("", 1.0f, "lightarea_6");
    AddTimer("", 1.5f, "lightarea_7");
    AddTimer("", 2.0f, "lightarea_8");
    AddTimer("", 2.5f, "lightarea_9");
    AddTimer("", 3.0f, "lightarea_10");
    AddTimer("", 3.5f, "lightarea_11");
    AddTimer("", 4.0f, "lightarea_12");
}

void lightarea_5(string &in asTimer)
{
    SetLampLit("torch_static_green_12", true, true);
    SetLampLit("torch_static_green_9", true, true);
}

void lightarea_6(string &in asTimer)
{
    SetLampLit("torch_static_green_11", true, true);
    SetLampLit("torch_static_green_13", true, true);
}

void lightarea_7(string &in asTimer)
{
    SetLampLit("torch_static_green_10", true, true);
    SetLampLit("torch_static_green_14", true, true);
}

void lightarea_8(string &in asTimer)
{
    SetLampLit("torch_static_green_15", true, true);
    SetLampLit("torch_static_green_20", true, true);
}

void lightarea_9(string &in asTimer)
{
    SetLampLit("torch_static_green_16", true, true);
    SetLampLit("torch_static_green_21", true, true);
}

void lightarea_10(string &in asTimer)
{
    SetLampLit("torch_static_green_17", true, true);
    SetLampLit("torch_static_green_22", true, true);
}

void lightarea_11(string &in asTimer)
{
    SetLampLit("torch_static_green_18", true, true);
    SetLampLit("torch_static_green_23", true, true);
}

void lightarea_12(string &in asTimer)
{
    SetLampLit("torch_static_green_19", true, true);
    SetLampLit("torch_static_green_24", true, true);
}


////////////////////////////
// Run when entering map
void OnEnter()
{
    AddUseItemCallback("", "girlsdormkey_1", "girlsdormdoor", "UsedKeyOnDoor_5", true);
    AddUseItemCallback("", "lloydskey_1", "lloydsoffice", "UsedKeyOnDoor_10", true);
    AddUseItemCallback("", "labkey_1", "labdoor", "UseKeyOnDoor_6", true);
    SetLevelDoorLockedText("labdoor", "Message", "lablocked");
    SetLevelDoorLockedText("girlsdormdoor", "Message", "girlsdormlocked");
    SetEntityPlayerInteractCallback("lloydsoffice", "InteractLloydsOffice", false);
    SetEntityPlayerInteractCallback("labdoor", "DemoCredits", false);
    if (GetGlobalVarInt("music") == 0)
        {
        PlayMusic("02_amb_safe.ogg", true, 100.0, 0.0, 1, true);
        }
    else if (GetGlobalVarInt("music") == 1)
        {
            PlayMusic("09_amb_safe.ogg", true, 100.0, 0.0, 1, true);
        }
        
        


}


void DemoCredits(string &in asEntity)
{
if (GetLevelDoorLocked("labdoor") == false)
    {
    FadeOut(2.0f);
    AddTimer("", 2.0f, "DemoCredits2");
    }
}
        
void DemoCredits2(string &in asTimer)
{
    StartCredits("01_Vicarious.ogg", false, "Ending", "MainCredits", 1);
}        
        
        
void InteractLloydsOffice(string &in asEntity)
{
    SetMessage("Message", "lloydsdoor", 0);
}


void UsedKeyOnDoor_5(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("girlsdormdoor", false);
    PlaySoundAtEntity("", "unlock_door", "girlsdormdoor", 0, false);
    RemoveItem("girlsdormkey_1");
}

void UseKeyOnDoor_6(string &in asItem, string &in asEntity)
{
    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);
}


////////////////////////////
// Run when leaving map
void OnLeave()
{
    StopMusic(1.0f, 1);
    SetGlobalVarInt("music", 0);
}
(This post was last modified: 07-15-2011 12:53 AM by Snuffalofagus.)
07-15-2011 12:44 AM
Find all posts by this user Quote this message in a reply
xtron Offline
Senior Member

Posts: 402
Joined: May 2011
Reputation: 2
Post: #30
RE: How to end custom story as a Demo?

hmm nevermind. It only works with swingdoors -.-.

[Image: 44917299.jpg]Dubstep <3
07-15-2011 01:00 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)