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
Script Help Scenario
assassinhawk45 Offline
Junior Member

Posts: 31
Threads: 11
Joined: Dec 2012
Reputation: 0
#1
Question  Scenario

I am wondering how to have a monster pop up, and then the player runs away into another script area that makes the bridge break (set inactive) and then fade the vision to black, then teleport the player to another map, and lastly fade the vision back in. Is this too much to ask? I'm just curious and would appreciate any help.

The Necromancer's Touch: WIP Coming March 2013
02-03-2013, 05:36 PM
Find
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#2
RE: Scenario

Do you know how to script?

void OnStart()
{
    AddEntityCollideCallback("Player", "EnableMonster", "EnableMonster", true, 0);//Activate the Monster when colliding with an area
    AddEntityCollideCallback("Player", "CollideRun", "CollideRun", true, 0);//The bridge breaks when colliding
}

void EnableMonster(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_1", true);
    SetLocalVarInt("MonsterActive", 1);
}


void CollideRun(string &in asParent, string &in asChild, int alState)
{
    if(GetLocalVarInt("MonsterActive")==1)
    {
SetPropHealth("Bridge", 0);
AddTimer("Fade", 1, "Falling");
AddTimer("ChangeMap", 2, "Falling");

    }
    else
    {
//Do nothing
    }
}

void Falling(string &in asTimer)
{
    if(asTimer==("Fade"))
    {
FadeOut(1);
    }
    else if(asTimer==("ChangeMap"))

    {
ChangeMap("MapName", "StartPosition", "", "");
    }
}
Let me know if there's any errors.

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
(This post was last modified: 02-03-2013, 07:51 PM by GoranGaming.)
02-03-2013, 06:42 PM
Website Find
nivramm Offline
Junior Member

Posts: 18
Threads: 1
Joined: Jan 2013
Reputation: 0
#3
RE: Scenario

Quote:I am wondering how to have a monster pop up,

Monster popup needs to be triggered, for example by a script area.

Add in OnEnter of your .hps following:

AddEntityCollideCallback("Script_area_x", "Player", "function_monster", true, 1);
[if "Player" enters (definded by the 1, -1 would be leaves and 0 would be both) the "script_Area_x", the function "function_monster" gets called and the CollideCallback gets removed(defined by "true")]

and then somewhere else in the script the following:
function_monster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("monster_name", true);
}

script_Area_x is the area, which activates the Monster when the player enters.
monster name is the name of the monster which should be activated…take care of deactivating the monster in the level editor.

Quote: and then the player runs away into another script area that makes the bridge break (set inactive) and then fade the vision to black,
then teleport the player to another map, and lastly fade the vision back in. Is this too much to ask? I'm just curious and would appreciate any help.

Add another entity collide callback with the area the player runs into and replace the function_monster with another name, here function_name.
Then add, again OUTISDE OnEnter oder OnStart (and OnLeave), these functions:

void function_name(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("bridge_name", 0);
FadeOut(15);
AddTimer("", 15, "teleport");
}

void teleport(string &in asParent, string &in asChild, int alState)
{
ChangeMap("map_name.map", "start_player_1", "", "");
}
bridge_name is for sure the name of the bridge which should break(the 0 sets the bridge to a health of 0=dead)
15 is the time until screen is completely black in seconds in the FadeOut-function, and the time till teleportfunction gets called in the timer.
at changemap is map_name.map the name of the map you want to load and start_player_1 the startarea in the map where the player should spawn.
Within the last two "" you could define a sound which is played when the function gets called (in the first "") or when the new map is loaded (in the second "").

Take a look at the wiki.frictionalgames.com page…there is everything.
I'm quiet sure that it works this way, maybe some spelling errors. Or i'm wrong, no warranty^^ For example the content of the brackets behind void teleport and void function_name is just guessed, not sure.
I'm actually scripting beginner, but i thought i would know the right answer so i wrote^^

Edit: Didn't see the answer above me, but it looks more professional (but also more complicated) than mine. Wanted to delete my post, but doesn't work-.-
(This post was last modified: 02-03-2013, 06:49 PM by nivramm.)
02-03-2013, 06:44 PM
Find
Tiger Away
Posting Freak

Posts: 1,874
Threads: 16
Joined: Nov 2012
Reputation: 55
#4
RE: Scenario

I don't wanna discourage you from making a custom story, but please learn the basics before directly just asking for help. You're not going to be able to make a custom story just by the help from others. Use Google, Youtube, FG's wiki and Engine scripts to learn how to make a custom story. Start from the basics and work your way up.
(This post was last modified: 02-03-2013, 07:29 PM by Tiger.)
02-03-2013, 07:29 PM
Find
assassinhawk45 Offline
Junior Member

Posts: 31
Threads: 11
Joined: Dec 2012
Reputation: 0
#5
RE: Scenario

(02-03-2013, 07:29 PM)Tigerwaw Wrote: I don't wanna discourage you from making a custom story, but please learn the basics before directly just asking for help. You're not going to be able to make a custom story just by the help from others. Use Google, Youtube, FG's wiki and Engine scripts to learn how to make a custom story. Start from the basics and work your way up.

I have been scripting, but there are some scripts that I couldn't find. I am just wondering how to change maps and if there is a way to set script areas active.

The Necromancer's Touch: WIP Coming March 2013
02-04-2013, 12:35 AM
Find
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#6
RE: Scenario

ChangeMap("Mapname", "StartArea", "StartSound", "StopSound");
SetEntityActive("EntityOrArea", false);
true for setting it active and false reverse

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
02-04-2013, 07:17 AM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
RE: Scenario

Just use the engine scripts http://wiki.frictionalgames.com/hpl2/amn..._functions,


and Ctrl+F or Cmd+F.

You'll be able to find nearly everything if you use "Scripting-words".

Entity, active, fade, prop, stuck, state, get,

Trying is the first step to success.
02-04-2013, 08:05 AM
Find




Users browsing this thread: 1 Guest(s)