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
Secret Idea (dun dun DUN) + Help Needed
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#8
RE: Secret Idea (dun dun DUN) + Help Needed

Create the collide where the alState is 0, so it triggers its function on both exiting and entering the area.

In your callback, put

if(alState == 1) {
SetLocalVarInt("areacheck", 1);
SetLocalVarFloat("defaultsanity", GetPlayerSanity());
}
if(alState == -1) Set LocalVarInt("areacheck", -1);
SetLocalVarInt("damage", 0);
if(GetLocalVarInt("areacheck") == 1) {
for(int s=1;s<100;s++) AddTimer("drain"+s, 1.0, "SanityDrain");
}
if(GetLocalVarInt("areacheck") == -1) RestoreDrainedSanity();

void SanityDrain(string &in asTimer)
{
GiveSanityDamage(5, false);
AddLocalVarInt("damage", 5); //I suggest not using effects. This may turn out to be very annoying
}

void RestoreDrainedSanity()
{
SetPlayerSanity(GetPlayerSanity() + GetLocalVarFloat("defaultsanity"))
for(int s=1;s<100;s++) RemoveTimer("drain"+s);
}


I'll give this a test later; tied up at the moment. If you want the sanity to instantly be reduced to a set amount, use SetPlayerSanity() as suggested in above posts, as opposed to draining it. Drain would probably be smoother gameplay-wise. Smile Good luck!

(This post was last modified: 04-07-2011, 07:54 PM by palistov.)
04-07-2011, 07:52 PM
Find


Messages In This Thread
RE: Secret Idea (dun dun DUN) + Help Needed - by palistov - 04-07-2011, 07:52 PM



Users browsing this thread: 3 Guest(s)