The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Scripting with if-clauses
lemonpotatoe Offline
Junior Member

Posts: 8
Threads: 2
Joined: Jul 2011
Reputation: 0
#1
Scripting with if-clauses

Hey everyone,

I'm completely new to scripting, which makes me a total noob.

However, currently I'm stuck on a idea and I hope you can help me out.

Here's what I wanna do:

The player enters a room in which he can find the lantern. Once he has picked up the lantern and comes near the door, he walks into a script area which makes the door slam closed.

The lantern item is called "lantern", the area is called "lanternarea", the door is called "lanternarea_door".

Here's what I worked out so far:

void OnEnter()
{
AddEntityCollideCallback("Player", "lanternarea", "func_lanternarea", true, 1);
}

void func_lanternarea(string &in asParent, string &in asChild, int alState)
{
if(HasItem("lantern")==true)
{
SetSwingDoorClosed("lanternarea_door", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
}
The map starts without any error messages, but when I walk into the area nothing happens.
Where exactly did I go wrong?

I hope someone can help me out. Smile

Cheers
07-18-2011, 02:50 AM
Find


Messages In This Thread
Scripting with if-clauses - by lemonpotatoe - 07-18-2011, 02:50 AM
RE: Scripting with if-clauses - by Tanshaydar - 07-18-2011, 03:01 AM
RE: Scripting with if-clauses - by lemonpotatoe - 07-18-2011, 03:29 AM
RE: Scripting with if-clauses - by ThePaSch - 07-18-2011, 06:41 AM
RE: Scripting with if-clauses - by Tanshaydar - 07-18-2011, 04:20 AM
RE: Scripting with if-clauses - by lemonpotatoe - 07-18-2011, 09:42 AM
RE: Scripting with if-clauses - by Tanshaydar - 07-18-2011, 09:49 AM
RE: Scripting with if-clauses - by lemonpotatoe - 07-18-2011, 09:58 AM
RE: Scripting with if-clauses - by Tanshaydar - 07-18-2011, 10:20 AM
RE: Scripting with if-clauses - by lemonpotatoe - 07-18-2011, 10:24 AM
RE: Scripting with if-clauses - by lemonpotatoe - 07-19-2011, 12:43 PM
RE: Scripting with if-clauses - by Kyle - 07-19-2011, 12:57 PM



Users browsing this thread: 1 Guest(s)