[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 571: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 627: sizeof(): Parameter must be an array or an object that implements Countable
forum.starcraftai.com • Unit Image Changing
Page 1 of 1

Unit Image Changing

Posted: Sat Aug 18, 2012 12:07 pm
by Hydrolisk
Hello. I am looking for a reliable way to change a unit's graphic during a match, hopefully through plugins. As of this moment, the only method I can think of is giving the unit an order that causes it to run a specific iscript animation, and during that animation, hide the current overlay and replace it with another one.

However, this method requires a bit of extra overhead (such as the use of an orders.dat entry, which I find to be extremely involved in hardcoded processes and I feel that I only have so few controllable orders to use). Also, the order might run the risk of being cancelled by the player, which I would also not want.

I hope that someone can help me to use the render, draw, and update functions present in the image classes that I found in BWAPI's source, as they look fairly relevant.

Posted: Fri Aug 24, 2012 12:39 pm
by Hydrolisk
I have solved the previous issue, but I am now confronted with a new (but minor) one.

Apparently, iscript's "followmaingraphic" doesn't allow an image that uses it to follow the parent's frames besides the first frameset.

Anyone know a way around this or solution?

(What I have is a Zealot unit and a Zealot with wings GRP. Upon casting a spell, the Zealot unit spawns a Zealot with wings image, which uses followmaingraphic. The Zealot with Wings makes the unit look a bit awkward though, since it doesn't follow attack and walk animations. How to fix?)

Posted: Fri Aug 24, 2012 1:14 pm
by RavenWolf
Does your zealot with wings image have the same ammount of frames as the zealot?

followmaingraphic works well for shadows, may be its because its created in the cast spell animation instead in the init animation.

Another solution can be create a new iscrip for the zealot with wings. This will be an exact copy of the zealot iscrip except that you should remove the attack command and the overlay image in the castspell animation (you can also remove the sounds). The problem is that you will need 2 iscrip for each unit that will have this type of morph.

Posted: Fri Aug 24, 2012 1:29 pm
by Hydrolisk
I examined the iscript of the shadows just now and found that followmaingraphic needs to be called every frame in order to update.

I have implemented the fix and it is working fine now.