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


Messages In This Thread
Scenario - by assassinhawk45 - 02-03-2013, 05:36 PM
RE: Scenario - by GoranGaming - 02-03-2013, 06:42 PM
RE: Scenario - by nivramm - 02-03-2013, 06:44 PM
RE: Scenario - by Tiger - 02-03-2013, 07:29 PM
RE: Scenario - by assassinhawk45 - 02-04-2013, 12:35 AM
RE: Scenario - by GoranGaming - 02-04-2013, 07:17 AM
RE: Scenario - by FlawlessHappiness - 02-04-2013, 08:05 AM



Users browsing this thread: 1 Guest(s)