08-15-2014, 07:36 AM
I have an area of my map where poisonous gasses fill the room and kill you if you mess up the puzzle and become trapped. The problem is that the Slime Damage does not seem to be able to kill the player. It just keeps creating more and more damage as time progresses. Is there a script to cause the Slime Damage area type to kill the player?
An alternative method for using the Slime Area I think may work is using a Script Area and coding it so that when the player enters, they take damage. I have a very basic knowledge of scripting though, so I am at a loss and my script does not work (posting the .hps below).
I also tried copying the Slime Damage script directly from the game.cfg file, but that didn't work so I gave up there. If there is some sort of damage or kill area script out there I don't know about, please let me know as well!
Scripts:
Ah! Just remembered that The Cistern Entrance level does have a poisonous gas area with the following script. Going to try and implement it into my map using the same techniques and maybe this can turn into a tutorial :p
So simply copypasta didn't work with that script. Viewed the Cistern map and copied the PoisonStart area and Stop area and plopped them in the spot on my map and they did not work with the script. The map loads, but when the player enters the areas, nothing happens.
An alternative method for using the Slime Area I think may work is using a Script Area and coding it so that when the player enters, they take damage. I have a very basic knowledge of scripting though, so I am at a loss and my script does not work (posting the .hps below).
I also tried copying the Slime Damage script directly from the game.cfg file, but that didn't work so I gave up there. If there is some sort of damage or kill area script out there I don't know about, please let me know as well!
Scripts:
Spoiler below!
Level Script
void OnStart()
{
{
AddEntityCollideCallback("Player", "checkpoint_00", "Restart", true, 1);
}
{
AddEntityCollideCallback("Player", "damage_zone01", "GivePlayerDamage", true, 1);
}
}
void Restart(string &in asParent, string &in asChild, int alState)
{
CheckPoint("FirstCheckpoint", "respawn_001", "Happening", "DeathCategory", "Deathtext");
}
void Happening(string &in asName, int alCount)
{
//
}
void move_top_down(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("top_door", 1.0f);
}
}
GivePlayerDamage("25", "", 0.02, true);
void OnStart()
{
{
AddEntityCollideCallback("Player", "checkpoint_00", "Restart", true, 1);
}
{
AddEntityCollideCallback("Player", "damage_zone01", "GivePlayerDamage", true, 1);
}
}
void Restart(string &in asParent, string &in asChild, int alState)
{
CheckPoint("FirstCheckpoint", "respawn_001", "Happening", "DeathCategory", "Deathtext");
}
void Happening(string &in asName, int alCount)
{
//
}
void move_top_down(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("top_door", 1.0f);
}
}
GivePlayerDamage("25", "", 0.02, true);
Spoiler below!
game.cfg Script
<Slime
SlimeType0_AttackSound = "slime_attack_normal_hit.snt"
SlimeType0_AttackPS = "ps_slime_attack_normal.ps"
SlimeType0_MinAttackDamage = "5"
SlimeType0_MaxAttackDamage = "8"
SlimeType0_ScreenShakeAmount = "0.03"
/>
<Slime
SlimeType0_AttackSound = "slime_attack_normal_hit.snt"
SlimeType0_AttackPS = "ps_slime_attack_normal.ps"
SlimeType0_MinAttackDamage = "5"
SlimeType0_MaxAttackDamage = "8"
SlimeType0_ScreenShakeAmount = "0.03"
/>
Ah! Just remembered that The Cistern Entrance level does have a poisonous gas area with the following script. Going to try and implement it into my map using the same techniques and maybe this can turn into a tutorial :p
Spoiler below!
void CollidePoison_Start(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("InPosion")==1) return;
SetLocalVarInt("InPosion", 1);
FadeImageTrailTo(0.7, 1);
AddTimer("PoisonCough",0.5, "TimerPoisonCough");
}
void CollidePoison_Stop(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("InPosion")==0) return;
SetLocalVarInt("InPosion", 0);
StopPoisonEffects();
}
void StopPoisonEffects()
{
FadePlayerFOVMulTo( 1, 1);
FadePlayerAspectMulTo( 1, 1);
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0.0f, 0.5f);
RemoveTimer("PoisonCough");
}
//----------------------------
void TimerPoisonCough(string &asTimer)
{
PlaySoundAtEntity("cough","player_cough", "Player", 0, false);
GivePlayerDamage(0.5, "BloodSplash", false, false);
if(GetLocalVarInt("PosionOn") == 0){
FadeRadialBlurTo(0.3f, 2.0f);
SetRadialBlurStartDist(0.6f);
SetLocalVarInt("PosionOn", 1);
}else{
FadeRadialBlurTo(0.2f, 2.0f);
SetRadialBlurStartDist(0.8f);
SetLocalVarInt("PosionOn", 0);
}
AddTimer("PoisonCough",RandFloat(1.5, 3.5), "TimerPoisonCough");
}
{
if(GetLocalVarInt("InPosion")==1) return;
SetLocalVarInt("InPosion", 1);
FadeImageTrailTo(0.7, 1);
AddTimer("PoisonCough",0.5, "TimerPoisonCough");
}
void CollidePoison_Stop(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("InPosion")==0) return;
SetLocalVarInt("InPosion", 0);
StopPoisonEffects();
}
void StopPoisonEffects()
{
FadePlayerFOVMulTo( 1, 1);
FadePlayerAspectMulTo( 1, 1);
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0.0f, 0.5f);
RemoveTimer("PoisonCough");
}
//----------------------------
void TimerPoisonCough(string &asTimer)
{
PlaySoundAtEntity("cough","player_cough", "Player", 0, false);
GivePlayerDamage(0.5, "BloodSplash", false, false);
if(GetLocalVarInt("PosionOn") == 0){
FadeRadialBlurTo(0.3f, 2.0f);
SetRadialBlurStartDist(0.6f);
SetLocalVarInt("PosionOn", 1);
}else{
FadeRadialBlurTo(0.2f, 2.0f);
SetRadialBlurStartDist(0.8f);
SetLocalVarInt("PosionOn", 0);
}
AddTimer("PoisonCough",RandFloat(1.5, 3.5), "TimerPoisonCough");
}
So simply copypasta didn't work with that script. Viewed the Cistern map and copied the PoisonStart area and Stop area and plopped them in the spot on my map and they did not work with the script. The map loads, but when the player enters the areas, nothing happens.