Aller au contenu

Photo

Floating String appears twice


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

#1
mogromon

mogromon
  • Members
  • 41 messages
Hi, i've been doing a spell script that uses floating strings in case somethings goes wrong and then use "return" to exit the script.
While i was testing it in JEG's training module all works fine, the floating string only appears once. If i load a previous OC game (before patching to 1.23) the floating string appears twice (any of the different floating string i use based on different conditions.)

Anyone has a clue whats happening???

#2
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Perhaps some information about what the scripts are supposed to do would help us offer suggestions.

#3
Shallina

Shallina
  • Members
  • 1 012 messages
The script is called twice.

#4
mogromon

mogromon
  • Members
  • 41 messages
Nope, its a script that adds a wilding clasp property via bonus feat to make things more simple (not adding custom properties), so when the wild shape occurs the wild shape script check if the item has the item property and proceeds to keep all item properties of that item. I made it via spell so it can be added to any item and go beyond the 4 properties limit.

#include "nw_i0_spells"
#include "x2_i0_spells"
#include "x2_inc_itemprop"
#include "x2_inc_spellhook"

int Ammocheck(object oItem)
{
int nItem = GetBaseItemType(oItem);
if((nItem == BASE_ITEM_ARROW) || (nItem == BASE_ITEM_BOLT) || (nItem == BASE_ITEM_BULLET))
{
return FALSE;
}
return TRUE;
}

int nItemCheck(object oItem)
{
if (GetIsObjectValid(oItem))
{
itemproperty ip = GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(ip))
{
if (GetItemPropertyType(ip) == ITEM_PROPERTY_BONUS_FEAT)
{
if(GetItemPropertySubType(ip) == 860)
{
return FALSE;
}
}
ip = GetNextItemProperty(oItem);
}
}
return TRUE;
}


void main()
{
object oCaster = OBJECT_SELF;
if(GetHasFeat(1093))
{
object oItem = GetSpellTargetObject();
itemproperty ip = ItemPropertyBonusFeat(860);
object oMyArmor = IPGetTargetedOrEquippedArmor(TRUE);
int nAmmo = Ammocheck(oItem);
if (GetIsEquippable(oItem)&&(!IPGetIsMeleeWeapon(oItem))&&(!GetIsObjectValid(oMyArmor))&&(!GetWeaponRanged(oItem))&&(nAmmo))
{
int nCheck = nItemCheck(oItem);
if(nCheck)
{
if(GetGold(oCaster)>=4000)
{
TakeGoldFromCreature(4000, oCaster, TRUE);
IPSafeAddItemProperty(oItem, ip, 0.0f, X2_IP_ADDPROP_POLICY_KEEP_EXISTING);
FloatingTextStringOnCreature("A Wilding Clasp was added",oCaster);
}
else
{
FloatingTextStringOnCreature("4,000 gp are necessary to add a Wilding Clasp",oCaster);
return;
}
}
else
{
FloatingTextStringOnCreature("Item already has the property Wilding Clasp",oCaster);
return;
}
}
else
FloatingTextStringOnCreature("Object is not valid",oCaster);
}
else
FloatingTextStringOnCreature("The Craft Wondrous Items feat is necessary to add Wilding Clasps",oCaster);
}

#5
Shallina

Shallina
  • Members
  • 1 012 messages
Wich string appear twice ?

Here a simple code to check if your script isn't called twice.

int n = 1;
if (!GetGlobalInt("numberOfRun")){
    SetGlobalInt("numberOfRun",n);
}
else{
SetGlobalInt("numberOfRun",n+1);
}
SendMessageToPC(GetFirstPC(FALSE),"number of time the script ran = " + IntToString(GetGlobalInt("numberOfRun")));

Modifié par Shallina, 15 juillet 2011 - 10:49 .


#6
mogromon

mogromon
  • Members
  • 41 messages
i used your code, it only ran one time. Any of the strings appears twice, depending in which conditions are met.

I've been checking and doing some extra tests. If i used the spell in my character the message only displays once, but if i use a companion it appears twice. So i change FloatingTextStringOnCreature to SendMessageToPC and in the lines in which i replaced the command it only happened once, so i supose it has something to do with noncharacters using floatingtextstring

#7
Dann-J

Dann-J
  • Members
  • 3 161 messages
I've found that FloatingTextStringOnCreature() appears twice if you are possessing a companion when you trigger it. I had to write a condition into my own script to test whether the triggering party member was being possessed by the PC, and set bBroadcastToFaction to FALSE in that instance. It is TRUE by default, so it sends the message both to the companion who is triggering it and to the first PC (who are one and the same if the PC is in possession of them).

I only have patch 1.22, so this may have been fixed in 1.23.

#8
mogromon

mogromon
  • Members
  • 41 messages
yeap, that was exacting what happened. thx a lot, already fix it.