thaibao113
Youtube Master Race
- 11/11/05
- 7
- 0
- Banned
- #681
Mấy pro xem dùm em lại cai đoạn scprit này đc ko,đây là đoạn scprit của chủ đánh ở HC,nhưng ko hiểu sao khi log chủ pt vào no chưa pt đc đã vào đánh rồi mặc dù em chưa gọi call time
var ghost_count = 0;
var god_count = 0;
var die_count = 0;
var pet_die_count = 0;
var battle_count = 0;
var DisconnectFlag = 0.3;
var HealingFlag = 0.5;
var hpFraction = 0.8
var spFraction = 0.8
var state = " "
var ptNumber = 0;
var p1=0
var p2=0
var p3=0
var p4=0
function MyAttack(){
m = findMonster()
if (ts.Character.SP > 30){
sk = SkillID("Attack");
}else{
debug("Depend",0xAA00AA)
sk = SkillID("Attack");
}
ts.SendAttack(
ts.Character.Row
, ts.Character.Col
, m.Row
, m.Col
, sk
)
}
function MyPartnerAttack(){
m = findMonster()
if (ts.CurrentPartner.SP > 0){
sk = SkillID("Attack");
}else{
debug("Depend",0xAA00AA)
sk = SkillID("Attack");
}
ts.SendAttack(
ts.CurrentPartner.Row
, ts.CurrentPartner.Col
, m.Row
, m.Col
, sk
)
}
function BattleStarted(){
battle_count++;
}
function BattleStoped(){
SaveWarrior();
CheckDisconnect();
EatHP()
EatSP()
ViewState()
}
function EatHP(){
if (ts.Character.HP < (ts.Character.MAXHP * hpFraction)){
doEatHP(0,(ts.Character.MAXHP * hpFraction)-ts.Character.HP)
}
if (ts.CurrentPartner.HP < (ts.CurrentPartner.MAXHP * hpFraction)){
doEatHP(ts.CurrentPartner.Order,(ts.CurrentPartner.MAXHP * hpFraction)-ts.CurrentPartner.HP)
}
}
function EatSP(){
if (ts.Character.SP < (ts.Character.MAXSP * spFraction)){
doEatSP(0,(ts.Character.MAXSP * spFraction)-ts.Character.SP)
}
if (ts.CurrentPartner.SP < (ts.CurrentPartner.MAXSP * spFraction)){
doEatSP(ts.CurrentPartner.Order,(ts.CurrentPartner.MAXSP * spFraction)-ts.CurrentPartner.SP)
}
}
function ViewState(){
debug("************************************",0xFF0000)
debug(" Battle Count : " + battle_count ,0xFF0000)
debug(" Dead Count : " + die_count ,0xFF0000)
debug(" Pet KO Count : " + pet_die_count, 0xFF0000)
debug(" Lucky Count : " + god_count, 0xFF0000)
debug(" Ghost Count : " + ghost_count,0xFF0000)
debug(" Warrior's FAI : " + ts.CurrentPartner.CharName +" : " + ts.CurrentPartner.fai,0xFF0000)
debug("************************************",0xFF0000)
}
function SaveWarrior(){
if(ts.CurrentPartner.HP< ((0.20) * ts.CurrentPartner.MAXHP)){
ts.Disconect();
debug(" SAVE THE FAI DISCONNECT NOW! : ",0x0000FF);
}
}
function YeWarpLink(){
if (ts.Character.mapid == 12063) {
ts.Walk(562,315) // walk to the gate
ts.delay(2000)
ts.Warp(2)
} else if (ts.Character.mapid == 12301) {
ts.Walk(202,555) // walk to the gate
ts.delay(2000)
ts.Warp(1)
}
}
function warpFinish(){
if (state == " ") {
YeWarpLink()
} else if (state == "stop") {
ts.SendAction(47) //sit down
}
}
function NpcDialogMenu(DialogId){
debug("DialogM "+DialogId,0x0000FF)
if(DialogId==1){
ts.SelectChoice(1);
ts.SendEnd();
}
}
function NpcDialog(DialogId){
debug("DialogN "+DialogId,0x0000FF)
if(DialogId==14305){
ts.SendEnd();
}
if(DialogId==10021){
ts.SendEnd();
}
}
function onEvilGod(){
ghost_count++
if(ghost_count>=3){
debug("3 ghost, disconnect now",0x00aaaa)
ts.Disconect();
}
}
function onLuckyGod(){
debug("LUCKY G O D.",0xFF0000)
}
function FinishAnswerFuckGod(){
god_count++;
YeWarpLink()
}
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){ continue; }
if(oItem.isHPItem()){
if (oItem.itemvalue > difHp){ continue; }
var eatHpAmt = (difHp - (difHp % 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,difHp){
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 > 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+" SP "+oItem.itemvalue+"at slot "+i+" decrease "+eatHpAmt+"?" ,0xC08008 )
difHp = difHp - eatHpAmt * oItem.itemvalue
}
}
}
}
function OnTimer(){
//YeWarpLink()
}
function Start(){
//SetPartyFriend("QS")
// ts.Walk(562,323);
//SetTimeout("ts.Warp(2)",2000)
//ts.delay(1000)
//walking = 0;
YeWarpLink()
state = " "
}
function Stop(){
state= "stop"
}
function CheckDisconnect(){
if(ts.CurrentPartner.HP <= 1){
pet_die_count++
}
if(ts.Character.HP <= 1){
die_count++
}
if(die_count>3){
ts.Disconect();
}
}
function InitBot(){
CheckDisconnect()
if (ts.Character.mapid == 12063){
ts.Walk(762,535);
SetTimeout("ts.Warp(2)",2000)
}
}
function AcceptedParty(playerid){
pname = getPlayerName(playerid)
if(pname == "QS"){
ts.AcceptParty(playerid)
ts.sena(playerid)
p1 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
if(pname == "AAA"){
ts.AcceptParty(playerid)
p2 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
if(pname == "BBB"){
ts.AcceptParty(playerid)
p3 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
if(pname == "BBB"){
ts.AcceptParty(playerid)
p4 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
}
function PartyStop( playerid ){
if(playerid == ???){
p4 = 0;
state = "stop"
ts.Disconect();
}
if(playerid == ???? ){
p1 = 0
state = "stop"
ts.Disconect();
}
if(playerid == ??? ){
p2 = 0;
state = "stop"
ts.Disconect();
}
if(playerid == ??? ){
p3 = 0
state = "stop"
ts.Disconect();
}
}
InitBot()
//debug(ts.Character.Ghost,0x0000FF)
var ghost_count = 0;
var god_count = 0;
var die_count = 0;
var pet_die_count = 0;
var battle_count = 0;
var DisconnectFlag = 0.3;
var HealingFlag = 0.5;
var hpFraction = 0.8
var spFraction = 0.8
var state = " "
var ptNumber = 0;
var p1=0
var p2=0
var p3=0
var p4=0
function MyAttack(){
m = findMonster()
if (ts.Character.SP > 30){
sk = SkillID("Attack");
}else{
debug("Depend",0xAA00AA)
sk = SkillID("Attack");
}
ts.SendAttack(
ts.Character.Row
, ts.Character.Col
, m.Row
, m.Col
, sk
)
}
function MyPartnerAttack(){
m = findMonster()
if (ts.CurrentPartner.SP > 0){
sk = SkillID("Attack");
}else{
debug("Depend",0xAA00AA)
sk = SkillID("Attack");
}
ts.SendAttack(
ts.CurrentPartner.Row
, ts.CurrentPartner.Col
, m.Row
, m.Col
, sk
)
}
function BattleStarted(){
battle_count++;
}
function BattleStoped(){
SaveWarrior();
CheckDisconnect();
EatHP()
EatSP()
ViewState()
}
function EatHP(){
if (ts.Character.HP < (ts.Character.MAXHP * hpFraction)){
doEatHP(0,(ts.Character.MAXHP * hpFraction)-ts.Character.HP)
}
if (ts.CurrentPartner.HP < (ts.CurrentPartner.MAXHP * hpFraction)){
doEatHP(ts.CurrentPartner.Order,(ts.CurrentPartner.MAXHP * hpFraction)-ts.CurrentPartner.HP)
}
}
function EatSP(){
if (ts.Character.SP < (ts.Character.MAXSP * spFraction)){
doEatSP(0,(ts.Character.MAXSP * spFraction)-ts.Character.SP)
}
if (ts.CurrentPartner.SP < (ts.CurrentPartner.MAXSP * spFraction)){
doEatSP(ts.CurrentPartner.Order,(ts.CurrentPartner.MAXSP * spFraction)-ts.CurrentPartner.SP)
}
}
function ViewState(){
debug("************************************",0xFF0000)
debug(" Battle Count : " + battle_count ,0xFF0000)
debug(" Dead Count : " + die_count ,0xFF0000)
debug(" Pet KO Count : " + pet_die_count, 0xFF0000)
debug(" Lucky Count : " + god_count, 0xFF0000)
debug(" Ghost Count : " + ghost_count,0xFF0000)
debug(" Warrior's FAI : " + ts.CurrentPartner.CharName +" : " + ts.CurrentPartner.fai,0xFF0000)
debug("************************************",0xFF0000)
}
function SaveWarrior(){
if(ts.CurrentPartner.HP< ((0.20) * ts.CurrentPartner.MAXHP)){
ts.Disconect();
debug(" SAVE THE FAI DISCONNECT NOW! : ",0x0000FF);
}
}
function YeWarpLink(){
if (ts.Character.mapid == 12063) {
ts.Walk(562,315) // walk to the gate
ts.delay(2000)
ts.Warp(2)
} else if (ts.Character.mapid == 12301) {
ts.Walk(202,555) // walk to the gate
ts.delay(2000)
ts.Warp(1)
}
}
function warpFinish(){
if (state == " ") {
YeWarpLink()
} else if (state == "stop") {
ts.SendAction(47) //sit down
}
}
function NpcDialogMenu(DialogId){
debug("DialogM "+DialogId,0x0000FF)
if(DialogId==1){
ts.SelectChoice(1);
ts.SendEnd();
}
}
function NpcDialog(DialogId){
debug("DialogN "+DialogId,0x0000FF)
if(DialogId==14305){
ts.SendEnd();
}
if(DialogId==10021){
ts.SendEnd();
}
}
function onEvilGod(){
ghost_count++
if(ghost_count>=3){
debug("3 ghost, disconnect now",0x00aaaa)
ts.Disconect();
}
}
function onLuckyGod(){
debug("LUCKY G O D.",0xFF0000)
}
function FinishAnswerFuckGod(){
god_count++;
YeWarpLink()
}
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){ continue; }
if(oItem.isHPItem()){
if (oItem.itemvalue > difHp){ continue; }
var eatHpAmt = (difHp - (difHp % 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,difHp){
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 > 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+" SP "+oItem.itemvalue+"at slot "+i+" decrease "+eatHpAmt+"?" ,0xC08008 )
difHp = difHp - eatHpAmt * oItem.itemvalue
}
}
}
}
function OnTimer(){
//YeWarpLink()
}
function Start(){
//SetPartyFriend("QS")
// ts.Walk(562,323);
//SetTimeout("ts.Warp(2)",2000)
//ts.delay(1000)
//walking = 0;
YeWarpLink()
state = " "
}
function Stop(){
state= "stop"
}
function CheckDisconnect(){
if(ts.CurrentPartner.HP <= 1){
pet_die_count++
}
if(ts.Character.HP <= 1){
die_count++
}
if(die_count>3){
ts.Disconect();
}
}
function InitBot(){
CheckDisconnect()
if (ts.Character.mapid == 12063){
ts.Walk(762,535);
SetTimeout("ts.Warp(2)",2000)
}
}
function AcceptedParty(playerid){
pname = getPlayerName(playerid)
if(pname == "QS"){
ts.AcceptParty(playerid)
ts.sena(playerid)
p1 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
if(pname == "AAA"){
ts.AcceptParty(playerid)
p2 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
if(pname == "BBB"){
ts.AcceptParty(playerid)
p3 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
if(pname == "BBB"){
ts.AcceptParty(playerid)
p4 = 1
if ((p1 == 1) && (p2 == 1) && (p3 == 1) && (p4 == 1)){
state = " "
YeWarpLink()
}
}
}
function PartyStop( playerid ){
if(playerid == ???){
p4 = 0;
state = "stop"
ts.Disconect();
}
if(playerid == ???? ){
p1 = 0
state = "stop"
ts.Disconect();
}
if(playerid == ??? ){
p2 = 0;
state = "stop"
ts.Disconect();
}
if(playerid == ??? ){
p3 = 0
state = "stop"
ts.Disconect();
}
}
InitBot()
//debug(ts.Character.Ghost,0x0000FF)
