What's different?

For questions about using Classic.

Post » Tue May 31, 2011 1:32 am

Here's a cap file and associated array data (In Layout1 file). There are two groups, Create Units From Array, and Create Units for Testing, which are not created from an array. One group (Create Units From Array) works correctly, while the other does not.

The problem is this. The units belong to two teams, red and blue. The game works in rounds but in round one the Archer units (Princess Leia temporary graphics) can attack. If you click on the Archer unit, you see its radius highlighted in red, the units it can attack in blue, and the selected unit to attack in green. The unit should not be able to attack units on its own team.

The problem is that if I create the units using the Create Units from Array group, for whatever reason this check fails and the unit can attack all units including those on its own team (see wher ethe blue boxes appear), even though all the relevant variables (Sprite.Value('OccupiedByPrevious'), Units.Value('Team'), Sprite.Value('ID') and Units.Value('Home')) seem to take the correct values as shown in the DebugText red text box. If I use the Create Units For Testing group everything works fine.

Any idea what's going on? The function that draws the colored boxes is called Highlight Attack Targets.

http://dl.dropbox.com/u/30864403/Boardgame.zip
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue May 31, 2011 3:10 am

Ah figured this out finally, apparently the number was being saved as a string (used the 2d array utility to make the array, so either that has something to do with it or the fact that one row is strings makes the other be strings). In any case, int(ArrayValue) fixes it.
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue May 31, 2011 6:29 am

Yep, that utility only saves values as strings.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests