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

Privacy Policy


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make things happen when you return hub after picking up item?
Author Message
HumiliatioN Offline
Posting Freak

Posts: 984
Joined: Dec 2010
Reputation: 10
Post: #1
How to make things happen when you return hub after picking up item?
Okay my big problem my custom story trying to fix it. I have already project released but noticed this when final testing my map.

Basicly this is have to happen.

I have Item to pick that up in "Dark Storage" but when I came back from "Dark Storage" to the hub "Areas triggers many slimes, and atmosphere changes. but when I came back this not happens. Now where is the problem? This is my script:

Last area trigger when I pick up that item and go back:

void Leaving_events(string &in entity)
{
PlaySoundAtEntity("", "guardian_activated", "Player", 0, false);
SetPlayerActive(false);
SetEntityActive("Falling_grunt", true);
SetEntityActive("Falling_grunt_2", true);
StartEffectFlash(0.2f, 1.0f, 1.0f);
SetLampLit("hanging_lantern_ceiling_1", true, true);
SetLampLit("hanging_lantern_ceiling_2", true, true);
SetPropActiveAndFade("slime_egg_1", true, 1.5);
SetPropActiveAndFade("slime_egg_2", true, 1.5);
SetPropActiveAndFade("slime_pile_large_1", true, 1.5);
SetPropActiveAndFade("slime_pile_large_2", true, 1.5);
SetPropActiveAndFade("slime_pile_large_3", true, 1.5);
SetPropActiveAndFade("slime_pile_1", true, 1.5);
SetPropActiveAndFade("slime_pile_2", true, 1.5);
SetPropActiveAndFade("slime_pile_3", true, 1.5);
SetPropActiveAndFade("slime_6way_1", true, 1.5);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_egg_1", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_egg_2", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_pile_large_1", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_pile_large_2", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_pile_large_3", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_pile_1", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_pile_2", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_pile_3", false);
CreateParticleSystemAtEntity("", "ps_guardian_appear_explosion", "slime_6way_1", false);
SetEntityActive("corpse_pile2_2", true);
SetEntityActive("corpse_pile2_3", true);
SetEntityActive("corpse_pile2_4", true);
SetEntityActive("corpse_pile2_5", true);
SetEntityActive("corpse_pile2_6", true);
SetEntityActive("corpse_pile2_7", true);
SetEntityActive("corpse_pile2_8", true);
SetEntityActive("corpse_pile2_9", true);
SetEntityActive("hanging_prisoner_1", true);
StartPlayerLookAt("hanging_prisoner_1", 15.5f, 15.5f, "");
AddTimer("Stopstare", 3, "Stoplook_corpse");
}

void Stoplook_corpse(string &in asTimer)
{
SetEntityActive("hanging_prisoner_1", false);
SetPlayerActive(true);
StopPlayerLookAt();
}

Map where "Strange things have to happen" :

{
AddEntityCollideCallback("Player", "Slimespawn", "noback", true, 1);
AddEntityCollideCallback("Player", "Slimespawn2", "noback2", true, 1);
}

void noback(string &in asParent, string &in asChild, int alState)
{
if(HasItem("Underground Tunnel Key"))
{
PlayMusic("14_elevator_falls", true, 3, 3, 10, true);
StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
RemoveEntityCollideCallback("Player", "Slimespawn");
SetEntityActive("SlimeDamageArea_1", true);
SetEntityActive("slime_6way_1", true);
StartScreenShake(0.1, 3, 0.3, 2);
PlaySoundAtEntity("", "04_scream.snt", "Player", 0, false);
}
}

void noback2(string &in asParent, string &in asChild, int alState)
{
if(HasItem("Underground Tunnel Key"))
{
StartEffectFlash(0.2f, 1.0f, 1.0f);
StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
PlaySoundAtEntity("", "guardian_ontop.snt", "slime_6way_3", 0, false);
RemoveEntityCollideCallback("Player", "Slimespawn");
SetPropActiveAndFade("slime_pile_large_1", true, 1.5);
SetPropActiveAndFade("slime_anim_wall_1", true, 1.5);
SetPropActiveAndFade("slime_anim_wall_2", true, 1.5);
SetPropActiveAndFade("slime_pile_large_2", true, 1.5);
SetPropActiveAndFade("slime_pile_large_3", true, 1.5);
SetPropActiveAndFade("slime_6way_3", true, 1.5);
SetPropActiveAndFade("slime_6way_4", true, 1.5);
SetEntityActive("fountain_childsnake_blood_1", true);
SetEntityActive("fountain_childsnake_blood_2", false);
SetEntityActive("slime_6way_3", true);
SetEntityActive("slime_6way_4", true);
SetEntityActive("slime_pile_large_1", true);
SetEntityActive("slime_pile_large_2", true);
SetEntityActive("slime_pile_large_3", true);
SetEntityActive("slime_anim_wall_1", true);
SetEntityActive("slime_anim_wall_2", true);
StartScreenShake(0.1, 3, 0.3, 2);

}
}

These scripts are not activating why? What I am doing wrong ?

Help is quickly appreciated. Thanks.

Investigator - WIP
(This post was last modified: 08-09-2011 01:33 PM by HumiliatioN.)
08-09-2011 01:32 PM
Find all posts by this user Quote this message in a reply
Phoroneus Offline
Member

Posts: 141
Joined: Feb 2011
Reputation: 0
Post: #2
RE: How to make things happen when you return hub after picking up item?
I'd say the easiest way to do this would be to create a second, identical "hub" map. Once you pick up the item from DarkStorage, the leveldoor in DarkStorage leading back to the hub could be set to inactive and a duplicate in the same location could be set to active, sending you to "hub2" or somesuch instead of the original hub. This way you could constrain the player's ability to leave hub2 as well, or allow them to freely go to any of the other maps to escape (assuming that's what you want them to do).

Alternately, you can run an OnEnter function in the hub map's .hps that checks whether you have whatever item is in your inventory and triggers the events, though in order to make the changes permanent (i.e. they don't happen every time you come back to the hub, but their effects remain) I might still go with an alternate map.

[Image: at_9365860.png]

Follow Harvest.
08-09-2011 08:15 PM
Find all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #3
RE: How to make things happen when you return hub after picking up item?
Actually, nice one Phoroneus, but you simply can use a global variable.

08-09-2011 08:32 PM
Find all posts by this user Quote this message in a reply
Phoroneus Offline
Member

Posts: 141
Joined: Feb 2011
Reputation: 0
Post: #4
RE: How to make things happen when you return hub after picking up item?
http://i641.photobucket.com/albums/uu131...cepalm.jpg

[Image: at_9365860.png]

Follow Harvest.
08-09-2011 09:07 PM
Find all posts by this user Quote this message in a reply
HumiliatioN Offline
Posting Freak

Posts: 984
Joined: Dec 2010
Reputation: 10
Post: #5
RE: How to make things happen when you return hub after picking up item?
Okay nice option but how to use that Global variable can you tell me example? To take with work Kyle?

EDIT: Nothing anymore I fixed it and solved the reason. But you can tell me more about Global Variables how they work Smile

Investigator - WIP
(This post was last modified: 08-10-2011 06:18 PM by HumiliatioN.)
08-10-2011 05:10 PM
Find all posts by this user Quote this message in a reply
Post Reply 




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