by Xaser » Fri Feb 21, 2014 7:13 pm
If you're already using ACS, this can be done with existing features and nicely wrapped up in a custom function for easy use.
Code: Select all
function bool SpawnSpotSpecial(str actorClass, int spotTID, int actorTID, int angle, int special, int arg0, int arg1, int arg2, int arg3, int arg4)
{
int tempTID = UniqueTID(0);
SpawnSpot(actorClass, spotTID, tempTID, angle);
if(ThingCount(0, tempTID) > 0)
{
SetThingSpecial(tempTID, special, arg0, arg1, arg2, arg3, arg4);
Thing_ChangeTID(tempTID, actorTID);
return true;
}
else
return false;
}
Code is untested+uncompiled, but the idea still stands. If your worry is performance, my philosophy here is to try it and see. Give the function a good stress test with more actors than you'll realistically use; chances are it'll be more performant* than you think.
Declaring user variables can be done in the same way if you know which uservars you're using -- which, as the modder, you should. :P
*Is "performant" actually a word, or just a Xaserism? :P
If you're already using ACS, this can be done with existing features and nicely wrapped up in a custom function for easy use.
[code]
function bool SpawnSpotSpecial(str actorClass, int spotTID, int actorTID, int angle, int special, int arg0, int arg1, int arg2, int arg3, int arg4)
{
int tempTID = UniqueTID(0);
SpawnSpot(actorClass, spotTID, tempTID, angle);
if(ThingCount(0, tempTID) > 0)
{
SetThingSpecial(tempTID, special, arg0, arg1, arg2, arg3, arg4);
Thing_ChangeTID(tempTID, actorTID);
return true;
}
else
return false;
}
[/code]
Code is untested+uncompiled, but the idea still stands. If your worry is performance, my philosophy here is to try it and see. Give the function a good stress test with more actors than you'll realistically use; chances are it'll be more performant* than you think.
Declaring user variables can be done in the same way if you know which uservars you're using -- which, as the modder, you should. :P
[size=70]*Is "performant" actually a word, or just a Xaserism? :P[/size]