Frictional Games Forum (read-only)
[SCRIPT] HUD 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] HUD Problem (/thread-25236.html)

Pages: 1 2


HUD Problem - SSEAlexander - 05-07-2014

I have problem with my hud.
My entire sanity events .txt :

<InsanityEvents>

<SoundStream
Name = "event_1a"
Set = "PHONE"
MaxSanity = "95"

File = "silence.ogg"
Volume = "1"
SoundDelayTime = "0.2"

FadeScreen = "true"
FadeColor = "1 1 1 1"
FadeInTime = "0"
FadeOutTime = "1000000000"

FadeImageFile = "cbradio.tga"

DisablePlayer = "false"
/>
<SoundStream
Name = "event_1b"
Set = "PHONE"
MaxSanity = "95"

File = "silence.ogg"
Volume = "1"
SoundDelayTime = "0.2"

FadeScreen = "true"
FadeColor = "1 1 1 1"
FadeInTime = "0"
FadeOutTime = "1000000000"

FadeImageFile = "cbradio.tga"

DisablePlayer = "false"
/>
<SoundStream
Name = "event_1c"
Set = "PHONE"
MaxSanity = "95"

File = "silence.ogg"
Volume = "1"
SoundDelayTime = "0.2"

FadeScreen = "true"
FadeColor = "1 1 1 1"
FadeInTime = "0"
FadeOutTime = "1000000000"

FadeImageFile = "cbradio.tga"

DisablePlayer = "false"
/>


<SoundStream
Name = "event_m4"
Set = "M4A4"
MaxSanity = "95"

File = "silence.ogg"
Volume = "0"
SoundDelayTime = "0.2"

FadeScreen = "true"
FadeColor = "1 1 1 1"
FadeInTime = "0"
FadeOutTime = "1000000000"

FadeImageFile = "m4a4.tga"

DisablePlayer = "false"
/>

</InsanityEvents>

Script that i use:

To enable :

void GoCheckthehud(string &in Timer)
{
SetLocalVarInt("PHONEHUD", 1);
SetInsanitySetEnabled("HUD2", false);
SetInsanitySetEnabled("HUD3", false);
SetInsanitySetEnabled("HUD4", false);
SetInsanitySetEnabled("PHONE", true);
AddTimer("reconfigure", 0, "reconfigure");
AddTimer("startevent", 0.1, "startevent");
SetEntityActive("stopradio",true) ;
SetEntityActive("stopradio_1",true) ;
PlaySoundAtEntity("radko", "scpradio0r.snt", "Player", 0, true);
}

void reconfigure(string &in asTimer)
{
SetInsanitySetEnabled("HUD1", false);
SetInsanitySetEnabled("HUD2", false);
SetInsanitySetEnabled("HUD3", false);
SetInsanitySetEnabled("PHONE", true);
}

void startevent(string &in asTimer)
{
StartRandomInsanityEvent();
}

To Disable :

void GoStoptheHud(string &in entity)
{
SetInsanitySetEnabled("PHONE", false);
GiveItemFromFile("syr_2", "radio.ent");
SetEntityActive("stopradio",false) ;
SetEntityActive("stopradio_1",false) ;
SetGlobalVarInt("picked", 1);
AddTimer("config1", 0.1, "config1");
AddTimer("Used_timer", 1, "Used_timer");
StopSound("radko", 0.1);
}


void config1(string &in asTimer)
{
SetInsanitySetEnabled("Default", false);
SetInsanitySetEnabled("PHONE", false);
StartRandomInsanityEvent();
}

The problem is,It enables radio hud but...It also enables event_m4.
I want it to use radio only.But everytime it uses radio or m4 hud.


RE: HUD Problem - DnALANGE - 05-07-2014

Well..
You are doing it the OLD way...
This way you should DISABLE all the other events you can fine in your sanityevent.cfg
You should DE_ACTIVATE \ DISABLE them in your YOURMAP.hps
on OnSTART or OnENTER
-
BUT in the NEW (beta) patch there is an actual script that calls for the event itself.
so you do NOT need to DE_ACTIVATE \ DISABLE the other events!
Only 1 line :
PHP Code:
StartInsanityEvent("YOUREVENTHERE"); 
to STOP the event :
PHP Code:
StopCurrentInsanityEvent(); 



RE: HUD Problem - SSEAlexander - 05-07-2014

well,I have The new Patch ,I used the script and...Poop...Nothing appears.
Nothing works,Just nothing.
Well,I need the old way to work.
Right?


RE: HUD Problem - DnALANGE - 05-07-2014

Take a look at an Example from my Original PREMONITION mod.
Here take a look and try to understand.
PHP Code:
////////Scripts made by DnALANGE ///////////

void OnStart()
{
/////HudShowsKeyInGarden/////
AddEntityCollideCallback("Player""HudMagnifierglass""MagnifierKeyGarden"false0);


                                 
/////Magnifierglass/////
    
void MagnifierKeyGarden(string &in asParentstring &in asChildint alState)
{
if(
alState == 1)
{
StartInsanityEvent("MagnifierGlass_1");
}

if(
alState == -1)
{
StopCurrentInsanityEvent();
}
}
                                          
/////EndHud///// 
-----
What this does is when your are INSIDE a SCRIPTAREA (HudMagnifierglass) the event is there, when you LEAVE the SCRIPTAREA the event will STOP.


RE: HUD Problem - SSEAlexander - 05-07-2014

(05-07-2014, 07:20 PM)DnALANGE Wrote: Take a look at an Example from my Original PREMONITION mod.
Here take a look and try to understand.

i need to download your mod?
Eh...

(05-07-2014, 07:20 PM)DnALANGE Wrote: Take a look at an Example from my Original PREMONITION mod.
Here take a look and try to understand.
PHP Code:
////////Scripts made by DnALANGE ///////////

void OnStart()
{
/////HudShowsKeyInGarden/////
AddEntityCollideCallback("Player""HudMagnifierglass""MagnifierKeyGarden"false0);


                                 
/////Magnifierglass/////
    
void MagnifierKeyGarden(string &in asParentstring &in asChildint alState)
{
if(
alState == 1)
{
StartInsanityEvent("MagnifierGlass_1");
}

if(
alState == -1)
{
StopCurrentInsanityEvent();
}
}
                                          
/////EndHud///// 
-----
What this does is when your are INSIDE a SCRIPTAREA (HudMagnifierglass) the event is there, when you LEAVE the SCRIPTAREA the event will STOP.

Doeessnt work.
I used StartInsanityEvent("M4A4");
to the
"OnStart"
and nothing happened.Just tell me old script...


RE: HUD Problem - FlawlessHappiness - 05-07-2014

Well, DNA got his script working.
I recall he had to use the script line twice some times, if i'm correct?

Maybe your HUD is actually appearing, but the image file is not shown.
Make sure everything about the image is made correctly. I'm not sure what "Correctly" is, but if you can make it correct, there's gotta be mistakes to make too!


RE: HUD Problem - DnALANGE - 05-07-2014

Dont use it onstart... should work tho...
please, if you can download premonition. Play it, learn from what i did, and look how i done it.
not behind my pc, sorry.
itshould 1000% work.
remember touse 32x32 64x64 512x512 etcetcc...
be sure to look if your pictures are good. And they have a pow2 size.


RE: HUD Problem - SSEAlexander - 05-09-2014

they do not have pow2 size.But they work.
And i do have 512x512.


RE: HUD Problem - PutraenusAlivius - 05-09-2014

(05-09-2014, 03:31 PM)stenclowskimat Wrote: they do not have pow2 size.But they work.
And i do have 512x512.

IIRC, any images you use have to use a POW2 size.


RE: HUD Problem - SSEAlexander - 05-10-2014

Well,
I cannot work with knolewge to do the hud.
Just tell me how to MAKE THAT SCRIPT WORK.
Not how it works.How to make it.