Added a new script command unitexists
* Small follow up to 4f16d82.
* Checks to see if a unit exists or not.
This commit is contained in:
@@ -7145,6 +7145,13 @@ For the position, the x and y are given in the UnitSkillUsePos.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*unitexists <GID>;
|
||||
|
||||
Checks if the given Game ID exists. Returns false if the object doesn't exist, or true if
|
||||
it does.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*getunittype <GID>;
|
||||
|
||||
Returns the type of object from the given Game ID. Returns -1 if the given GID does not
|
||||
|
||||
@@ -16712,6 +16712,23 @@ BUILDIN_FUNC(pcstopfollow)
|
||||
// <--- [zBuffer] List of player cont commands
|
||||
// [zBuffer] List of unit control commands --->
|
||||
|
||||
/// Checks to see if the unit exists.
|
||||
///
|
||||
/// unitexists <unit id>;
|
||||
BUILDIN_FUNC(unitexists)
|
||||
{
|
||||
struct block_list* bl;
|
||||
|
||||
bl = map_id2bl(script_getnum(st, 2));
|
||||
|
||||
if (!bl)
|
||||
script_pushint(st, false);
|
||||
else
|
||||
script_pushint(st, true);
|
||||
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/// Gets the type of the given Game ID.
|
||||
///
|
||||
/// getunittype <unit id>;
|
||||
@@ -21690,6 +21707,7 @@ struct script_function buildin_func[] = {
|
||||
BUILDIN_DEF(pcblockmove,"ii"),
|
||||
// <--- [zBuffer] List of player cont commands
|
||||
// [zBuffer] List of unit control commands --->
|
||||
BUILDIN_DEF(unitexists,"i"),
|
||||
BUILDIN_DEF(getunittype,"i"),
|
||||
BUILDIN_DEF(getunitname,"i"),
|
||||
BUILDIN_DEF(setunitname,"is"),
|
||||
|
||||
Reference in New Issue
Block a user