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.
welp i've run into problems
Débuté par
gordonbrown82
, janv. 15 2010 08:48
#1
Posté 15 janvier 2010 - 08:48
#2
Posté 15 janvier 2010 - 03:29
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.
OBJECT_INVALID == OBJECT_INVALID resolves to TRUE, so the team goes hostile.





Retour en haut






