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
[solved] LanternLit function only inside a room?
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#4
RE: [need help] LanternLit function only inside a room?

Quote:And where should I post when I need help? I've gotten my posts moved twice, but I don't know where they where moved to... And also, thanks for helping me
No worries Smile. This topic was just moved to a sub-forum of where you posted - called "Development Support" in the "Custom Stories, TCs & Mods - Development" forum. This sub-forum is pretty much for any queries about how to do something in Amnesia.

With regards to the problem with your explosion effect: It may be to do with the where the function "GetEntitiesCollide" expects the "Player" parameter. You could try the following:
//Explosion Death
void LanternLit(bool abLit)
{
   if(GetEntitiesCollide("Player","PoisonArea_1") && abLit) Explosion();
}
If that fails to work, the following will work (it's just a little harder to see what's happening in the script):
void OnStart()
{
//The following code will now trigger the even on both entering and leaving the explosive area
AddEntityCollideCallback("Player", "PoisonArea_1", "cbExplodeAreaPlayerCollision", false, 0);
//Same as before
SetLanternLitCallback("LanternLit");
}

//Explosion Death

void LanternLit(bool abLit)
{
//If we are in at least one explosive areas and the lantern is lit, explode.
if(GetLocalVarInt("ExplosionAreasCount")>0 && abLit) Explosion();
}

void cbExplodeAreaPlayerCollision(string &in asParent, string &in asChild, int alState)
{
  //If entering an explosive area, add 1 to explosive area count, else remove 1.
  AddLocalVarInt("ExplosionAreasCount",alState);
  //If entering an explosive area with the lantern out, explode.
  if(GetLanternActive() && alState == 1) Explosion();
}

void Explosion()
{
//StartScreenShake(1, 5, 0, 13);
AddPlayerBodyForce(0, 0, -50000, true);
//SetPlayerActive(false);
SetPlayerCrouching(true);
GivePlayerDamage(100.0f, "BloodSplat", true, true); //The player's maximum health is 100.
PlaySoundAtEntity("explosion", "explosion_rock_large.snt", "Player", 5, true);
PlaySoundAtEntity("explosion", "explosion_rock_large.snt", "Player", 5, true);
PlaySoundAtEntity("explosion", "explosion_rock_large.snt", "Player", 5, true);
FadeRadialBlurTo(1, 1);
StartEffectFlash(0, 1, 1);
}

11-25-2011, 09:56 PM
Find


Messages In This Thread
RE: [need help] LanternLit function only inside a room? - by Apjjm - 11-25-2011, 09:56 PM



Users browsing this thread: 3 Guest(s)