Entities and other articy objects as script parameters

Tue 25. Jun 2019, 00:41

Hi, I'm currently evaluating Articy Draft for a Unity project and am trying to understand how to hook it up to game code. I understand it is possible to use scripts that correspond to c# methods, and it seems I can pass basic variables to those methods, but I'm not sure how to handle referencing specific entities as method parameters.

As an example: let's say I have a dialogue which has an instruction node to do some effect on an arbitrary character in the game (e.g. "Give me 50 gold and I'll improve your relationship with this other character"). Intuitively I'd write an instruction that'd say "ImproveRelationship(character_ref)". What is the best way to handle this? I suppose I can pass the technical name or object id as a string reference, but that doesn't make for a good workflow (having to manually cross reference id with entity is... yuck). Is there a better way?
taylank
 
Posts: 4
Joined: Tue 25. Jun 2019, 00:31

Re: Entities and other articy objects as script parameters

Tue 25. Jun 2019, 14:07

Hi taylank,

We don't have objects as a type in variables, but we allow storing them inside string variables.
So something like this is a valid script:

Code: Select all
Namespace.MyStringVariable = getObj("SomeChar")


You can also access object references in templates and store those in string variables:

Code: Select all
Namespace.MyStringVariable = getProp(getObj("SomeChar"), "Feature.SomeReferenceSlot")


One step further you can use string variables in all places where you use getObj.
For example:

Code: Select all
setProp(Namespace.MyStringVariable, "Inventory.Gold", 50)

or

Code: Select all
ImproveRelationship(Namespace.MyStringVariable)


The C# method of ImproveRelationship will receive a string as argument, which is structured as follows: <id>_<instance-id>
The string can be directly put into ArticyDatabase.GetObject in order to receive the ArticyObject of the string representation.


Best regards,

Chris
User avatar
[Articy] Christian Schildt
Articy Staff
Articy Staff
 
Posts: 60
Joined: Tue 16. Jan 2018, 17:03
Location: Bochum

Re: Entities and other articy objects as script parameters

Fri 5. Jul 2019, 11:53

Hi, taylank! How did it go?
This time I just have to visit this website. For sure, right now I want to know book of ra kostenlos spielen ohne anmeldung mit freispielen. This is something I really on't want to miss.
Lehnard
 
Posts: 1
Joined: Fri 5. Jul 2019, 11:52

Return to Technical Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

Who We Are
Contact Us
Social Links