Code For Infinite Ammo THOR Not Working

Started by piggood, May 22, 2019, 05:09:12 AM

Previous topic - Next topic

piggood

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

GoodMorning

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
A narrative is a lightly-marked path to another reality.

Builder17

#2
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.