Frictional Games Forum (read-only)
[SCRIPT] (Solved) GetPropIsInteractedWith not working? - 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) GetPropIsInteractedWith not working? (/thread-30422.html)

Pages: 1 2


RE: (Solved) GetPropIsInteractedWith not working? - FlawlessHappiness - 08-22-2015

That's great! No problem Smile
It's weird that it doesn't work straight forwardly though..


RE: (Solved) GetPropIsInteractedWith not working? - Mudbill - 08-22-2015

Just wondering; this looks like a collide callback. What's calling it? You left your OnStart out of the script.

PHP Code:
void Impact2(string &in asParentstring &in asChildint alState

Perhaps the reason it didn't work before was that it wasn't calling at the right time, whereas a repeating timer will obviously repeatedly call it under multiple conditions.


RE: (Solved) GetPropIsInteractedWith not working? - Neelke - 08-22-2015

Well basically how this works in the first place is setup with two areas.

Code:
void OnStart()
{
    //Collide callback
    AddEntityCollideCallback("stone", "AreaRockOnShovel_1", "Impact1", false, 1);
    AddEntityCollideCallback("stone", "AreaRockOnShovel", "Impact2", false, 1);
}


The script area AreaRockOnShovel_1 is just calculating the time of how long it takes for the rock to hit the next area. Meanwhile the AreaRockOnShovel calls the whole event. I doubt that the script would be able to somehow not call it at the right time, especially now with this integer variable I'm using instead. Maybe I managed to make the game think I dropped it sometime when holding it somehow.

The script areas are also setup like this, thought it would be useful to know (apologies for a white background).

[Image: gdNtL4b.png]


RE: (Solved) GetPropIsInteractedWith not working? - Daemian - 08-22-2015

PHP Code:
bool a = (Speed >= 0.25f);
bool b = (GetPropIsInteractedWith(asParent)); 

what happened with this? Both this values are being initialized?
Insert there a debug message (if you want to keep testing). Something like this:
If (a) msg("a is true") else msg("a is false");
if (b) msg("b is true") else msg("b is false");


RE: (Solved) GetPropIsInteractedWith not working? - Neelke - 08-22-2015

Both the values are being initialized, but with the GetPropIsInteractedWith in a seperate timer, using an integer to control it instead (if I understand what you mean).

I did get it to work the way I wanted it to exactly. I just had to make a rather strange method to fix it.

Code:
// Helper to update if stone is held
int iInteractStoneIndex = 0;
void TimerUpdateInteraction(string &in asTimer)
{
    if(!GetPropIsInteractedWith("stone")) iInteractStoneIndex = 0;
    else iInteractStoneIndex = 1;
    
    AddTimer("loop", 0.0166f, "TimerUpdateInteraction");
}

void Impact2(string &in asParent, string &in asChild, int alState)
{
    float Time = (1.05f - GetTimerTimeLeft("ImpactTime"));
    float Speed = (Distance / Time); // Gets the speed
    
    if(Speed >= 0.2f && iInteractStoneIndex == 0)
    {