Post tutorial RSS Unit morph for all units

There are problem in firegraft: Unit morphing aborts if you try to do it from any unit, different from larva, hydralisk, or mutalisk. This tutorial explains how to fix this bug.

Posted by on - Advanced Server Side Coding

For Example - in Gravity mod Ultralisk - next stage of zergling development. Zergling, actualy, can't morph, cause it has no specific coocoon unit. However it can be fixed trough firegraft/stardraft plugins. I've used GPTP 2.4 to allow zergling morph. You should download GPTP 2.4, and Firegraft 1.16.1 to mess with this:
1) Open project. Go to "unit_morph.cpp", and after lines:

  if (unit->id == UnitId::larva || unit->id == UnitId::mutalisk) {
    if (unit->canMakeUnit(morphUnitId, *ACTIVE_NATION_ID) == 1) {
      return true;

paste this:

  if ( unit->id == UnitId::ZergZergling )
	  if (unit->canMakeUnit(morphUnitId, *ACTIVE_NATION_ID) == 1 )
		  return true;

2) This were procedure checking abilitu to morph. But it is not enough to fix all - most morphing units has their specific cocoon unit. To select it for zergling - go lower to:

if (unitId == UnitId::hydralisk )
    return UnitId::lurker_egg;

Replace this by:

if (unitId == UnitId::hydralisk || unitId == UnitId::zergling )//Secondary Coocoon
    return UnitId::lurker_egg;

3) After this you may compile your plugin. Zerling will be able to morph in any other zerg unit. Actualy that was all coding part. If you know about dat requiments you needn't to explain the rest. But there is a small thing, usefull to know:


4) Zerg don't do abortions. Also, in real life (insects, or amphibous) metamorphose once started can't get interrupted. So, open Firegraft/button sets, and select button set 17 (Egg/Cocoon); in lower right side of window you can se list of units using it. By doubleclick on unit you can go to unit options page in firegraft. For each morph unit must be selected button set "None". This need to avoid 2 bugs in one time: 1st - connection between unit's native hatchery (after morphing unit will run to hatchery's rally point), and second - changing unit type on cancel (you tried to morph queen in matriarch, and when cancelled - got mutalisk).



Very nice to know, thank you!

Reply Good karma Bad karma+2 votes

i downloaded gptp, how do i compile a plugin?

Reply Good karma Bad karma+1 vote
Evenmore Author

You need program to work with Visual C++.

Reply Good karma+1 vote

This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Related Games
StarCraft Real Time Strategy
Related Groups
Blizzard Entertainment
Blizzard Entertainment Developer & Publisher