hao_magican
Mr & Ms Pac-Man
- 14/8/05
- 225
- 0
Có ai cho em bít sao script của em có lúc tự động dí khi hết HP, nhưng lại có lúc ko tự dí vậy???
làm em bị mất hết 2 con đệ!! hic hic
Mong mọi người sửa dùm em
hic
làm em bị mất hết 2 con đệ!! hic hic
var state = ""
var ghost_count = 0;
var DisconnectFlag = 0.3;
var hpFraction = 0.8;
var spFraction = 0.8;
function onNPCAppear(npcmapid,x,y)
{
ts.ClickOnNPC(npcmapid)
ts.ClickOnNPC(npcmapid)
}
function MyAttack(){
m = findMonster()
n = MonsterAlive()
sk = SkillID("Attack");
ts.SendAttack(
ts.Character.Row
, ts.Character.Col
, m.Row
, m.Col
, sk
)
ts.Character.MAXHP = 355
}
function MyPartnerAttack(){
m = findMonster()
sk = SkillID("Attack");
ts.SendAttack(
ts.CurrentPartner.Row
, ts.CurrentPartner.Col
, m.Row
, m.Col
, sk
)
ts.CurrentPartner.MAXHP =601
}
function BattleStarted(){
}
function BattleStoped(){
AutoEatHPSP()
CheckDisconnect();
//ts.ClickOnNPC(1)
}
function onEvilGod(){
ghost_count++
debug("E V I L G O D."+"["+ghost_count+"]",0x0000FF)
}
function onLuckyGod(){
debug("LUCKY G O D.",0xFF0000)
}
function OnTimer(){
}
function FinishAnswerFuckGod(){
if(ghost_count>=3){
ts.Disconect();
}
}
function Start(){
// no remove this function
}
function Stop(){
// no remove this function
}
function doEatHP(order,difHp){
for(var i = 1;i<= 25 ;i++){
var oSlot = ts.MyItems.Item(i)
var oItem = ITEMS.Item(oSlot.itemid)
if ((oSlot.itemid == 0) || (oSlot.itemid == 26223)) { continue; }
if(oItem.isHPItem()){
if (oItem.itemvalue > difHp){ continue; }
var eatHpAmt = (difHp - (difHp % oItem.itemvalue)) / oItem.itemvalue
if (eatHpAmt> 0){
if (eatHpAmt > oSlot.num){eatHpAmt = oSlot.num; }
ts.EatItem(i,eatHpAmt,order)
debug( "•"+oItem.itemname+" HP "+oItem.itemvalue+"at slot "+i+" decrease "+eatHpAmt+"•" ,0xC08008 )
difHp = difHp - eatHpAmt * oItem.itemvalue
}
}
}
}
function doEatSP(order,difSp){
for(var i = 1;i<= 25 ;i++){
var oSlot = ts.MyItems.Item(i)
var oItem = ITEMS.Item(oSlot.itemid)
if (oSlot.itemid == 0){ continue; }
if(oItem.isSPItem()){
if (oItem.itemvalue > difSp){ continue; }
var eatSpAmt = (difSp - (difSp % oItem.itemvalue)) / oItem.itemvalue
if (eatSpAmt> 0){
if (eatSpAmt > oSlot.num){eatSpAmt = oSlot.num; }
ts.EatItem(i,eatSpAmt,order)
debug( "•"+oItem.itemname+" SP "+oItem.itemvalue+"at slot "+i+" decrease "+eatSpAmt+"•" ,0xC08008 )
difSp = difSp - eatSpAmt * oItem.itemvalue
}
}
}
}
function AutoEatHPSP() {
var bRet=true;
if (ts.Character.HP < (ts.Character.MAXHP * hpFraction)){
doEatHP(0,(ts.Character.MAXHP)-ts.Character.HP)
}
if (ts.Character.SP < (ts.Character.MAXSP * spFraction)){
doEatSP(0,(ts.Character.MAXSP)-ts.Character.SP)
}
if (ts.CurrentPartner.HP < (ts.CurrentPartner.MAXHP * hpFraction)){
doEatHP(ts.CurrentPartner.Order,(ts.CurrentPartner.MAXHP )-ts.CurrentPartner.HP)
}
if (ts.CurrentPartner.SP < (ts.CurrentPartner.MAXSP * spFraction)){
doEatSP(ts.CurrentPartner.Order,(ts.CurrentPartner.MAXSP )-ts.CurrentPartner.SP)
}
}
function CheckDisconnect(){
if(ts.Character.HP < 100
|| ts.CurrentPartner.HP < 100
){
ts.Disconect();
}
}
function AutoSendItem(playerid)
{
for(var i=1;i<=25;i++)
{
var oSlot = ts.MyItems(i);
var oItem = ITEMS.Item(oSlot.itemid);
if( oSlot.itemid == 0){ continue; }
if (oSlot.num >= 50)
{
debug("Item " + oItem.getName() + " already full(" + oSlot.num + ").")
debug("Automatic Send To (" + playerid + ")")
ts.SendItemTo(00098424, oSlot.slot, oSlot.num)
break;
}
}
}
function AcceptedParty(playerid){
// If you not understand No change anything in this function
for(var i=0;i<PartyFriends.length;i++){
if(playerid == PartyFriends){
ts.AcceptParty(playerid)
if(playerid == DefaultSena){
ts.sena(playerid)
}
break;
}
}
}
function InitBot(){
SetPartyFriend("Cafe")
SetPartyFriend("DisneyM")
SetPartyFriend("friend name")
SetPartyFriend("friend name")
SetSena("DisneyM")
//Sit()
//Start()
//ts.ClickOnNPC(1)
}
InitBot()
Mong mọi người sửa dùm em
hic


