| 07-01-2007, 03:42 PM | #1 |
Is there a way to get the unit type is being trained ? I see only this damn crazy boring thing : Give for each type of unit a different cost of food and then guess wich unit type is being trained, and finally set the unit food to the wanted value |
| 07-01-2007, 03:59 PM | #2 |
| 07-01-2007, 04:13 PM | #3 |
No i said being trained not finish trained ![]() If it was so easy i wouldn't ask it ... |
| 07-01-2007, 04:22 PM | #4 |
| 07-01-2007, 04:40 PM | #5 |
Trained unit == null with this event ![]() so this is very useless Just read the comment in gui with this function and please stop thinking im so stupid. Thx |
| 07-01-2007, 04:51 PM | #6 |
| 07-01-2007, 04:55 PM | #7 |
No, no and no. // EVENT_PLAYER_UNIT_TRAIN_FINISH constant native GetTrainedUnit takes nothing returns unit this works only with this event ... |
| 07-01-2007, 04:56 PM | #8 |
| 07-01-2007, 05:05 PM | #9 |
Hmm had you really try it ? It doesn't works for me ... Trigger: It displays : Unit = 0 Unit Type = 0 |
| 07-01-2007, 05:17 PM | #10 |
| 07-01-2007, 05:56 PM | #11 |
JASS:function Trig_D__clencheur_sans_titre_001_Conditions takes nothing returns boolean if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hpea' ) ) then return false endif return true endfunction function Trig_D__clencheur_sans_titre_001_Actions takes nothing returns nothing call DisplayTextToForce( GetPlayersAll(), "aha" ) call DisplayTextToForce( GetPlayersAll(), GetUnitName(GetTrainedUnit()) ) endfunction //=========================================================================== function InitTrig_D__clencheur_sans_titre_001 takes nothing returns nothing set gg_trg_D__clencheur_sans_titre_001 = CreateTrigger( ) call TriggerRegisterUnitEvent( gg_trg_D__clencheur_sans_titre_001, gg_unit_htow_0000, EVENT_UNIT_TRAIN_START ) call TriggerAddCondition( gg_trg_D__clencheur_sans_titre_001, Condition( function Trig_D__clencheur_sans_titre_001_Conditions ) ) call TriggerAddAction( gg_trg_D__clencheur_sans_titre_001, function Trig_D__clencheur_sans_titre_001_Actions ) endfunction I convert it in jass cause the gui is not in english It displays "aha" and nothing else And see that : ![]() sorry but it really doesn't work for me. GetTrainedUnit() == null in all case. I've tried what you said So please attach a map and i will try |
| 07-01-2007, 06:12 PM | #12 |
I will put it in Jass, so language does not stop you: JASS:GetTrainedUnitType() //This will return the unit-type for a begins/cancels/finishes training event. GetTrainedUnit() //This returns the actual unit, which does not exist until the finishes training event. //Things are so much easier in JASS. |
| 07-01-2007, 06:13 PM | #13 |
Build a peasant in the test map and you will see. Peasant Test.w3x |
| 07-01-2007, 06:45 PM | #14 |
Ok thx. GetTrainedUnitType() is the function i wanted. sorry i didn't search in jass, only in gui ... And i didn't see (Trained unit type) @ Hitenchist : the problem wasn't the event but how to get the unit type. Next time i will see better that, before ask for something so easy >.< |
