Jump to content

Harvin

Members
  • Posts

    39
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Harvin

  1. untested, but you can try this. prontera,155,155,3 script TESTSTE 92,{ if (.user) { mes rid2name(.user) +" is currently per-using my service, please try again later."; close; } .user = getcharid(3); addtimer 10, strnpcinfo(0) +"::OnReleaseUser"; mes "Generating new code for you.."; freeloop(true); do { .@new_coupon$ = ""; copyarray .@coupon_code$[0], .coupon_code$[0], .coupon_code_size; .@coupons = query_sql("SELECT `transaction_code` FROM `transaction_tbl` WHERE 1", .@coupons$); for (.@i = 0; .@i < .code_length;.@i++) { .@s = getarraysize(.@coupon_code$); .@r = rand(.@s); .@new_coupon$ += .@coupon_code$[.@r]; deletearray .@coupon_code$[.@r], 1; } if (.@coupons < 1) break; if (inarray(.@coupons$, .@new_coupon$) == -1) break; } while (1); freeloop(false); clear; query_sql("INSERT INTO `transaction_tbl` (transaction_code) VALUES ('" + escape_sql(.@new_coupon$) + "')"); mes "New Coupon Code: "+ .@new_coupon$; close; OnPCLogoutEvent: if (.user != getcharid(3)) end; OnReleaseUser: .user = 0; end; OnInit: .code_length = 6; setarray .coupon_code$[0], "A","B","C","D","E","F","G","H","I","J","K","L", "M","N","O","P","Q","R","S","T","U","V","W","X", "Y","Z","0","1","2","3","4","5","6","7","8","9"; .coupon_code_size = getarraysize(.coupon_code$); end; }
  2. I don't test this but maybe this help you. quest_db.yml - Id: 19000 Title: Hunt Orc Lord - Id: 19001 Title: Hunt Orc Lord - Cooldown TimeLimit: +4h # this mean this quest will expire after 4 hour after it taken # TimeLimit: 4h # this mean this quest will expire after 4.00 AM npc script prontera,169,180,4 script Commander#1 4_M_UNCLEKNIGHT,{ .@report = checkquest (19001, PLAYTIME); if (.@report == -1 || .@report == 2) { if (.@report == 2) erasequest 19001; if (isbegin_quest(19000) == 0) { setquest 19000; mes "Alright now hunt an MVP"; mes "Then you come back to me for reporting in."; } else { mes "Why are you here?!,"; mes "Go hunt an MVP before talking to me again."; } } else if (.@report == 0 || .@report == 1) { mes "Come again some time later"; mes "For now take a rest."; } close; OnNPCKillEvent: if(getmonsterinfo(killedrid, MOB_MVPEXP) > 1) { addrid(1); if (isbegin_quest(19000) == 1) changequest(19000, 19001); } end; }
  3. you should play around with the quest_db.yml config, check on TimeLimit of file ...\doc\quest_db.txt
  4. because the index placing of bound item in inventory is lower than normal item, so it never checked, you will need to mod the source to adjust it to the way you want.
  5. it was the sql table column type that limiting the stats into 255, because it using *tinyint(3)* change it into *smallint(4)* seem will fix your problem. change into OnInit: query_sql "Create Table If Not Exists `build_saver` ( `char_id` int(11) unsigned NOT NULL, `build_name` varchar(255) NOT NULL, `public` tinyint(1) unsigned NOT NULL, `name` varchar(255) NOT NULL, `class` mediumint(4) unsigned NOT NULL, `lvl` mediumint(4) unsigned NOT NULL, `str` smallint(4) unsigned NOT NULL, `agi` smallint(4) unsigned NOT NULL, `vit` smallint(4) unsigned NOT NULL, `int` smallint(4) unsigned NOT NULL, `dex` smallint(4) unsigned NOT NULL, `luk` smallint(4) unsigned NOT NULL, `copiedtimes` int(11) unsigned NOT NULL, Primary Key (`char_id`) )"; end;
  6. curious to the result of this, is it client limitation or can be increased? if can be increased did you test the limit?
  7. that was my account but I can no longer access it because some complication. you can try check if the *.@mob_id[N]* is exist to debug it why it doesn't work. or change code on part. or change the src code mod into src\custom\script.inc BUILDIN_FUNC(specialeffect3) { int id = script_getnum(st, 2); int type = script_getnum(st, 3); enum send_target target = script_hasdata(st, 4) ? (send_target)script_getnum(st, 4) : AREA; struct block_list *bl = map_id2bl(id); if (bl == nullptr) { ShowError("buildin_specialeffect: unknown game object with id %d.\n", type); return SCRIPT_CMD_FAILURE; } if (type <= EF_NONE || type >= EF_MAX) { ShowError("buildin_specialeffect: unsupported effect id %d.\n", type); return SCRIPT_CMD_FAILURE; } if (target == SELF) { map_session_data* sd; if (!script_rid2sd(sd)) return SCRIPT_CMD_FAILURE; clif_specialeffect_single(bl, type, sd->fd); } else clif_specialeffect(bl, type, target); return SCRIPT_CMD_SUCCESS; } src\custom\script_def.inc BUILDIN_DEF(specialeffect3,"ii?"), and in your script OnKill1: specialeffect3 .@mob_id[1], 68, AREA; callsub OnSetWinner, .mob_id_2, "WALA"; OnKill2: specialeffect3 .@mob_id[1], 68, AREA; callsub OnSetWinner, .mob_id_1, "MERON";
  8. I have created something like this long ago for someone. notepad++_Riq42KgQKA.mp4
  9. this can't be achieved with raw code, need source mod, the source mod is related to your other thread.
  10. I will still talk with vector as base, you can sort the damage with vector easy, you can look up function mob_add_spawn with it code sorting the qty of mob spawn in a map // sort spawns by spawn quantity std::sort(spawns.begin(), spawns.end(), [](const spawn_info & a, const spawn_info & b) -> bool { return a.qty > b.qty; }); quoted from here https://www.geeksforgeeks.org/vector-in-cpp-stl/ Vectors are the same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted so you don't need to pre defined number to set size on the container. for mvp its reset upon dead, so if mvp has rebirth skill, it will reset the logs value. later on will be removed in memory in status.cpp if(flag&4) // Delete from memory. (also invokes map removal code) unit_free(target,CLR_DEAD); else if(flag&2) // remove from map unit_remove_map(target,CLR_DEAD); so you can still get the data of damage log, before it was wiped out from memory, but no longer after. so in case you want to preserve the damage log, you need to save it on sql db its not complicated, you just need consider what you want to log, I think it will be gid of mob, account id, char id, damage CREATE TABLE IF NOT EXISTS `mob_damage_log` ( `id` int(11) NOT NULL auto_increment, `mob_gid` int(11) NOT NULL default '0', `account_id` int(11) NOT NULL default '0', `char_id` int(11) NOT NULL default '0', `damage` int(10) NOT NULL default '0', PRIMARY KEY (`id`), KEY `mob_gid` (`mob_gid`), KEY `account_id` (`account_id`), KEY `char_id` (`char_id`) ) ENGINE=MyISAM; something like that maybe. and the code would go like this, as the sd, you can get it with map_session_data *sd= map_charid2sd(char_id); if( SQL_ERROR == Sql_Query( mmysql_handle, "INSERT INTO `mob_damage_log`(`mob_gid`,`account_id`,`char_id`,`damage`) VALUES ( '%d', '%d', '%d', '%d' )", md->bl.id, sd->status.account_id, sd->status.account_id, damage) ){ Sql_ShowDebug(mmysql_handle); return; }
  11. SQL thing is not what you want, you are in right direction, with referencing function of mob_add_spotted or pc_damage_log_add, then if you want to remember the log you need to store it on db sql or beware the mob will be wiped out from memory later on after the mob dead. there is some way to achieve what you want since you want to learn your self, I wouldn't throw some code here, but here some note you may search on search engine to achieve what you want - vector with struct. - vector with map (better unordered map I think) oh also dmglog member of mob data is wiped for mvp upon dead if( md->get_bosstype() == BOSSTYPE_MVP ) pc_damage_log_clear(tmpsd[i],md->bl.id); you need to create your own new member of struct mob data. my suggestion is create flag for the mob you want to its damage to be logged, then do some regulated rules, like if the player has gone from map or etc2, it will 2 side check, first the mob it self and the player, same with dmglog of currect code, which can you use for reference.
  12. better using vector instead array since rA is now c++
  13. Your script has missing bracket that is why its give an error in console and then can't be clicked
  14. Hi, I am that Litro Endemic. And damn it I lost my previous account, because that account isn't using my own email. that account owned by my old friend and lost contact so I created new account. duh what a lame story. You put the check on bracket of condition when the agit event is on, that's why there is no response. *mapwarp script command unlike *warp doesn't support "SavePoint" parameter except you modified it, so it need to iterate player one by one. @AinsLord here updated script prontera,150,150,0 script Entrance Guard 112,{ mes "[Entrance Guard]"; if (agitcheck() || agitcheck2() || agitcheck3()) { mes "Woe is currently active can't enter right now"; // NPC message when woe is active } else { .@gid = getcastledata("prtg_cas01", CD_GUILD_ID); if (getcharid(2) != .@gid) { mes "[Lost Midgard Guardian]"; mes "Your Guild did not conquer Krimhild Castle"; dispbottom "[Guild Message]: Only Guild who owns Kriemhild can enter here!"; } else { mes "You will be warped to Lost Midgard"; next; warp .map$, 0, 0; dispbottom "[Guild Message]: Welcome to Lost Midgard"; } } close; OnInit: .map$ = "prt_fild07"; setmapflag .map$, mf_loadevent; // fallthrough as first check upon script loaded OnTimer5000: // next timer after ini will run on 5 seconds after .@gid = getcastledata("prtg_cas01", CD_GUILD_ID); .@num = getmapunits(BL_PC, .map$, .@name$[0]); freeloop(1); for (.@i = 0; .@i < .@num;.@i++) { if (getcharid(2, .@name$[.@i]) == .@gid) // still on the guild? skip it. continue; message .@name$[.@i], "YOU ARE NO LONGER WELCOME HERE, YOU WILL BE WARPED TO WHERE YOU BELONG!!!!"; warp "SavePoint", 0, 0, getcharid(0, .@name$[.@i]); } freeloop(0); initnpctimer; // reinit the timer tick end; OnAgitStart: OnAgitStart2: OnAgitStart3: .@num = getmapunits(BL_PC, .map$, .@name$[0]); freeloop(1); for (.@i = 0; .@i < .@num;.@i++) { message .@name$[.@i], "Agit event has been started, You will be warped to Save Point"; warp "SavePoint", 0, 0, getcharid(0, .@name$[.@i]); } freeloop(0); end; OnPCLoadMapEvent: if (strcharinfo(3) != .map$) end; if (agitcheck() || agitcheck2() || agitcheck3()) { message strcharinfo(0), "Agit event is on going, You will be warped to Save Point"; warp "SavePoint", 0, 0; } else { .@gid = getcastledata("prtg_cas01", CD_GUILD_ID); if (getcharid(2) != .@gid) { mes "YOU ARE NOT ALLOWED HERE, GO BACK!!!!"; next; warp "SavePoint", 0, 0; } } end; }
×
×
  • Create New...