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
Script Help (Solved) GetPropIsInteractedWith not working?
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#11
RE: (Solved) GetPropIsInteractedWith not working?

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

Trying is the first step to success.
08-22-2015, 12:23 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#12
RE: (Solved) GetPropIsInteractedWith not working?

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

PHP Code: (Select All)
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.

(This post was last modified: 08-22-2015, 12:47 AM by Mudbill.)
08-22-2015, 12:46 AM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#13
RE: (Solved) GetPropIsInteractedWith not working?

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

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]

Derp.
(This post was last modified: 08-22-2015, 10:31 AM by Neelke.)
08-22-2015, 10:27 AM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#14
RE: (Solved) GetPropIsInteractedWith not working?

PHP Code: (Select All)
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");

08-22-2015, 02:49 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#15
RE: (Solved) GetPropIsInteractedWith not working?

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.

// 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)
    {

Derp.
(This post was last modified: 08-22-2015, 06:26 PM by Neelke.)
08-22-2015, 06:25 PM
Find




Users browsing this thread: 1 Guest(s)