Frictional Games Forum (read-only)
[SCRIPT] [SOLVED]Script problem - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] [SOLVED]Script problem (/thread-27481.html)



[SOLVED]Script problem - FlawlessHappiness - 12-02-2014

Today I wanted to test my MASSIVE script, and when I say massive I mean 1800 lines.

I had just added a health to percentage logic. All fine and doodely doo. As I wanted to test my script something weird happens.

Script lines are not triggering.

According to my debug messages, everything is working fine.

[Image: 78a0d92ff4.jpg]

But certain lines are not triggering, such as "SetPlayerActive(false);".
This is a part of my script where the debug message is clearly calling:
PHP Code:
if(asTimer == "FindMonster")
    {
        
AddDebugMessage("WHYDOESN'TTHISWORK?"false);
        
BattlePreparation();
        
SetPlayerActive(false);
        
PlayMusic("MonsterMusic_1.ogg"true7110false);
        
        
FadePlayerFOVMulTo(1.52);
        
FadeImageTrailTo(153);
        
        
FadePlayerRollTo(901010);
        
FadeOut(2);
        
AddTimer("PrepareVision"2"FindMonsterTimer");
    } 

Lines that a not calling are:

PHP Code:
SetPlayerActive(false);
PlayMusic("MonsterMusic_1.ogg"true7110false);

FadePlayerFOVMulTo(1.52);
FadeImageTrailTo(153);

FadePlayerRollTo(901010);
FadeOut(2);
AddTimer("PrepareVision"2"FindMonsterTimer"); 

Does anyone have any idea why this is happening? Is there a limit to how much scripting I can have? That would REALLY suck!

Keep in mind I have no errors, this used to work, then I added a couple of stuff with no relation to this part, and it stopped working.

Things I've tried:
- Delete map.cache
- Restart Amnesia
- Overwrite my .hps file to the same folder


RE: Script lines stopped triggering. - Mudbill - 12-02-2014

Everything stops after BattlePreparation();
What happens in there?
What if you moved that line to the bottom of this block?


RE: Script lines stopped triggering. - FlawlessHappiness - 12-02-2014

Oh!
I fixed it. God damn me.

The script lines that I had just created were causing the trouble. For some reason they broke down the whole script!

They look like this:
PHP Code:
SetGlobalVarInt("EnemyCurPercHealth"Floor((PercentageXY(GetGlobalVarInt("EnemyMonsterHealth"), GetGlobalVarInt("EnemyMaxHealth")))/10));
AddDebugMessage("Enemy HP % = "+GetGlobalVarInt("EnemyCurPercHealth")*10+"%"false);

and

SetGlobalVarInt("FriendlyCurPercHealth"Floor((PercentageXY(GetGlobalVarInt("FriendlyMonsterHealth"), GetGlobalVarInt("FriendlyMaxHealth")))/10));
AddDebugMessage("Friendly HP % = "+GetGlobalVarInt("FriendlyCurPercHealth")*10+"%"false); 

Don't know why they break it down though...

This is Floor and PercentageXY:

PHP Code:
int Floor(float &in x)
{
    return 
int(x);
}

float PercentageXY(int &in xint &in y)
{
    return 
float((float(x)/float(y))*100);


EDIT:
It is fixed now. The problem was that I somewhere in the script had both LocalVarInts and GlobalVarInts of the same name. This caused trouble. Be careful with that.


RE: [SOLVED]Script lines stopped triggering. - Mudbill - 12-02-2014

Alrighty then. Carry on with your sweet scripts! Tongue


RE: [SOLVED]Script lines stopped triggering. - FlawlessHappiness - 12-02-2014

(12-02-2014, 07:51 PM)Mudbill Wrote: Alrighty then. Carry on with your sweet scripts! Tongue

Will do Wink
On a sidenote: Have you ever played with particle systems?


RE: [SOLVED]Script lines stopped triggering. - Mudbill - 12-02-2014

Not that much. At least if you're talking about the Particle Editor. Maybe I will with the new one, it looks pretty great.


RE: [SOLVED]Script problem solved. Another question further down. - FlawlessHappiness - 12-02-2014

(12-02-2014, 10:34 PM)Mudbill Wrote: Not that much. At least if you're talking about the Particle Editor. Maybe I will with the new one, it looks pretty great.

I am.
Problem is when I create a particle with movement, I can't rotate it with a rotated area.
Instead I've created seperate files. One for going back. One for going forward.

Does anyone know if there's a solution to this?


RE: [SOLVED]Script problem solved. Another question further down. - Rapture - 12-02-2014

In the Particle Editor...

Open up the Particle you have, go to the "Movement" Tab... change the "Coord System" from "World" to "Local".


RE: [SOLVED]Script problem solved. Another question further down. - FlawlessHappiness - 12-03-2014

(12-02-2014, 11:21 PM)Rapture Wrote: In the Particle Editor...

Open up the Particle you have, go to the "Movement" Tab... change the "Coord System" from "World" to "Local".

Oooooooooh! Awesome!

Thank you ^_^
This will make it all a lot easier