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 If statements and entities
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#1
If statements and entities

Is it possible to use entities or area in if statements?
If it is, i would happy isf you could tell me how to do it.


This is what i've tried

void OnStart
{
SetEntityPlayerInteractCallback("potion_oil_1", "MonsterActivation", true);
}

void MonsterActivation(string &in asEntity)
{
if (("MonsterArea_1") == false)
{
SetEntityActive("MonsterArea_1", true);
}
else
{
PlaySoundAtEntity("", "grunt/enabled", "prison_2", 0, false);
PlaySoundAtEntity("", "scare_slam_door", "prison_2", 0, false);
}
}

Thanks in advance

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 08-10-2012, 04:08 PM by Lizard.)
08-10-2012, 04:07 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: If statements and entities

Well, you can use GetEntityExists, but this won't test if the entity is active or not. As for your MonsterActivation function, have you thought about comparing against the parameter asEntity?

Tutorials: From Noob to Pro
08-10-2012, 04:23 PM
Website Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#3
RE: If statements and entities

Thanks for telling me about "GetEntityExists"
Now i got it working with doing this

void OnStart
{
SetEntityPlayerInteractCallback("potion_oil_1", "MonsterActivation", true);
}

void MonsterActivation(string &in asEntity)
{
if (GetEntityExists("MonsterArea_1"))
{
SetEntityActive("MonsterArea_1", true);
}
}


Just a quick question. is it possible to use a doors openamount in an if statement or in a script at all?

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 08-10-2012, 04:41 PM by Lizard.)
08-10-2012, 04:36 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: If statements and entities

Do you plan on using that same MonsterActivation function for several maps? 'Cause that's the only reason i can think of to write it like that.

As for your "quick question", mess around with GetSwingDoorState.

Tutorials: From Noob to Pro
08-10-2012, 04:45 PM
Website Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#5
RE: If statements and entities

(08-10-2012, 04:45 PM)Your Computer Wrote: 1. Do you plan on using that same MonsterActivation function for several maps? 'Cause that's the only reason i can think of to write it like that.

2. As for your "quick question", mess around with GetSwingDoorState.

1. Im using the same area for different things on different times and places in the same map

2. Thanks man

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 08-10-2012, 04:50 PM by Lizard.)
08-10-2012, 04:48 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: If statements and entities

(08-10-2012, 04:48 PM)ZereboO Wrote: 1. Im using the same area for different things on differents times and places in the same map

But do you realize that GetEntityExists is going to always return true if the entity is in the map?

Tutorials: From Noob to Pro
(This post was last modified: 08-10-2012, 04:51 PM by Your Computer.)
08-10-2012, 04:51 PM
Website Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#7
RE: If statements and entities

i set it so that it will only check if the area exist, when the player picks up a specific oil potion

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 08-10-2012, 04:55 PM by Lizard.)
08-10-2012, 04:54 PM
Find




Users browsing this thread: 1 Guest(s)