HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

quick question about food cost

02-03-2008, 05:04 AM#1
SockSquirrelMouthwash
I have a timed life unit that is created via dummycast summoning spell and when it is created it does not take up 1 food cap. I have it edited in the object editor that the food cost for that unit is set to 1. Yet when the unit is created it does not take up 1 food cap... any ideas? Is this something I would have to trigger manually or am I missing some setting that enables/disables that unit to take up food supply?
02-03-2008, 05:46 AM#2
Malf
Summoned units do not use up food, if I remember correctly.
02-03-2008, 06:04 AM#3
Pyrogasm
You'll need to make the spell not summon any unit and do this instead:
Trigger:
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
(Ability being cast) equal to <Your Ability>
Collapse Actions
Set TempPoint = (Position of (Triggering Unit))
Set TempPoint2 = (TempPoint offset by 150.00 towards (Facing of (Triggering Unit)) degrees)
Unit - Create 1 <Your Unit> at TempPoint2 facing (Facing of (Triggering Unit)) degrees
Unit - Add a <Your Duration> second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TempPoint2)
02-03-2008, 01:07 PM#4
SockSquirrelMouthwash
Quote:
Originally Posted by Pyrogasm
You'll need to make the spell not summon any unit and do this instead:
Trigger:
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
(Ability being cast) equal to <Your Ability>
Collapse Actions
Set TempPoint = (Position of (Triggering Unit))
Set TempPoint2 = (TempPoint offset by 150.00 towards (Facing of (Triggering Unit)) degrees)
Unit - Create 1 <Your Unit> at TempPoint2 facing (Facing of (Triggering Unit)) degrees
Unit - Add a <Your Duration> second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TempPoint2)

That's pretty much what my code is:
Collapse JASS:
    call CreateNUnitsAtLoc( 1, unitid, Player(n-1), p, 0 )
    call UnitApplyTimedLife(GetLastCreatedUnit(), 'BTLF', I2R(GetUnitPointValue(GetLastCreatedUnit())))

Disregard the n-1 part... It's not really summoned, just a created unit with a generic timed life applied

UPDATE: Turns out the UnitApplyTimedLife actually prevents the said unit from taking up food towards the food cap.... is there any way around this? or do I just have to make a separate dummyunit that has timed life?
02-04-2008, 02:55 AM#5
colderduck
I haven't done triggers in a while, so I might be doing this a bit wrong, but I think its kinda simple.
You would need 3 variables (2 unit variables with arrays and an integer) and you would need to use custom values.
So basically, similarly like pyrogasm's way. You would add
Trigger:
Actions:
set summonedunit[x] = (Last created unit)
Unit - Set the custom value of (Last created unit) to x
Unit - Create 1 <dummy unit> for (Owner of (casting unit)) at ((position of casting unit) offset by 150.00 towards (Facing of (casting unit)) degrees) facing (Facing of (casting Unit)) degrees))
Unit - Set the custom value of (Last created unit) to x
set dummyunit[x] = (last created unit)
set x = x+1
now you need a new trigger:
Trigger:
Collapse Events:
Unit - A unit dies
Conditions:
Actions:
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
unit - type of (dying unit) equal to <summoned unit>
Collapse Then - Actions
unit - remove dummyunit[custom value of (dying unit)]
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
unit - unit type of (dying unit) equal to <dummy unit>
Collapse Then - Actions
unit - kill summonedunit[custom value of (dying unit)]
Else - Actions
So this trigger would basically check whenever a unit dies, if its the summoned unit, it removes the dummy unit. If its the dummy unit, it kills the summoned unit.