Frictional Games Forum (read-only)

Full Version: Whats script areas problem? (ladder isue)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi.
I wrote this to make the ladder item (the one that u pick up) to interact with an Area (LadderArea) to make appear the static item lader (LadderJoint). But for some reason... i cant make the item interacts with the area... its like the area wasnt there for interact.

(info for the script below; "LladerItem" the pickup ladder / "LadderArea" its an Area where the pickup ladder will interact / and LadderJoint and ClimbArea is the two items that will apear to let me go up.
Dont know whats my mistake.
I make the Area where the ladder interacts TO huge to make it sure to find it yet nothing... or that makes it even worst?

void OnStart()
{
AddEntityCollideCallback ("LadderItem", "LadderArea", "PutLadderToClimb", true, 1);
}

void PutLadderToClimb (string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "05_attach_ladder.snt", "LadderArea", 0, false);
RemoveItem("LadderItem");
SetEntityActive("LadderJoint", true);
SetEntityActive("ClimbArea", true);
}
First of all you should make sure that Interaction is enabled on the area:
[Image: rqRK3oA.png]

If the ladder is an inventory item, you can't use Entity Collide Callbacks, use this instead:

PHP Code:
void OnStart()

    
AddUseItemCallback("""LadderItem""LadderArea""PutLadderToClimb"true);
}

void PutLadderToClimb (string &in asItemstring &in asEntity)

    
PlaySoundAtEntity("""05_attach_ladder.snt""LadderArea"0false);
    
RemoveItem("LadderItem");
    
SetEntityActive("LadderJoint"true);
    
SetEntityActive("ClimbArea"true);

Hi. Thank you.

I tought that if an entity gets in touch with a script area I needed to use the Entity CollideCallbacks...
That is correct; an entity colliding with a script area DOES use AddEntityCollideCallback. But INVENTORY items do not collide, they are interacted with upon something else (used with).
If you still have problems, make the script area bigger than the ladder area and remove it after you've activated the ladder area.