| 02-21-2010, 02:36 AM | #1 |
This is from an RPG map I'm making with turn-based combat. When a battle starts, players and enemies join up on a battle field. I wanted to nicely line up enemy and player units. In code, Enemies and Players in a battle are referred to as Fighters. When a Fighter joins a battle, it is positioned into the next available slot. That code looks like this: Zinc:method Position() { Battle b = GetUnitUserData(m_Unit); integer i; if(m_IsPlayer) { i = b.m_PlayerLocationsUsed; SetUnitPosition(m_Unit, b.m_PlayerLocationX[i], b.m_PlayerLocationY[i]); SetTextTagPos(m_ATBDisplay, b.m_PlayerLocationX[i], b.m_PlayerLocationY[i], 0); DMsg("Took player pos " + I2S(b.m_PlayerLocationsUsed)); b.m_PlayerLocationsUsed += 1; } else { i = b.m_EnemyLocationsUsed; SetUnitPosition(m_Unit, b.m_EnemyLocationX[i], b.m_EnemyLocationY[i]); SetTextTagPos(m_ATBDisplay, b.m_EnemyLocationX[i], b.m_EnemyLocationY[i], 0); DMsg("Took player pos " + I2S(b.m_EnemyLocationsUsed)); b.m_EnemyLocationsUsed += 1; } } All abilities in the map are the dummy channel ability with unique order IDs and all abilities are handled completely manually, including damage. Targeted with point, the map will cast that ability on all of the enemies or players, depending on which unit you clicked closest to. The ability system waits for an order Id, with or without a target unit, before an ability gets used. The problem is, with this code in place, all abilities set to Target only no longer cast. The ability's icon stays with its golden border and never triggers in-game. Point abilities usually work depending on where I click. Point or Unit abilities usually work if I don't click on a unit. Target only abilities work if I click on player, but not an enemy. If this paragraph is confusing, take it to mean it's all fucked up and what works is basically random, but usually works fine around players. SetUnitPositionLoc and SetUnitX/Y all show the same stupid behavior. It all works perfectly if I take out the call to Position. I don't understand. At all. |
