Page 1 of 1

Attach(character) question.

Posted: Sat Aug 12, 2017 8:14 pm
by Yukiko
Under what circumstances and what type of script(s) might I want to use this function?

Re: Attach(character) question.

Posted: Sat Aug 12, 2017 10:18 pm
by DevGIB
For characters i believe actions that the character performs should be attached to that character.
For example if they are using a skill or casting a spell it should be attached.
As a player can only have 1 script attached at a time it stops them from being able to do multiple things at once.

I figured timed scripts like poison controls could also be attached to a player, however looking through a few script bases i can't see many that take advantage of it so i can't help but feel it might have been a legacy function.

Re: Attach(character) question.

Posted: Sun Aug 13, 2017 12:01 am
by Yukiko
I've never seen a skill script actually call the Attach() function though.

Re: Attach(character) question.

Posted: Sun Aug 13, 2017 1:19 am
by CWO
Skill scripts are automatically attached by the core along with item use scripts.

Re: Attach(character) question.

Posted: Sun Aug 13, 2017 3:27 am
by Turley
I wouldn't call it a legacy function. The usecases are limited sure, but since we have the possibility to detach a script we should also have the possibility to attach one. So the purpose is symmetry ;)

Re: Attach(character) question.

Posted: Sun Aug 13, 2017 9:25 pm
by Yukiko
Ah.
I like symmetry.
:)

I just can't think of a use case off the top of my head. Time to do a ZTree search of the 45+ shards I have on file to see if anyone has Attach'ed a script to a player character. ;)

Re: Attach(character) question.

Posted: Sun Aug 13, 2017 9:38 pm
by CWO
I've used it when debugging stuff or creating new stuff to replace existing. Like some item use scripts that I would start off as developer level commands and such. If it fits your scripting style and situation, it can be useful.