You will need to study your scripts a lot more before you can work out where to make the change. My scripts are going to be different to yours.
In this example the code is part of my AI mainloop for things the kill players.
Each npc has a mainloop and repeats as long as the npc is alive. It just waits for events, does them and then repeats.
Code: Select all
if ( ReadGameClock() > next_look_around )
look_around();
if ( IAmALooter() )
for i := 1 to RandomInt(3) + 2
GrabLoot();
endfor;
endif
next_look_around := ReadGameClock() + 30;
endif
This is an example of what I did to mine. As you can see, the loot function is called a random number of times (between 2 and 4 times). The next_look_around variable just sets how often it can loot (in this case every 30 seconds)
The grabloot function searches the area looking for things to loot, runs to the object and it takes 1 item and then prints *yoink* above its head.
These value work okay for me. It allows the npc to find your corpse, run over to it, loot a couple of items, then be aware of other events (like something else coming into range or being attacked). If it survives those events it will then resume looting 2 - 4 items. In this way one or more npcs will loot your corpse clean in a few minutes but they will still respond to events happening around them.