I'm just getting into mapmaking, but I do have a programming background. I'm attempting to use a Unit Type array to create different units: indices in the array are populated with different Unit Types, so other triggers can easily create units with integers that correspond to the desired index.
I've made sure that the array and any local variables are being initialized correctly, and that the integers are what I want them to be (so nothing like out-of-bounds indexing is happening), but things still aren't working. Is there a reason why the following line wouldn't work?
CreatureTable is a global 2x2 Unit Type array, and CreatureNumber is a local integer assigned earlier in the code. Like I said, I've made sure that the array is properly populated, and that other variables seem correct. Any help would be greatly appreciated.
My guess would be that the mistake lays in the use of
(Positionof(Triggeringunit))
Do you have a Triggering Unit? The Triggering Unit is the unit which triggered the event. If there is no matching unit, Triggering Unit will resolve to null and therefore the position will be null aka invalid aswell, which would result in no unit getting created.
That did it! Thanks! But that leaves me with a new question. The triggering event is 'Any Unit dies'. Why would that leave the Triggering Unit as null? Shouldn't it be the dying unit? Thanks again.
That did it! Thanks! But that leaves me with a new question. The triggering event is 'Any Unit dies'. Why would that leave the Triggering Unit as null? Shouldn't it be the dying unit? Thanks again.
Yes, the triggering unit should be the dying unit. To solve your problem i need to see a more complete version of the script though.
I'm just getting into mapmaking, but I do have a programming background. I'm attempting to use a Unit Type array to create different units: indices in the array are populated with different Unit Types, so other triggers can easily create units with integers that correspond to the desired index.
I've made sure that the array and any local variables are being initialized correctly, and that the integers are what I want them to be (so nothing like out-of-bounds indexing is happening), but things still aren't working. Is there a reason why the following line wouldn't work?
CreatureTable is a global 2x2 Unit Type array, and CreatureNumber is a local integer assigned earlier in the code. Like I said, I've made sure that the array is properly populated, and that other variables seem correct. Any help would be greatly appreciated.
My guess would be that the mistake lays in the use of
Do you have a Triggering Unit? The Triggering Unit is the unit which triggered the event. If there is no matching unit, Triggering Unit will resolve to null and therefore the position will be null aka invalid aswell, which would result in no unit getting created.
@Mille25: Go
That did it! Thanks! But that leaves me with a new question. The triggering event is 'Any Unit dies'. Why would that leave the Triggering Unit as null? Shouldn't it be the dying unit? Thanks again.
Yes, the triggering unit should be the dying unit. To solve your problem i need to see a more complete version of the script though.
@Mille25: Go
Ah I figured it out. It was running an earlier version with a local variable rather than the Triggering Unit. Thanks again.
Alright, cool! Welcome to the community. :)