AddSpecialEffectTarget
- Parameters
modelName stringThe path of the model. Use double backslashes when specifying a directory, rather than single backslashes. See AddSpecialEffect for an example.
targetWidget widgetThe widget to attach the effect to.
attachPointName stringString of tokens separated by spaces (case-sensitive, lowercase is required). See the list below.
Only the first 4 characters of the substring are checked for token matches. If no known tokens are found, the substring is ignored. Full attachment point selection rules are described in the note below.
"alternate""chest""eattree""feet""fifth""first""foot""fourth""gold""hand""head""large""left""medium""mount""origin""overhead""rallypoint""rear""right""second""sixth""small""smart""sprite""third""weapon"
- comment
Attaches the special effect to the attachment point referred in
attachPointNameargument of the target widget, using the model file with a pathmodelName.Attachment points are points in a model that can be referenced to as areas for effects to be attached, whether it be from a spell or this function.
Upon creation, the effect will play its "birth" animation followed by its "stand" animation (once the birth animation has finished). If the model does not have animations, it will show up the way it appears by default. The effect will last indefinitely unless it is destroyed, even if the model seems to disappear. To destroy an effect, see DestroyEffect.
- note
Attachment point selection logic:
- Each attachment point in the model has a prop array built by splitting its name by spaces and storing the first 4 characters (as 32-bit number) of recognized tokens
(unrecognized substrings are ignored). Example:
"Foot Right Ref"->["foot", "right"]->["foot", "righ"]. 2 TheattachPointNameargument is tokenized the same way. The token is not searched literally by the string, but by a 32-bit number made up of the first four characters, so the argument is case-sensitive and requires the use of lowercase letters. You can use only the first 4 characters, like "over" instead of "overhead", etc. 3.For each attachment point, the number of matching tokens (order doesn't matter) is counted againstattachPointNametokens. The best match is the attachment point with the most matching tokens. Ties are broken by choosing the attachment point with the fewest non-matching tokens. If still tied, the first one found is used. If no attachment point matches, the special effect will not created.
- Each attachment point in the model has a prop array built by splitting its name by spaces and storing the first 4 characters (as 32-bit number) of recognized tokens
(unrecognized substrings are ignored). Example:
- note
Strings such as "Large" and "Medium" affect effects' sizes on the widget it is attached to. You can add or remove these by going to the object editor and modifying "Art - Required Animation Names - Attachments" for a particular unit you are attaching effects to.
- note
To create an effect only visible to one player see https://www.hiveworkshop.com/threads/gs.300430/#post-3209073.
- patch
1.00
- Source
- common.j (suggest an edit or discuss on Github)
- return type
effect- Source code
native AddSpecialEffectTarget takes string modelName, widget targetWidget, string attachPointName returns effect