Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The if ?
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#1
The if ?

Hi
I often see an "If" in a script.
I tryed to get it but I can't. What the If is for?
When I should use it?
How to script it?


My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-06-2012, 02:46 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#2
RE: The if ?

Example:

Function when player touched the door
(mansion_2) :


void TouchDoor(string& asName)
{
if (GetSwingDoorLocked("mansion_2") == true) //checks if the door is locked
{
SetMessage("Messages", "DoorLocked", 0); // if locked --> message appears
}
else // if the door is not locked

SetMessage("Messages", "DoorOpen", 0);
}

The "If" always checks stuff

When Life No Longer Exists
Full-conversion mod
(This post was last modified: 03-06-2012, 02:59 PM by Unearthlybrutal.)
03-06-2012, 02:53 PM
Website Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#3
RE: The if ?

Ive been thinking what the if is too :/

03-06-2012, 02:54 PM
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#4
RE: The if ?

What if I want to make a monster.
Which followes path nodes but if the player looks at the monster for 3 second. The path nodes will be cleared and the monster followes the player

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-06-2012, 04:14 PM
Find
Nevicar Offline
Junior Member

Posts: 37
Threads: 4
Joined: Mar 2012
Reputation: 0
#5
RE: The if ?

This is relevant to the first question asked and is mainly directed at Unearthlybrutal concerning "if" loops.

I have this set up:


if (SetEntityActive("m1") == true)
{
SetPlayerLookSpeed(0.5f);
SetPlayerRunSpeed(0.5f);
SetPlayerMoveSpeed(0.5f);}

else

SetPlayerLookSpeed(1f);
SetPlayerRunSpeed(1f);
SetPlayerMoveSpeed(1f);
}

Would this run correctly? The only reason I'm asking instead of testing is because I don't have access to Amnesia right now.
(This post was last modified: 03-06-2012, 06:30 PM by Nevicar.)
03-06-2012, 06:27 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#6
RE: The if ?

(03-06-2012, 06:27 PM)Nevicar Wrote: This is relevant to the first question asked and is mainly directed at Unearthlybrutal concerning "if" loops.

I have this set up:


if (SetEntityActive("m1") == true)
{
SetPlayerLookSpeed(0.5f);
SetPlayerRunSpeed(0.5f);
SetPlayerMoveSpeed(0.5f);}

else

SetPlayerLookSpeed(1f);
SetPlayerRunSpeed(1f);
SetPlayerMoveSpeed(1f);
}

Would this run correctly? The only reason I'm asking instead of testing is because I don't have access to Amnesia right now.
I'm not sure about that will the "SetEntityActive" work with the "If".

But if it will, this should work:
Spoiler below!

void function(syntax)
{
if (SetEntityActive("m1") == true)
{
SetPlayerLookSpeed(0.5f);
SetPlayerRunSpeed(0.5f);
SetPlayerMoveSpeed(0.5f);}
}

else

SetPlayerLookSpeed(1f);
SetPlayerRunSpeed(1f);
SetPlayerMoveSpeed(1f);
}



When Life No Longer Exists
Full-conversion mod
03-06-2012, 07:26 PM
Website Find
Nevicar Offline
Junior Member

Posts: 37
Threads: 4
Joined: Mar 2012
Reputation: 0
#7
RE: The if ?

Thanks a lot! Will be sure to try when I get home.
03-06-2012, 07:34 PM
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#8
RE: The if ?

When I want to Clear the Path nodes if the Player looks at the monster for 3 Seconds. Should the script look like this?

if (PlayerLookAt("m1") == true)

{
AddTimer("", 3, "MonsterClear");
}
void MonsterClear(string &in asTimer)
{
if (PlayerLookAt("m1") == true)


{
ClearEnemyPatrolNodes("m1");
}




My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-07-2012, 01:46 PM
Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#9
RE: The if ?

(03-07-2012, 01:46 PM)Shives Wrote: When I want to Clear the Path nodes if the Player looks at the monster for 3 Seconds. Should the script look like this?

if (PlayerLookAt("m1") == true)

{
AddTimer("", 3, "MonsterClear");
}
void MonsterClear(string &in asTimer)
{
if (PlayerLookAt("m1") == true)


{
ClearEnemyPatrolNodes("m1");
}
No, go to the look function.



Signature to awesome to be displayed.
03-07-2012, 05:01 PM
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#10
RE: The if ?

What I've to do with the look function?

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-07-2012, 05:22 PM
Find




Users browsing this thread: 1 Guest(s)