HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Any ways to detect "Build more farms/etc."?

09-12-2009, 01:09 AM#1
ToukoAozaki
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
Bobo_The_Kodo
food cost > food max - food used ?
09-12-2009, 01:51 AM#3
ToukoAozaki
Quote:
food cost > food max - food used ?

I need an event...
09-12-2009, 02:29 AM#4
Bobo_The_Kodo
I was giving you a possibility because there IS NO EVENTS to do that .
09-12-2009, 02:56 AM#5
ToukoAozaki
Quote:
Originally Posted by Bobo_The_Kodo
I was giving you a possibility because there IS NO EVENTS to do that .

Quote:
Originally Posted by Bobo_The_Kodo
food cost > food max - food used ?

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
0zyx0
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
ToukoAozaki
Quote:
Originally Posted by 0zyx0
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.

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
TKF
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
Troll-Brain
Quote:
However, I need to detect the case when the production stops
You mean when the structure is paused/stunned ?
09-12-2009, 09:24 PM#10
ToukoAozaki
Quote:
Originally Posted by TKF
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.

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:
Originally Posted by Troll-Brain
You mean when the structure is paused/stunned ?
Oh, I wasn't even thinking of that variable... That should also be needed. Maybe I just give up the whole idea and just submit smaller utility parts...
09-12-2009, 10:36 PM#11
Troll-Brain
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
ToukoAozaki
Quote:
Originally Posted by Troll-Brain
Try with (current) orders.
Also when an unit is paused/stunned and wasn't already stunned/paused, the unit get the order 851973

Current order is 0 regardless of production state.