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
WHAT IS WRONG?!!!!!!!!!!!!!
ProyectV Offline
Junior Member

Posts: 19
Threads: 6
Joined: Apr 2014
Reputation: 0
#1
WHAT IS WRONG?!!!!!!!!!!!!!

Okay, my problem: the map dosen't change the level. My script:

Spoiler below!
void OnStart()
{

}

void OnEnter()
{
AddEntityCollideCallback("enemy_suitor_alois_1","ScriptArea_1", "DestroyDoor", true, 1);
AddEntityCollideCallback("enemy_suitor_alois_1","ScriptArea_2", "ChasePatch", true, 1);
AddEntityCollideCallback("enemy_suitor_alois_1","ScriptArea_3", "DestroyDoor2", true, 1);
AddEntityCollideCallback("Player","ScriptArea_4", "Scare1", true, 1);
AddEntityCollideCallback("prison_2", "ScriptArea_5","ScareCell", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_7","ScareCell2", true, 1);
AddEntityCollideCallback("enemy_suitor_alois_1","PathNodeArea_1", "ErasePatrol", true, 1);
AddLocalVarInt("EventScare1", 0);
AddTimer("", 48.0f, "UnlockCell");
PlayMusic("23_amb02.ogg", true, 0.6f, 4.0f, 0, true);
Again(0.0f);
}

void Again(float eSpeed1)
{
if(GetPlayerHealth() > 0)
{
return;
}

AddTimer("", eSpeed1, "ChangeLevel");
GivePlayerDamage(110, "Claws", true, true);
StartScreenShake(0.01f, 0.5f, 0.5f, 1.0f);
PlayGuiSound("attack_claw.snt", 0.7f);
SetGlobalVarInt("DejaVu", 1);
}

void ChangeLevel(string &in asTimer)
{
ChangeMap("Cuartos Esclavos.map", "PlayerStartArea_1", "22_end.snt", "");
}


void Again(string &in asName)
{
if(GetGlobalVarInt("DejaVu")== 1)
{
SetMessage("", "", 0.0f);
}
}

void UnlockCell(string &in asTimer)
{
SetSwingDoorLocked("prison_1", false, true);
}

void Puzzle1(string &in asEntity, int alState)
{
if(GetLeverState("lever01")== 1
&& GetLeverState("lever02")== -1
&& GetLeverState("lever04")== -1
&& GetLeverState("lever05")== 1
&& GetLeverState("lever06")== 1
&& GetPlayerSanity() >50)
{
SetLeverStuckState("lever01", 1, true);
SetLeverStuckState("lever02", -1, true);
SetLeverStuckState("lever04", -1, true);
SetLeverStuckState("lever05", 1, true);
SetLeverStuckState("lever06", 1, true);

SetLocalVarInt("EventScare1", 1);
SetEntityActive("ScriptArea_4", true);
SetLevelDoorLocked("cellar_wood01_slow_2", false);
PlayMusic("02_puzzle.ogg", false, 1.5f, 2.0f, 0, false);
GiveSanityBoost();
}

else if(GetLeverState("lever01")== 1
&& GetLeverState("lever02")== -1
&& GetLeverState("lever04")== -1
&& GetLeverState("lever05")== 1
&& GetLeverState("lever06")== 1
&& GetPlayerSanity() <50)
{
SetLeverStuckState("lever01", 1, true);
SetLeverStuckState("lever02", -1, true);
SetLeverStuckState("lever04", -1, true);
SetLeverStuckState("lever05", 1, true);
SetLeverStuckState("lever06", 1, true);

SetLevelDoorLocked("cellar_wood01_slow_2", false);
SetEntityActive("enemy_suitor_alois_1", true);
AddTimer("", 1.0f, "Pursuit");
PlayMusic("att_suitor.ogg", true, 3.0f, 0.0f, 1, false);
}
}

void Pursuit(string &in asTimer)
{
ShowEnemyPlayerPosition("enemy_suitor_alois_1");
AddTimer("", 1.0f, "Pursuit");
}

void DestroyDoor(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("EventScare1")== 0)
{
SetPropHealth("cellar_wood01_slow_4",0.0f);
PlaySoundAtEntity("", "break_wood.snt", "ScriptArea_1", 0, false);
}
}

void ChasePatch(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy_suitor_alois_1", false);
SetEntityActive("enemy_suitor_alois_2", true);
ShowEnemyPlayerPosition("enemy_suitor_alois_2");
}

void DestroyDoor2(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("EventScare1")== 0)
{
SetPropHealth("cellar_wood01_slow_3",0.0f);
PlaySoundAtEntity("", "break_wood.snt", "ScriptArea_1", 0, false);
}
}

void Scare1(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("EventScare1")== 1)
{
CreateParticleSystemAtEntity("","ps_dust_whirl","ScriptArea_9", false);
PlaySoundAtEntity("", "general_wind_whirl", "ScriptArea_9", 5.0f, false);
PlaySoundAtEntity("", "scare_loon_single", "ScriptArea_9", 1.0f, false);

PlayMusic("20_event_darkness", false, 0.8f, 2.0f, 10, true);
PlayMusic("12_amb", true, 0.6f, 2.0f, 0, true);

AddTimer("", 1.0f, "LightsOut");

}
}

void LightsOut(string &in asTimer)
{
PlaySoundAtEntity("", "general_wind_whirl", "ScriptArea_4", 5.0f, false);

SetLampLit("torch_static01_7", false, true);
SetLampLit("torch_static01_5", false, true);
SetLampLit("torch_static01_6", false, true);
SetLampLit("torch_static01_4", false, true);
SetLampLit("torch_static01_9", false, true);
SetLampLit("torch_static01_8", false, true);
SetLampLit("candle_floor_small_2", false, true);
SetLampLit("candle_floor_small_1", false, true);
SetLampLit("candle_floor_small_7", false, true);
SetLampLit("candle_floor_small_5", false, true);
SetEntityActive("enemy_suitor_alois_1", true);
AddEnemyPatrolNode("enemy_suitor_alois_1", "PathNodeArea_1", RandFloat(5.0f, 10.0f), "");
AddEnemyPatrolNode("enemy_suitor_alois_1", "PathNodeArea_29", RandFloat(5.0f, 10.0f), "");
AddEnemyPatrolNode("enemy_suitor_alois_1", "PathNodeArea_9", RandFloat(5.0f, 10.0f), "");
AddEnemyPatrolNode("enemy_suitor_alois_1", "PathNodeArea_8", RandFloat(5.0f, 10.0f), "");
GiveSanityDamage(20.0f, true);
}

void ErasePatrol(string &in asParent, string &in asChild, int alState)
{
ClearEnemyPatrolNodes("enemy_suitor_alois_1");
}

void ScareCell(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("ScriptArea_6", 10.0f, 10.0f, "");
FadeSepiaColorTo(0.0f, 2.0f);
FadeRadialBlurTo(0.0f, 2.0f);
GiveSanityDamage(20.0f, true);
PlaySoundAtEntity("", "ui_insanity_touch.snt", "ScriptArea_4", 0, false);
PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
AddTimer("", 2.0f, "StopLook");
}

void ScareCell2(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("ScriptArea_8", 1.0f, 3.0f, "");
GiveSanityDamage(20.0f, true);
PlaySoundAtEntity("", "general_wind_whirl.snt", "ScriptArea_8", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_whirl.ps", "ScriptArea_8", false);
PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
SetLampLit("torch_static01_3", false, true);
AddTimer("", 2.0f, "StopLook2");
}

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}

void StopLook2(string &in asTimer)
{
StopPlayerLookAt();
}

void OnLeave()
{
StopSound("att_suitor.ogg", 0.0f);
}
(This post was last modified: 06-06-2014, 02:32 AM by ProyectV.)
06-06-2014, 02:31 AM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#2
RE: WHAT IS WRONG?!!!!!!!!!!!!!

Add a debug message to see if the function is working.

06-06-2014, 03:59 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: WHAT IS WRONG?!!!!!!!!!!!!!

You seem to have two Again voids. Change one of them and adjust your code to reflect that.

I also believe you're not expressing your code somehow on what eSpeed1 is, therefore while it is being passed into the void, you don't have a time set for the timer to occur. Is there a reason why you cannot simply just add a collide function or generate a random float and set that to be eSpeed1?

Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-06-2014, 07:15 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: WHAT IS WRONG?!!!!!!!!!!!!!

(06-06-2014, 07:15 AM)Romulator Wrote: I also believe you're not expressing your code somehow on what eSpeed1 is, therefore while it is being passed into the void, you don't have a time set for the timer to occur. Is there a reason why you cannot simply just add a collide function or generate a random float and set that to be eSpeed1?

You could just define what eSpeed1 is in the OnStart OnEnter, or just you know, use regular syntax.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 06-06-2014, 08:41 AM by PutraenusAlivius.)
06-06-2014, 08:41 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: WHAT IS WRONG?!!!!!!!!!!!!!

If I read it correctly, this is what happens:

When you enter this level, it immediately calls Again(0.0f);

This function checks the health of the player, and if the player has more than 0, it cancels out the rest of the script. This could be the problem.

If the player is dead when he enters this level (I don't see how that's possible), the rest is ran. There's a lot of dead code right here, because since you input 0.0f in the Again parameter, the timer for changing the level is also 0.0f (instantly). The sound and screen shake never get time to do anything. If the script gets this far, the player is also dealt 110 damage (if the player is dead, why must you torture him so? ;_;). A variable is ticked and the map is changed right away.

It's a very strange series of events you have here. I'm not sure what you intended with it.

(This post was last modified: 06-06-2014, 01:12 PM by Mudbill.)
06-06-2014, 01:11 PM
Find
ProyectV Offline
Junior Member

Posts: 19
Threads: 6
Joined: Apr 2014
Reputation: 0
#6
RE: WHAT IS WRONG?!!!!!!!!!!!!!

(06-06-2014, 01:11 PM)Mudbill Wrote: It's a very strange series of events you have here. I'm not sure what you intended with it.
What i'm trying to do is, if you die on the game you'll have to start over from the begining like an infinte loop that will break if you survive
(This post was last modified: 06-07-2014, 02:08 AM by ProyectV.)
06-07-2014, 02:07 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#7
RE: WHAT IS WRONG?!!!!!!!!!!!!!

PHP Code: (Select All)
void OnStart()
{
Again(0.0f);
}

void Again(float eSpeed1)
{
if(
GetPlayerHealth() > 0)
{
return;
}

AddTimer(""eSpeed1"ChangeLevel");
GivePlayerDamage(110"Claws"truetrue);
StartScreenShake(0.01f0.5f0.5f1.0f);
PlayGuiSound("attack_claw.snt"0.7f);
SetGlobalVarInt("DejaVu"1);
}

void ChangeLevel(string &in asTimer)
{
ChangeMap("Cuartos Esclavos.map""PlayerStartArea_1""22_end.snt""");
}

void Again(string &in asName)
{
if(
GetGlobalVarInt("DejaVu")== 1)
{
SetMessage(""""0.0f);
}


I think the engine is confused which one to call. Also what is eSpeed1?

"Veni, vidi, vici."
"I came, I saw, I conquered."
06-07-2014, 03:04 AM
Find
ProyectV Offline
Junior Member

Posts: 19
Threads: 6
Joined: Apr 2014
Reputation: 0
#8
RE: WHAT IS WRONG?!!!!!!!!!!!!!

(06-07-2014, 03:04 AM)SomethingRidiculous Wrote:
PHP Code: (Select All)
void OnStart()
{
Again(0.0f);
}

void Again(float eSpeed1)
{
if(
GetPlayerHealth() > 0)
{
return;
}

AddTimer(""eSpeed1"ChangeLevel");
GivePlayerDamage(110"Claws"truetrue);
StartScreenShake(0.01f0.5f0.5f1.0f);
PlayGuiSound("attack_claw.snt"0.7f);
SetGlobalVarInt("DejaVu"1);
}



I think the engine is confused which one to call. Also what is eSpeed1?

0.0f = eSpeed1

again(0.0f);

void again(float eSpeed1)
06-07-2014, 03:30 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#9
RE: WHAT IS WRONG?!!!!!!!!!!!!!

(06-07-2014, 03:30 AM)ProyectV Wrote:
(06-07-2014, 03:04 AM)SomethingRidiculous Wrote:
PHP Code: (Select All)
void OnStart()
{
Again(0.0f);
}

void Again(float eSpeed1)
{
if(
GetPlayerHealth() > 0)
{
return;
}

AddTimer(""eSpeed1"ChangeLevel");
GivePlayerDamage(110"Claws"truetrue);
StartScreenShake(0.01f0.5f0.5f1.0f);
PlayGuiSound("attack_claw.snt"0.7f);
SetGlobalVarInt("DejaVu"1);
}



I think the engine is confused which one to call. Also what is eSpeed1?

0.0f = eSpeed1

again(0.0f);

void again(float eSpeed1)

What I meant is what is eSpeed1. eSpeed1 is definitely not a default string so it's unrecognizeable.

"Veni, vidi, vici."
"I came, I saw, I conquered."
06-07-2014, 03:39 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#10
RE: WHAT IS WRONG?!!!!!!!!!!!!!

eSpeed1 is defined as a float in the parameter of Again. The other Again that uses a string parameters does not conflict with the float one. Only constructors with the same parameters can conflict. For example, you can make OnStart("Answer") and OnStart(42) and neither of them will cause any issues for the normal OnStart() with no parameters.

@OP
So you're trying to reset the level if the player dies? I don't think OnEnter is called again when you respawn. You should use the CheckPoint script. It has a callback for when the player dies and where to respawn them.

PHP Code: (Select All)
CheckPoint (stringasNamestringasStartPosstringasCallbackstringasDeathHintCatstringasDeathHintEntry); 

(This post was last modified: 06-07-2014, 12:39 PM by Mudbill.)
06-07-2014, 12:36 PM
Find




Users browsing this thread: 1 Guest(s)