game links have little to no functions to dynamically set them.
I am trying to attach an actor to a unit, but idk what actor until its ran. I can get the actor in a string, but not a game-link actor variable. Sadly it doesnt let you pass strings as gamelinks.
AttachActorToUnit((UnitLastCreated()), "wowbase72", "Head") its a string!
Im assuming sc2 doesn't allow dynamic code
Only way i can think of is create a 1000 long if then else. Check if the string is equal to string(gamelink). Seeing as this trigger will run 1000s of times in a game, that wouldn't be good.
---
Maybe there is another way to do what im trying to do. Im trying to change 1 unit's actor to be the same as a different units. (thus matching the model, sounds, and portrait)
Dynamic code is not the problem, more the bad behaviour of GUI. Gamelinks are actualy Strings, but the Trigger editor treats it as something different.
Fortunately you can trick the TE using Custom Script
Internally, there is no difference between strings and gamelinks, so you should be able to create your own String to Gamelink functions by using a little custom script.
For your actor example:
Create a new function, lets call it String to Actor Gamelink
Set the return type to Game Link (Actor)
Add a new parameter of type String, lets call it Input
Add the Custom Script action and paste the following line of code:
returnlp_input;
That should do it. If you need another return type, you can copy the function and change the name and return type.
game links have little to no functions to dynamically set them.
I am trying to attach an actor to a unit, but idk what actor until its ran. I can get the actor in a string, but not a game-link actor variable. Sadly it doesnt let you pass strings as gamelinks.
AttachActorToUnit((UnitLastCreated()), "wowbase72", "Head") its a string!
Im assuming sc2 doesn't allow dynamic code
Only way i can think of is create a 1000 long if then else. Check if the string is equal to string(gamelink). Seeing as this trigger will run 1000s of times in a game, that wouldn't be good.
---Maybe there is another way to do what im trying to do. Im trying to change 1 unit's actor to be the same as a different units. (thus matching the model, sounds, and portrait)
@shocker455: Go
Dynamic code is not the problem, more the bad behaviour of GUI. Gamelinks are actualy Strings, but the Trigger editor treats it as something different.
Fortunately you can trick the TE using Custom Script
Note: lp_gamelink is where the Custom Script comes to work
Hope this helps
Cheers
Then
Internally, there is no difference between strings and gamelinks, so you should be able to create your own String to Gamelink functions by using a little custom script.
For your actor example:
That should do it. If you need another return type, you can copy the function and change the name and return type.
€ damn...
Well, just consider this a confirmation :D
thanks!
didn't expect an answer tonight :)