Aller au contenu

Photo

welp i've run into problems


1 réponse à ce sujet

#1
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
this code fires in a conversation:

#include "events_h"
#include "global_objects_h"
#include "utility_h"
#include "sys_chargen_h"
void main()
{
    object oHero = GetHero();
   object oNecklace = GetItemInEquipSlot(11, oHero);
   object oItem = GetObjectByTag("necklace2");

   if (oNecklace == oItem)
   {
    UT_TeamGoesHostile(1);
   }
}
it's supposed to look if the character has necklace2 equipped in item slot 11 and if it does, team 1 attacks.
when i play the game the result is that the player gets attacked after initiating conversation no matter if he wears the necklace or not. the tags are all checkin out so that's not the problem here.

#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Here's what I think the problem was. I don't think GetObjectByTag can grab an item out of a creature's inventory, so that function would return OBJECT_INVALID. If the player wasn't wearing any necklace, GetItemInEquipmentSlot would return OBJECT_INVALID as well.



OBJECT_INVALID == OBJECT_INVALID resolves to TRUE, so the team goes hostile.