| 09-12-2009, 01:09 AM | #1 |
I'm trying to make a system which can return current train/revival progress percentage... However, I need to detect the case when the production stops, in order to prevent irrelevant cancels from resetting the timer. Any ideas on this? |
| 09-12-2009, 01:48 AM | #2 |
food cost > food max - food used ? |
| 09-12-2009, 01:51 AM | #3 | |
Quote:
I need an event... |
| 09-12-2009, 02:29 AM | #4 |
I was giving you a possibility because there IS NO EVENTS to do that . |
| 09-12-2009, 02:56 AM | #5 | ||
Quote:
Quote:
This is impossible because you'll never know which unit is currently on the front of the queue. |
| 09-12-2009, 06:15 AM | #6 |
Isn't there an event that is fired when a player's food reaches a certain amount? I believe it can be registered by native TriggerRegisterPlayerStateEvent (trigger whichTrigger, player whichPlayer, playerstate whichState, limitop opcode, real limitval) returns event. Use PLAYER_STATE_RESOURCE_FOOD_CAP or PLAYER_STATE_RESOURCE_FOOD_USED as whichState. |
| 09-12-2009, 06:13 PM | #7 | |
Quote:
The message will fire (or unit production will not continue) if USED + x > CAP. The problem is I can't get x, because it is a variable. |
| 09-12-2009, 06:24 PM | #8 |
You need a variable which stores how long the unit take to produce, the costs, unit type and a timer. It's quite complex but that's how it's done in supreme commander. |
| 09-12-2009, 06:51 PM | #9 | |
Quote:
|
| 09-12-2009, 09:24 PM | #10 | ||
Quote:
Every elements are in place, except "what is in the front of the queue" and/or "which item has been cancelled." Since user can cancel any item in the queue, and there is no way to get which item was cancelled, there's no way to reproduce the queue whatsoever. The problem is this. There is a production queue of units, say, footmen. While in production of a unit, food used becomes (food cap + 1). If the user cancels the currently trained footman, food use would go (food cap - 1) and there's not enough food to train the next footman, thus training stops. This leaves no event other than train cancel event. The problem is, I'm trying to differentiate whether the cancelled unit is on the front of queue here; just train cancel event doesn't tell anything about that. This is important because I need to reset the timer to keep track of progress correctly if currently trained unit gets cancelled. Quote:
|
| 09-12-2009, 10:36 PM | #11 |
Try with (current) orders. Also when an unit is paused/stunned and wasn't already stunned/paused, the unit get the order 851973 |
| 09-13-2009, 01:36 AM | #12 | |
Quote:
Current order is 0 regardless of production state. |
