Aller au contenu

Photo

GetObjectByTag : error?


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
I'm getting a ''Mitchmatch types''' error on the code below. But both GetObjectByTag() and EffectSummonCreature() have the variable as a string? I'm at a loss, any suggestions on what would cause this?

 
string Pet;
if (GetHitDice(oPC) ==  1) Pet = GetObjectByTag("gnomegardenwisp1");  //Getting error on this line

effect eEffect;eEffect = EffectSummonCreature(Pet);

Modifié par Buddywarrior, 26 mai 2013 - 12:16 .


#2
the.gray.fox

the.gray.fox
  • Members
  • 127 messages
GetObjectByTag() returns an _object_ datatype.
But you are assigning the return value to a _string_ datatype. That is the mismatch.
Change the datatype of Pet, from string to object, and it will work.


-fox

#3
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
That was the first thing I tried. And it didn't work sadly. ''Declaration does not match params" is the compile error.

#4
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
bah... ObjectToString(Pet); fixed I think. THanks for the extra pair of eyes.

#5
_Guile

_Guile
  • Members
  • 685 messages
keep in mind that, if 2 of these pets are in the module, then it will probably kick out an error as well....

Tags MUST be unique....

You could use GetNearestObjectByTag()..... ?

#6
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
Are you trying to summon a creature that already exists somewhere within the mod?

The GetObjectByTag() functions will only return an object if it already exists. If the summon is something that's intended to be created right then, skip the get function entirely, and just feed in the ResRef directly into EffectSummonCreature(string sCreatureResref).