r/ComputerCraft • u/NoahClone66 • May 11 '20
Peripherals++ nano swarm help
I’m currently trying to figure out how to use mostly the nano swarm from peripherals++. I am trying to first find out how to do the commands which I found. But the getInfectedEntity is asking for a number not a string so I’ll pan it out for you right below (I’m trying to use an example code from another thread)
antenna = peripheral.wrap(“top”)
Zombie = antennae.getInfectedEntity(“Zombie”)
Zombie.heal()
When ran it returns
Program:3: Bad argument #1 (expected number)
This is confusing as I’ve tried a lot of numbers and even the “entity ID” of a zombie (52:54) and tried the : doesn’t work so I tried 52.54 nothing happened I also tried just 54 and just 52. I looked into the Minecraft wiki and tried 32 didn’t work. So I’m more or less asking what is supposed to be there.
Some rules for answering A. Do not refer me to the wiki with no explanation- that does not help me B. Do not give me a code that does not have a physical ID- I more than have the actual code down but cannot wrap my head around what the number is supposed to be C. If you give me a code PLEASE try to test it- I would like to not have to tinker with the code and if it is a theoretical code please state that
Sorry for the wall of text though I think it can help get me the best answer possible not able to be explained by other threads
1
u/ImNotADeer May 12 '20
https://peripheralsplusplus.readthedocs.io/en/latest/peripherals/antenna/
https://peripheralsplusplus.readthedocs.io/en/latest/miscellaneous_additions/nano_swarm/
According to the docs getInfectedEntity() takes an entityID (a number) as an argument, these are probably unique IDs for each infected entity and has nothing to do with the minecraft entity ID.
getInfectedEntites() returns a table of entityIDs, so I would suggest looping through this table and search for zombies:
for i, entityID in antennae.getInfectedEntites() do
entity = antennae.getInfectedEntity(entityID)
if entity.getEntityName() == "Zombie" then
entity.heal()
end
endNow, I have never touched peripherals++ and haven't touched computercraft in years, but this is how I understand the docs. The entity name may not be "Zombie" so that may need to change but the general concept should work.
1
u/NoahClone66 May 12 '20
Since the nano swarm is not a block you cannot wrap it as a normal peripheral instead you have to use the getInfectedEntity and wrap it to that. It’s annoying but that’s how it is but do you know what the numbers for the entities could be? That’s the main problem I’m having
1
u/dragon53535 May 12 '20
The error is Program:3: as in Line 3, as in Zombie.Heal() requires a number