Skip to content

Conversation

@AnnieRuru
Copy link
Contributor

@AnnieRuru AnnieRuru commented Feb 26, 2019

Pull Request Prelude

Issues addressed

http://herc.ws/board/topic/16588-1-how-to-make-it-not-list-clone-monster-or-slaveclone/#comment-90623
that script is flawed, obviously I could do if ( .@mobid >= 4001 && .@mobid < 5000 )
but if somehow gravity introduce more monsters ID, this range will subject to change,
which break my custom script

Changes Proposed

Add MOB_CLONE_START & MOB_CLONE_END to server defined constants

Tested with

prontera,155,185,5	script	sdkfjhsdkf	1_F_MARIA,{
	.@mobgid = monster( "this", -1,-1, "--ja--", PORING, 1 );
	.@mobid = uid2mobid(.@mobgid);
	dispbottom "GID: "+ .@mobgid +" | mob ID: "+ .@mobid;
	if ( .@mobid >= MOB_CLONE_START && .@mobid < MOB_CLONE_END )
		dispbottom "this is a clone";
	getmapxy .@map$, .@x, .@y, UNITTYPE_PC;
	.@mobgid = clone( .@map$, .@x, .@y, "", getcharid(CHAR_ID_CHAR), getcharid(CHAR_ID_CHAR) );
	.@mobid = uid2mobid(.@mobgid);
	dispbottom "GID: "+ .@mobgid +" | mob ID: "+ .@mobid;
	dispbottom MOB_CLONE_START +""+ MOB_CLONE_END;
	if ( .@mobid >= MOB_CLONE_START && .@mobid < MOB_CLONE_END )
		dispbottom "this is a clone";
	end;
}
using a custom script command `*uid2mobid` because our `*setunitdata` is broken
#include "common/hercules.h"
#include "map/mob.h"
#include "map/script.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"uid2mobid",
	SERVER_TYPE_MAP,
	"0.1",
	HPM_VERSION,
};
BUILDIN(uid2mobid) {
	struct mob_data *md = map->id2md( script_getnum(st,2) );
	if ( !md ) {
		ShowWarning( "buildin_uid2mobid: Error in finding object GID or target GID is not a monster.\n" );
		return false;
	}
	script_pushint( st, md->class_ );
	return true;
}
HPExport void plugin_init(void) {
	addScriptCommand( "uid2mobid", "i", uid2mobid );
}

Affected Branches

  • Master

Known Issues and TODO List

or maybe introduce a new source function check_mob_clone to check for clone ID ?

@HerculesWSAPI
Copy link
Contributor

This change is Reviewable

@AnnieRuru AnnieRuru added type:enhancement Issue describes an enhancement or feature that should be implemented component:core:scriptengine Affecting the script engine or the script commands labels Feb 28, 2019
@Emistry Emistry added the component:documentation Affecting the documentation in the doc/ folder label Feb 28, 2019
@Asheraf Asheraf merged commit 006e08c into HerculesWS:master Mar 2, 2019
@AnnieRuru
Copy link
Contributor Author

AnnieRuru commented Mar 9, 2019

can I revert this commit ?
I found there is a md->special_state.clone to determine if the mob is a clone ...
then this constant should be deprecate

so this means,
actually we can just use setunitdata/getunitdata on UDT_MOB_IS_CLONE or something
to set or retrieve the monster is a clone or not

hmm ... #2198 ... or maybe not ...

prontera,158,185,5	script	sdkfjhsdkf	1_F_MARIA,{
	atcommand "@evilclone "+ strcharinfo(PC_NAME);
	end;
OnNPCKillEvent:
	dispbottom rid2name(killedrid) +"("+ killedrid +")";
	dispbottom getmonsterinfo( killedrid, MOB_NAME );
	if ( killedrid >= MOB_CLONE_START && killedrid < MOB_CLONE_END )
		dispbottom "You just killed a clone.";
	end;
}

@AnnieRuru AnnieRuru deleted the 63-MOB_CLONE_START branch March 9, 2019 23:14
@MishimaHaruna MishimaHaruna added this to the Release v2019.03.10 milestone Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:core:scriptengine Affecting the script engine or the script commands component:documentation Affecting the documentation in the doc/ folder type:enhancement Issue describes an enhancement or feature that should be implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants