Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: piggood on May 22, 2019, 05:09:12 AM

Title: Code For Infinite Ammo THOR Not Working
Post by: piggood on May 22, 2019, 05:09:12 AM
I wanted to make a Infinite ammo THOR
But The tracelog was saying
WARNING: Taking Item From An Empty Stack
GETALLUNITSINRANGE at line 5
QuoteShowTraceLog
   do (GetAllUnitsInRange(0 0 9999) 0)
      ->unit
      if (GetUnitType(<-unit) eq("THOR"))
         <-count add(1) ->count
      <-unit trace
      endif
   <-unit CONST_MAXAMMO GetUnitAttribute ->YEE
<-unit CONST_AMMO <-YEE SetUnitAttribute
   loop
Title: Re: Code For Infinite Ammo THOR Not Working
Post by: GoodMorning on May 22, 2019, 06:08:51 AM
GetAllUnitsInRange has a fourth parameter.
Quote from: piggood on May 22, 2019, 05:09:12 AM
do (GetAllUnitsInRange(0 0 9999 0) 0)
   ->unit
   if (GetUnitType(<-unit) eq("THOR"))
      <-count add(1) ->count
   <-unit trace
   endif
   <-unit CONST_MAXAMMO GetUnitAttribute ->YEE
   <-unit CONST_AMMO <-YEE SetUnitAttribute
loop
Title: Re: Code For Infinite Ammo THOR Not Working
Post by: Builder17 on May 22, 2019, 10:18:36 AM
Quote from: GoodMorning on May 22, 2019, 06:08:51 AM
GetAllUnitsInRange has a fourth parameter.
do (GetAllUnitsInRange(0 0 9999 0) 0)
->unit
if (GetUnitType(<-unit) eq("THOR"))
<-count add(1) ->count
<-unit trace
<-unit CONST_MAXAMMO GetUnitAttribute ->YEE
<-unit CONST_AMMO <-YEE SetUnitAttribute
        endif
loop


Also you might want to put endif after where it sets ammo to maximum. :)

once
Self CONST_NULLIFIERDAMAGES FALSE SetUnitAttribute
Self CONST_TAKEMAPSPACE FALSE SetUnitAttribute
Self CONST_SUPPORTSDIGITALIS FALSE SetUnitAttribute
Self CONST_COUNTSFORVICTORY FALSE SetUnitAttribute
        Self "main" "None" SetImage
endonce


Putting this on beginning of code makes it invisible and non-enemy/blocking/damage-able.