I'm trying to refuel a Guppy via CRPL. My current code is as follows:
Spoiler
$radius:5
$delay:5
$amount:0.01
$unitType:"GUPPY"
once
# Images, vars, consts, etc
Self CONST_NULLIFIERDAMAGEAMT 0.5 SetUnitAttribute
endonce
CurrentCoords <-radius GetUnitsInRange 0 do
->uid
<-uid GetUnitType <-unitType eq <-uid "CONST_AMMO" GetUnitAttribute <-uid "CONST_MAXAMMO" GetUnitAttribute neq and if
<-uid "CONST_AMMO" <-uid "CONST_AMMO" GetUnitAttribute <-amount add SetUnitAttribute
endif
loop
<-delay Delay
:Destroyed
FailMission
This produces a white ammo bar above the guppy pad. If a destination is set, the guppy then flies away as if it were full of ammo, but there is no ammo in either the guppy or the pad. When the guppy lands, it immediately returns to base, only to be sent back out again.
Therefore, I'm assuming that CONST_AMMO is not a suitable CONST_ for a guppy - after all, there are two ammo reserves! Can anyone help me with this?
Quote from: eduran on January 15, 2014, 12:38:58 PM
Remove the "" from CONST_AMMO/MAXAMMO and try again.
Oh wow, did I seriously do that? Wow. That was bad. Thanks, eduran.