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
Brute appearing upon opening cabinet
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#1
Brute appearing upon opening cabinet

...I have another question. It looked simple at first, so I quickly wrote the script, this is what I have right now;


void monsterclosetscare(string &in door)
{
AddPropForce("closetscare", 1440, 1440, 1440, "world");
SetEntityActive("monster_servant_1337", true);
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "react_scare", "closetscare", 0, false);
ShowEnemyPlayerPosition("monster_servant_1337");
AddTimer("monsterpoof", 1.5, "monsteraway");
}

void monsteraway(string &in asTimer)
{
string r = asTimer;
if (r == "monsterpoof")
{
FadeEnemyToSmoke("monster_servant_1337", true);
}
}


So, as you can see (hopefully the picture is clear), the monster is set inactive, is in the closet and has the name monster_servant_1337. The cabinet is called closetscare and has monsterclosetscare at PlayerInteractCallback. However, when I touch the cabinet the monster just appears and then fades to smoke instantly, and I can do it as much as I want (spam-clicking the door of the cabinet). However, I reloaded my map and it worked. Then on my second reload it gets bugged again.

[Image: PxrgN.jpg]
And no, I don't want to change the monster to a hallucination, because it will start out very close to the player and thus fade away instantly, I want it to be alive for about two seconds, so that the player actually has to run away. AND I have PlayerInteractCallbackAutoRemove checked on the cabinet.
Any help would be appreciated. I myself think it has something to do with void monsterclosetscare(string &in door), because I don't know what to put between the brackets.
(This post was last modified: 07-02-2012, 06:37 PM by ApeCake.)
06-30-2012, 12:38 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Brute appearing upon opening cabinet

(06-30-2012, 12:38 PM)ApeCake Wrote: void monsteraway(string &in asTimer)
{
string r = asTimer;
if (r == "monsterpoof")
{
FadeEnemyToSmoke("monster_servant_1337", true);
}
}
this could be rewritten a bit smarter by using the syntax like this:

void monsteraway(string &in asTimer)
{
if(asTimer == "monsterpoof")
{
FadeEnemyToSmoke("monster_servant_1337", true);
}
}

Now to your problem

AddTimer("monsterpoof", 1.5f, "monsteraway");

and also the function you use to call Monsterclosetscare is PlayerInteract?
the syntax should be (string &in asEntity)

but I think the problem with using PlayerInteract on the closet is that it will not be removed and will be triggered several times which makes
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

a better choice

06-30-2012, 01:07 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#3
RE: Brute appearing upon opening cabinet

I tested this out and it works, just a few things to make it like it should:
1. the syntax at monsterclosetscare, it doesn't really matter if it's named door or asEntity.
2. Increase the timer "monsterpoof" to a higher number. At least 4 if you want a small chase.
3. Add Pathnodes. Or the enemy will just attack the cabinet. Place the first one right outside the cabinet, then a few more outside(depends on how long the chase is). Add them to the enemy in the script after you've set him active(or, to be sure it works, below the PlaySoundAtEntity command).

It doesn't matter if it's called asEntity or door, as I tested both and it works. It alsom doesn't really matter if it's a float number or double number. I use doubles only. But you're right with using a callback itself, not the one from the cabinet, as it will repeat all the time.

Oh, I've jsut read that you checked the AutoRemove part. Then that problem with it repeating is no longer.
(This post was last modified: 06-30-2012, 01:12 PM by Cruzore.)
06-30-2012, 01:07 PM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#4
RE: Brute appearing upon opening cabinet

I think it works now. Thanks. But I've always been wondering one thing... what does the f stands for/do after a number?
06-30-2012, 02:27 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#5
RE: Brute appearing upon opening cabinet

(06-30-2012, 02:27 PM)ApeCake Wrote: I think it works now. Thanks. But I've always been wondering one thing... what does the f stands for/do after a number?
Float. More specifically, a decimal value; it doesn't have to be a decimal though (i.e. 2.85f can be a float, but so can 3f). Integers (or "int") are whole numbers (i.e. 1, 2, 3, 4, 5). Integers can be floats, but floats (decimals) can't be integers.

I rate it 3 memes.
06-30-2012, 02:30 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Brute appearing upon opening cabinet

(06-30-2012, 02:30 PM)andyrockin123 Wrote: Integers can be floats, but floats (decimals) can't be integers.

More precisely: Integers can be converted (whether implicitly or explicitly) into floats, and floats can be converted into integers. But converting floats into integers may cause you to lose data.

Tutorials: From Noob to Pro
(This post was last modified: 06-30-2012, 03:31 PM by Your Computer.)
06-30-2012, 03:30 PM
Website Find




Users browsing this thread: 1 Guest(s)