hekx Posted March 12, 2020 Posted March 12, 2020 hey all. I'm writing a combat script for me to just afk fight the wizards outside Draynor village. The only problem is if I die. I need a way of detecting if I am dead so I can then walk myself from spawn to where the wizards are and fight them again?
Sib Posted March 12, 2020 Posted March 12, 2020 You can check if message contains "You're dead" or what ever it says and/or check if lumbridge spawn area contains your position 1
Gunman Posted March 12, 2020 Posted March 12, 2020 Check if hp = 0, chatbox message says you died, the death interface pops up, position is in lumbridge, etc. 1
hekx Posted March 12, 2020 Author Posted March 12, 2020 I've tried the chat method and its not working for me. At least I'm pretty sure it isn't. My script is absolutely crapped out right now
mousbros Posted March 12, 2020 Posted March 12, 2020 (edited) this is not really good but it works and its noob friendly what youre doin here is youre checking if youre in the specific area so where you gonna be when your dead and then youre gonna walk back to the goblins so (the areas is not good you should do it yourself thats one x and y coardinate tile from bottom left to top right when your looking north) final Area LUMBRIDGE_AREA = new Area (2982,3233,2990,3242); final Area GOBLIN_AREA = new Area (x,y,x,y); if (LUMBRIDGE_AREA .contains(myPosition()){ getWalking().webWalk(GOBLIN_AREA); } Edited March 12, 2020 by mousbros
hekx Posted March 12, 2020 Author Posted March 12, 2020 2 hours ago, mousbros said: this is not really good but it works and its noob friendly what youre doin here is youre checking if youre in the specific area so where you gonna be when your dead and then youre gonna walk back to the goblins so (the areas is not good you should do it yourself thats one x and y coardinate tile from bottom left to top right when your looking north) final Area LUMBRIDGE_AREA = new Area (2982,3233,2990,3242); final Area GOBLIN_AREA = new Area (x,y,x,y); if (LUMBRIDGE_AREA .contains(myPosition()){ getWalking().webWalk(GOBLIN_AREA); } I'll try this, thankyou so much, it doesn't have to be pretty, just has to work
BravoTaco Posted March 12, 2020 Posted March 12, 2020 (edited) 10 hours ago, hekx said: hey all. I'm writing a combat script for me to just afk fight the wizards outside Draynor village. The only problem is if I die. I need a way of detecting if I am dead so I can then walk myself from spawn to where the wizards are and fight them again? No need to check if your dead. Just check to see if the wizards are nearby, if not walk to the wizard area. Area wizardArea = new Area(0, 0, 0, 0); // Set this to the area of the wizards. String wizardName = "PlaceNameHere"; NPC wizard = getNpcs().closest(npc -> npc.getName().equalsIgnoreCase(wizardName) && npc.isAttackable()); // If the wizard is null and you are not in the area walk to the area. // Else If you are in the area and there is no available wizard and you are currently on a p2p world than hop to a p2p world. // Else If you are in the area and there is no available wizard and you are currently on a f2p world than hop to a f2p world. if (wizard == null && !wizardArea.contains(myPlayer())) getWalking().webWalk(wizardArea); else if (wizardArea.contains(myPlayer())) if (getWorlds().isMembersWorld()) getWorlds().hopToP2PWorld(); else getWorlds().hopToF2PWorld(); Edited March 12, 2020 by BravoTaco
Apaec Posted March 13, 2020 Posted March 13, 2020 Checking if you are in Lumbridge is not necessarily a good solution - what if the user has their spawn point set to Falador for example? A much more flexible solution would be to check your HP. If you've hit 0 hp, that's the definition of death in OSRS, so that's probably your best bet. -Apa 1
botelias Posted March 27, 2020 Posted March 27, 2020 Or check if not wearing gear, don't think most ppl go and kick wizards