I posted this in a separate thread, but it is really a topic of its own.
Currently, I can create an actor using:
unitgroup group = UnitCreate(1, "Carrier", c_unitCreateIgnorePlacement, 1, Point(50, 50), 0);
unit ship = UnitGroupUnit(group, 1);
actorscope as = ActorScopeFromUnit(ship);
actor act = ActorFromScope(as, "::Main");
Looking at TriggerLibs/NativeLib, I have figured out how to move the actor and do all kinds of other cool stuff. The only problem is that I have to create a new unit for every such actor... I would prefer to just create the actor itself. There is a function in NativeLib that seems to do just that:
actor libNtve_gf_CreateModelAtPoint (string lp_model, point lp_position) {
// Variable Declarations
actor lv_a;
Unfortunately it doesn't do anything for me. I just can't seem to pass the right lp_model string. I've tried almost everything. Most of the time it just does nothing, but if you give it something ending in ".m3", such as "Assets\Units\Zerg\Mutalisk\Mutalisk.m3" , the trigger crashes with an "unable to create actor" error. Perhaps I'm on the right track... any ideas?
You got to turn \'s into 's. \ is an escape characters. That means that SC2 is searching for special signs after seeing a \. But in this case you want to use it as a simple path.
So it'd turn into "Assets Units Zerg Mutalisk Mutalisk.m3"
I don't know if that's the only thing not working correctly there, but that's what strikes me at first.
I know about escape characters, everything is properly escaped (with "\\"), so that's not the problem. In fact, if the escapes were not properly done, the script itself would fail to load (since "\U" is an invalid escape sequence). Thanks, though.
I actually can't find a single example anywhere of ActorCreate working properly :(
I posted this in a separate thread, but it is really a topic of its own.
Currently, I can create an actor using:
unitgroup group = UnitCreate(1, "Carrier", c_unitCreateIgnorePlacement, 1, Point(50, 50), 0);
unit ship = UnitGroupUnit(group, 1);
actorscope as = ActorScopeFromUnit(ship);
actor act = ActorFromScope(as, "::Main");
Looking at TriggerLibs/NativeLib, I have figured out how to move the actor and do all kinds of other cool stuff. The only problem is that I have to create a new unit for every such actor... I would prefer to just create the actor itself. There is a function in NativeLib that seems to do just that:
actor libNtve_gf_CreateModelAtPoint (string lp_model, point lp_position) {
// Variable Declarations
actor lv_a;
// Variable Initialization
lv_a = null;
// Implementation
ActorCreate(null, "Model", (lp_model), null, "null");
lv_a = libNtve_gf_LastCreatedActor();
ActorSend(lv_a, libNtve_gf_ActorMsg1("SetPositionH", libNtve_gf_ConvertXYToString(PointGetX(lp_position), PointGetY(lp_position))));
ActorSend(lv_a, libNtve_gf_SetHeight(PointGetHeight(lp_position)));
return lv_a;
}
Unfortunately it doesn't do anything for me. I just can't seem to pass the right lp_model string. I've tried almost everything. Most of the time it just does nothing, but if you give it something ending in ".m3", such as "Assets\Units\Zerg\Mutalisk\Mutalisk.m3" , the trigger crashes with an "unable to create actor" error. Perhaps I'm on the right track... any ideas?
You got to turn \'s into
's. \ is an escape characters. That means that SC2 is searching for special signs after seeing a \. But in this case you want to use it as a simple path.
So it'd turn into "Assets
Units
Zerg
Mutalisk
Mutalisk.m3"
I don't know if that's the only thing not working correctly there, but that's what strikes me at first.
@s3rius:
I know about escape characters, everything is properly escaped (with "\\"), so that's not the problem. In fact, if the escapes were not properly done, the script itself would fail to load (since "\U" is an invalid escape sequence). Thanks, though.
I actually can't find a single example anywhere of ActorCreate working properly :(
So does anyone have a working map that successfully uses ActorCreate? I would be very interested in such an example.