The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Player dies instantly when walking into area
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#1
Player dies instantly when walking into area

So, what I've scripted is when enemy (rock worm) and player is in same area I want the player to die. Instead, when player enters one of these areas he dies immediately instead. The script I did is below. Can someone explain what I did wrong?

//The steps for the worm
void DoWormStep()
{
int lCurrentWormStep = GetLocalVarInt("WormStep");

AddLocalVarInt("WormStep", 1);
int lWormStep = GetLocalVarInt("WormStep");

CheckPlayerWormVariable();

if(lWormStep!=9){
SetLocalVarInt("WormFinished", 3);
}else if (lWormStep!=32){
SetLocalVarInt("WormFinished", 4);
}else{
SetLocalVarInt("WormFinished", 2);
}
}
//The steps for the player
void DoPlayerStep()
{
int lCurrentPlayerStep = GetLocalVarInt("PlayerStep");

CheckPlayerWormVariable();

AddLocalVarInt("PlayerStep", 1);
int lPlayerStep = GetLocalVarInt("PlayerStep");
}

//This checks if player and worm is in the same area. If so, kill the player
void CheckPlayerWormVariable()
{
string sCurrentPlayerLocation = GetLocalVarString("CurrentPlayerLocation");
string sCurrentEnemyLocation = GetLocalVarString("CurrentEnemyLocation");

if(sCurrentEnemyLocation==sCurrentPlayerLocation)
{
FadeOut(0.2f);
PlayGuiSound("worm_attack", 1.0f);

AddPlayerHealth(-200);
CheckPoint("checkpoint","PlayerStartArea_1", "ContinueAgain", "Hints", "DeathByWorm");
}

int lRoomIndex = 0;
for(int i=0; i<52; ++i)
{
if(sCurrentPlayerLocation=="AreaCheckPlayer_" + (i+1))
{
lRoomIndex = i;
break;
}
}
}
(This post was last modified: 11-18-2013, 10:04 PM by Neelke.)
11-18-2013, 09:22 PM
Find


Messages In This Thread
Player dies instantly when walking into area - by Neelke - 11-18-2013, 09:22 PM



Users browsing this thread: 1 Guest(s)