Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

AreaTriggers created from extension scripts cannot call functions from extension scripts

Here you can find all solved gameplay problems and bugs (beginning from Pre-Alpha 1.8.8).
Forum rules
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
Locked
User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 25

AreaTriggers created from extension scripts cannot call functions from extension scripts

Post by JakSparro98 » Sun Feb 25, 2018 1:20 am

When an Areatrigger that is created by an extension script uses OnEnterMethod or OnLeaveMethod, it will search the method from the map script instead of the script file.

Map and Script examples.
3 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Sun Feb 25, 2018 12:19 pm

Fixed after Beta 1.0.2c

Turns out that this works already for the generic IObjectTrigger.SetScriptMethod, which all triggers call when something happens. Turns out that the AreaTrigger's SetOnEnterMethod / SetOnLeaveMethod called the wrong internal function to make the magic work.

ScriptAPI: Fixed following to work with extension script functions:
IObjectElevatorAttachmentJoint.SetOnDestinationReachedMethod
IObjectElevatorPathJoint.SetOnElevatorReachedMethod
IObjectRailAttachmentJoint.SetOnDestinationReachedMethod
IObjectAreaTrigger.SetOnEnterMethod
IObjectAreaTrigger.SetOnLeaveMethod

Also fixed a bug where IObjectTrigger.SetScriptMethod didn't always trigger functions in extension scripts if the script was deactivated and then re-activated.
2 x
Gurt

Locked