Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Clean0nion on January 15, 2014, 12:09:27 PM

Title: Guppies?
Post by: Clean0nion on January 15, 2014, 12:09:27 PM
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
[close]
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?
Title: Re: Guppies?
Post by: eduran on January 15, 2014, 12:38:58 PM
Remove the "" from CONST_AMMO/MAXAMMO and try again.
Title: Re: Guppies?
Post by: Clean0nion on January 15, 2014, 12:54:21 PM
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.
Title: Re: Guppies?
Post by: Annonymus on January 16, 2014, 08:46:02 AM
The white bar appears because you also refill it with anti-creeper.