Frictional Games Forum (read-only)

Full Version: Examine script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
changed to area script but result is still the same = nothing , im getting really mad :x cmon dolan help me
(08-08-2013, 11:14 AM)Tomzzz Wrote: [ -> ]well:


<LANGUAGE>
<CATEGORY Name = "Examine">
<Entry Name="InteractCandlestick">It is a candlestick</Entry>
</CATEGORY>

thats all im using in lang since ive just started creating new custom story... and i'll dont add anything until this problem will be fixed..

<LANGUAGE>
<CATEGORY Name = "Examine">
<Entry Name="InteractCandlestick">It is a candlestick</Entry>
</CATEGORY>
</LANGUAGE>

That's what was wrong. However, if you want a message, the .lang file must be changed:

GOOD .LANG FILE

Code:
<LANGUAGE>
<CATEGORY Name = "Messages">
<Entry Name="InteractCandlestick">It is a candlestick</Entry>
</CATEGORY>
</LANGUAGE>

And your fixed script:


Code:
void OnStart()
{    
///As you already do my thing in the level editor, is not necessary to put that function here
}

//This gets called when you interact with your area

void InteractCandlestick(string &in asEntity)
{
SetMessage("Messages", "InteractCandlestick", 0);
}


void OnLeave()
{

}
Thanks dolan, its finally working!.. but i just dont get it.. what was wrong? your fixed script looks same only you just changed Examine to messages if im correct..
Exactly: When you make a message, it MUST be in the "Messages" category. As the category was named "Examine" and not "Messages" the game didn't display that message, because it didn't know that was a message.

About the script: In the level editor you can also do script (not a powerful tool to make script, just a help) and, when it's about touching and those things, I prefer using the level editor and a bit of script.
(08-08-2013, 11:07 AM)Tomzzz Wrote: [ -> ]wait , wait.. so candle (as model) must be in code? cuz im using only Area Example in script
.. im touching the area not the model i think?
name of model is candlestick_tri_1... but i dont think i need to use it in code or i should? if yes can you show me where..

Glad it's solved and this may not have helped anyway, but in your previous script you had this line
Code:
SetEntityPlayerInteractCallback("InteractCandlestick", "InteractCandlestick", true);

That first parameter, the one you have as "InteractCandlestick", is the name of the entity that the interact callback is set to, so when you interact with 'InteractCandlestick' the function in the second parameter, in this case also called 'InteractCandlestick' is called. Obviously, if there is no entity called 'InteractCandlestick' then the callback will never be activated

So, if the name of your candlestick entity in the level ed is 'candlestick_tri_1' then the line should read
Code:
SetEntityPlayerInteractCallback("candlestick_tri_1", "InteractCandlestick", true);


Personally, I would always always set callbacks in the script rather than in the level editor - if you have the callbacks set in the level editor and the functions in the script it means you have to check 2 different places if something is not working, and it makes it way harder to keep track of what callbacks have been set where etc.
But then, I'm a programmer so I would say that Tongue
Pages: 1 2