Page 1 of 1
Problem number two
Posted: Sun Jul 15, 2007 11:56 pm
by Tethys
hello its me once again i got another problem i wish someone will help
so i got problem with mobs. What is wrong? there is a bug, you can put into your backpack 1000 items(regs,gold coins etc) and when you'll die that mob(monster) will yoink everything from your body(and its ok) but that monster while yoinking items from body doesnt move ! if you attack him he doesnt move and he wont attack you. What should i do ? what i must change ?
Once again sorry for my English !
Thanks for help!
Posted: Sun Jul 15, 2007 11:58 pm
by OldnGrey
The function that yoinks out all the items is simply running through all the items without going back to the AI.
You will need to find where the looting is taking place and put in something that only allows it to loot 1 or 2 items before returning.
I don't know your scripts, so I can't give a more detailed response.
Posted: Mon Jul 16, 2007 7:55 am
by Tethys
OldnGrey wrote:The function that yoinks out all the items is simply running through all the items without going back to the AI.
You will need to find where the looting is taking place and put in something that only allows it to loot 1 or 2 items before returning.
I don't know your scripts, so I can't give a more detailed response.
Ok i found that function in scripts/ai/main/loot.inc
What should i add there ? i want to make it like that:
Monster will yoink everything in body BUT when monster will see player or tamed monster he will stop yoinking and he will attack player/tamed monster.
Posted: Mon Jul 16, 2007 3:26 pm
by OldnGrey
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.