dungpt8782
New member
- Messages
- 63
- Points
- 0
- Age
- 43
- Emulator
//===== Hercules Script ======================================
//= @callmonster <monster_id>
//= For: VNRO
//===== By: ==================================================
//= ndh
- script callmonster -1,{
OnInit:
bindatcmd "callmonster", strnpcinfo(0) + "::OnCallMonster";
.callmonsterDuration = 60; // phut
end;
OnCallMonster:
if(Hp == 0) {
dispbottom "Can't Call if died.";
end;
}
if(callmonsterhaveMonster > 0) {
dispbottom "Only call 1 per times.";
end;
}
// Proccess argument
.@argument$ = "";
for (.@i = 0; .@i < .@atcmd_numparameters; ++.@i) {
.@argument$ += (.@i > 0 ? " " : "") + .@atcmd_parameters$[.@i];
}
.@monsterId = atoi(.@argument$);
// Find card ID
.@cardId = -1;
if(getmobdrops(.@monsterId)) {
.@count = $@MobDrop_count;
copyarray .@item[0],$@MobDrop_item[0],.@count;
for (.@i = 0; .@i < .@count; ++.@i) {
//item type 6 la card, getiteminfo(id,2) -> get item type
if(getiteminfo(.@item[.@i],2) == 6) .@cardId = .@item[.@i];
}
if(.@cardId == -1) {
dispbottom "Not available in db";
end;
}
} else {
dispbottom "Can't find monster";
end;
}
// Find card ID in inventory
if(countitem(.@cardId) > 0) {
delitem .@cardId, 1;
atcommand "@summon " + .@monsterId + " " + .callmonsterDuration;
callmonsterhaveMonster = 1;
addtimer (.callmonsterDuration * 60 * 1000), strnpcinfo(3)+"::OnMonsterGone";
dispbottom "Called monster in 60 mins!";
}
else {
dispbottom "Can't call monster, pls check "
+ getitemname(.@cardId)
+ " in your inventory, Need 1 card to call";
end;
}
end;
OnMonsterGone:
callmonsterhaveMonster = 0;
end;
OnPCDieEvent:
callmonsterhaveMonster = 0;
end;
OnPCLogoutEvent:
callmonsterhaveMonster = 0;
end;
OnWhisperGlobal:
set getd(@whispervar0$), atoi(@whispervar1$); // debug function
end;
}
THanks you!!!!
//= @callmonster <monster_id>
//= For: VNRO
//===== By: ==================================================
//= ndh
- script callmonster -1,{
OnInit:
bindatcmd "callmonster", strnpcinfo(0) + "::OnCallMonster";
.callmonsterDuration = 60; // phut
end;
OnCallMonster:
if(Hp == 0) {
dispbottom "Can't Call if died.";
end;
}
if(callmonsterhaveMonster > 0) {
dispbottom "Only call 1 per times.";
end;
}
// Proccess argument
.@argument$ = "";
for (.@i = 0; .@i < .@atcmd_numparameters; ++.@i) {
.@argument$ += (.@i > 0 ? " " : "") + .@atcmd_parameters$[.@i];
}
.@monsterId = atoi(.@argument$);
// Find card ID
.@cardId = -1;
if(getmobdrops(.@monsterId)) {
.@count = $@MobDrop_count;
copyarray .@item[0],$@MobDrop_item[0],.@count;
for (.@i = 0; .@i < .@count; ++.@i) {
//item type 6 la card, getiteminfo(id,2) -> get item type
if(getiteminfo(.@item[.@i],2) == 6) .@cardId = .@item[.@i];
}
if(.@cardId == -1) {
dispbottom "Not available in db";
end;
}
} else {
dispbottom "Can't find monster";
end;
}
// Find card ID in inventory
if(countitem(.@cardId) > 0) {
delitem .@cardId, 1;
atcommand "@summon " + .@monsterId + " " + .callmonsterDuration;
callmonsterhaveMonster = 1;
addtimer (.callmonsterDuration * 60 * 1000), strnpcinfo(3)+"::OnMonsterGone";
dispbottom "Called monster in 60 mins!";
}
else {
dispbottom "Can't call monster, pls check "
+ getitemname(.@cardId)
+ " in your inventory, Need 1 card to call";
end;
}
end;
OnMonsterGone:
callmonsterhaveMonster = 0;
end;
OnPCDieEvent:
callmonsterhaveMonster = 0;
end;
OnPCLogoutEvent:
callmonsterhaveMonster = 0;
end;
OnWhisperGlobal:
set getd(@whispervar0$), atoi(@whispervar1$); // debug function
end;
}
THanks you!!!!