Send a use-packet on the XYZ of the dead creatureOriginally Posted by julinhopiupiu
Send a use-packet on the XYZ of the dead creatureOriginally Posted by julinhopiupiu
I tried to get the dead creature position but I failed.
The problem is when it's checking if the creature hpbar, when it send a creature.Attack() it execute the CreatureLocation()
It's something like this:
[code=csharp]foreach (Tibia.Objects.Creature creature in C.BattleList.GetCreatures())
{
if (P.TargetId == creature.Id)
{
if (!creature.IsSelf())
{
if (creature.HPBar == 0)
{
Looting = true;
int bodyX = creature.X;
int bodyY = creature.Y;
int bodyZ = creature.Z;
Location bodyloc;
bodyloc = new Location(Convert.ToInt16(bodyX), Convert.ToInt16(bodyY), Convert.ToInt16(bodyZ));
Thread.Sleep(1100);
Tile bodyloc2 = C.Map.GetTile(bodyloc);
Item deadbody = bodyloc2.Items.FirstOrDefault(Dead => Dead.GetFlag(DatItem.Flag.IsCorpse));
C.Map.GetTile(bodyloc).Items.Last().OpenAsContaine r(Convert.ToByte(C.Map.GetTile(bodyloc).Objects.La st().StackOrder));[/code]
Somebody help me xD
You're calling a method that only returns visible creatures:
[code=c#]
public IEnumerable<Creature> GetCreatures()
{
for (uint i = Addresses.BattleList.Start; i < Addresses.BattleList.End; i += Addresses.BattleList.StepCreatures)
{
if (client.Memory.ReadByte(i + Addresses.Creature.DistanceIsVisible) == 1)
yield return new Creature(client, i);
}
}
[/code]
Write your own method or edit this one to return all creatures
To open corpses you have to use the proxy or the hookproxy.
Both are bugged :S
@Alkamenes
There is a way to open dead bodies without proxy, I saw some examples and ideas here on forum, so its possible but not so easy.
@Blaster
Where should I use this code?
Is it a 'new function' to work on my GetCreatures() on this line?:
foreach (Tibia.Objects.Creature creature in C.BattleList.GetCreatures())
If not where should add it?
Thank you again.
I'd recommend that you learn how TibiaAPI works before using it, as the code I posted is from the TibiaAPI source
Read the code that I posted and edit it to fit your needs
Ohhh, now I see, it's a TibiaAPI function, I was on my job when I saw your post and I though that you made it.
If I change it to .DistanceHPBar should work? I'm not sure how to get a monster that is dead.
using DistanceHPBar == 0 would return all dead creatures, so make sure you find your creature as there will be more than one
That's the problem, get the creature that I'm attacking then get his dead body, because if I check my TargetID if I kill one creature it will attack another one, this way it will ignore the dead body.
I"m not sure how to get the creature that I"m attacking then get his dead body.
Experiment before asking.
Simple method of working it out:
Create a combobox or listbox, and a button. In the button event draw the list located at c.Inventory.Containers() into the listbox, then make another listbox / button and draw the contents of each backpack to the listbox according to which button you press.
You can then work out exactly how the inventory system is calculated and where to get the ids etc...[hr]
Ok heres a breif explaination of this, in VB.Net though. Sorry I don't do C# etc...Originally Posted by maozao
Set a timer.
[code=vbnet]Public Sub(ByVal e as Sender, ~~~) Handles Timer1.Tick
If p.Target Is Nothing Then '' If the target doesn't exist do this
'' Nothing
Else '' Else do the following
Dim x as Creature '' Declare that x is a Creature (located from TibiaAPI - Tibia.Objects
x = p.Target '' Give x the value of the target your character currently has.
Dim y as Location '' declare that y is a Location from Tibia.Properties
y = x.Location '' Declare that y is the location of the creature we declared to be x
End If '' End if statement
End Sub[/code] '' End the sub
Something like that, and you've got the location of your last dead creatures corpse. Then it's just a case of sending the "use" command to the tile location, and vualah! It should open up the container and you can then use the c.Inventory.GetItems commands to move the items dependant upon their Id and location. I also advise that for the looting to backpacks you use the BP ID's, but for the looting from backpacks use the container name. That way you can do like Dead Rotworm instead of container 3...
So that you know there is no way of identifying the creature Id a corpse came from after you've killed it. The cid is removed completely from the game at that point.