Hi all. I got this situation where 5 creatures are added to a group by using the function
string elf_group = "HD_ELVES";
AddNearestWithTagToGroup(elf_group, "c_hd_elf_leader", 20);
I’ve already tried passing the group name as a string parameter and not as a pre-declared string in a desperate attempt to make it work.
I also have already double checked the tag of the creature and the tag in the script.
I also deleted his blueprint, made a new one and gave the tag. Just in case it was a blueprint error.
At the end of a convo where the group is present I call this function.
void main(string sGroup)
to which I pass HD_ELVES as a parameter. 5 creatures go hostile, the one with the tag above stays a commoner. Only thing I can think as a problem at this stage, is that he is the convo owner. However, the hostility happens on the very last node. And even if it weren’t, it shouldn’t prevent him from going hostile and breaking the convo.
Any ideas about this behavior would be much appreciated.
void AddNearestWithTagToGroup(string sGroup, string sTag, int iMax = 20);
<- is obsolete (although it should still work)
try replacing with ->
void GroupAddNearestTag(string sGroup, string sTag, object oTarget = OBJECT_SELF, int iMax = 20, int bOverride = FALSE);
I’ll try it thanks.
A couple of thoughts though.
1: Rest of the creatures do get added to the group using the (apparently?) obsolete function.
2: Why is it obsolete? It never failed me.
3: Shouldn’t they have deprecate it or something if it’s obsolete ?
void AddNearestWithTagToGroup(string sGroupName, string sTag, int iMax=20)
GroupAddNearestTag(sGroupName, sTag, OBJECT_SELF, iMax);
// a specialized error message for phasing out old stuff
void OldFunctionMessage(string sOldFunctionName, string sNewFunctionName)
string sMessage = "Function '" + sOldFunctionName + "' is obsolete and should be replaced with '" + sNewFunctionName;
That’s kinda cool. OldFunctionMessage… the things I learn today
let’s see if that solves anything now.
you could also try delaying the GroupGoHostile by 0.1 sec to ensure the dialog has ended
Also, what is the object oTarget doing there in GroupAddNearestTag?
oTarget is the object to measure “nearest” against …
Interesting. And I guess GroupAddTag is like GetObjectByTag, while GroupAddNearestTag is like GetNearestObjectByTag. Just the equivalent functions for groups.
Would GroupAddTag work when all tags are unique of course?
but let’s back up a sec.
getnearest does not include oTarget itself
so that needs to be taken into consideration when assigning group-members
fallback on using
void GroupAddTag(string sGroup, string sTag, int iMax = 20, int bOverride = FALSE);
if the creature to add is OBJECT_SELF (ie. oTarget) in the adding script (and make sure its tag is unique across the module)
I made it work with GroupAddTag(…). Good to know that some dozen instances in my campaign where I use the obsolete method are a ticking bomb . I won’t go into the effort to change them though. They work. I just know now for any future projects that I should look into the libraries. I just thought that obsolete methods should include the obsolete description in the method description (Like when I pick it from the script assist). And the one in question here doesn’t mention anywhere that it is problematic.
Anyway, that’s why we love the toolset. We’re a bit masochistic I guess.
it’s a bit of a hassle, but this should be/is written to the temp/logfile whenever the obsolete function runs:
not sure if logging needs to be set up …
(it’s probably a good idea for devs to run with full logging in place anyway)