summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/script_commands.txt2
-rw-r--r--src/map/script.c23
-rw-r--r--src/map/script.h1
3 files changed, 26 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 13deb97f8..2aec07f29 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -10174,6 +10174,7 @@ Applicable Data Types (available as constants) -
UDT_LIFETIME: LifeTime - for summons.
UDT_MERC_KILLCOUNT: Kill count for mercenaries
UDT_STATADD: Status Points - for NPCs.
+ UDT_GROUP: group id
returns 0 if value could not be set, 1 if successful.
@@ -10236,6 +10237,7 @@ Applicable Data types (available as constants) -
UDT_INTIMACY: Intimacy Rate - for summons.
UDT_LIFETIME: LifeTime - for summons.
UDT_MERC_KILLCOUNT: Kill count for mercenaries.
+ UDT_GROUP: group id
returns -1 if value could not be retrieved.
diff --git a/src/map/script.c b/src/map/script.c
index 2c5e5237b..ccbe50157 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -18961,6 +18961,20 @@ static BUILDIN(setunitdata)
case UDT_ELELEVEL:
setunitdata_check_bounds(4, 0, CHAR_MAX);
break;
+ case UDT_GROUP:
+ {
+ setunitdata_check_bounds(4, 0, INT_MAX);
+ struct unit_data *ud = unit->bl2ud2(bl);
+ if (ud == NULL) {
+ ShowError("buildin_setunitdata: ud is NULL!\n");
+ script_pushint(st, 0);
+ return false;
+ }
+ ud->groupId = script_getnum(st, 4);
+ clif->blname_ack(0, bl); // Send update to client.
+ script_pushint(st, 1);
+ return true;
+ }
default:
break;
}
@@ -19909,6 +19923,15 @@ static BUILDIN(getunitdata)
return true;// no player attached
}
}
+ } else if (type == UDT_GROUP) {
+ struct unit_data *ud = unit->bl2ud(bl);
+ if (ud == NULL) {
+ ShowError("buildin_setunitdata: ud is NULL!\n");
+ script_pushint(st, -1);
+ return false;
+ }
+ script_pushint(st, ud->groupId);
+ return true;
}
#define getunitdata_sub(idx__,var__) script->setd_sub(st,NULL,name,(idx__),(void *)h64BPTRSIZE((int)(var__)),data->ref);
diff --git a/src/map/script.h b/src/map/script.h
index 008da9c3c..4c1cc168d 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -431,6 +431,7 @@ enum script_unit_data_types {
UDT_STATPOINT,
UDT_ROBE,
UDT_BODY2,
+ UDT_GROUP,
UDT_MAX
};