oKillCountSign is the object that will shout the kill count. iKillCount is the variable, stored on oKillCountSign.
You are correct, the other variables were not being defined. Didn't think you needed to given the context, but now I know. Was unaware that NWNScript is so narrow-minded that you have to declare objects as themselves before a given segment of code will see them.
What I need to do is use the death of one object to add to the variable of a completely different object. I have the code fully compiled but right now the integer isn't being added to correctly and I'm not quite sure where the problem is.
The way I have it set up is that
oKillCountSign is the object which displays the total number of orcs slain.
iKillCount is the integer stored as a local variable on oKillCountSign
iKillCountTwo is a temporary integer created during each individual orc's death script which loads the old value of iKillCount, increases it by one, then replaces the original value of iKillCount.
sKillCount is the string to be shouted, a conversion of iKillCount.
The script added to the normal orc death trigger:
object oKillCountSign = oKillCountSign;
int iKillCountTwo = GetLocalInt(oKillCountSign,"iKillCount");
iKillCountTwo++;
SetLocalInt (oKillCountSign,"iKillCount",iKillCountTwo);
And this is the script for the heartbeat trigger of oKillCountSign:
void main()
{
string sKillCount = IntToString(GetLocalInt(OBJECT_SELF,"iKillCount"));
SpeakString(sKillCount);
}
What is currently happening is that the sign shouts '0' every six seconds, meaning that somewhere along the line the local integer iKillCount is not being manipulated properly. Is it not possible for one object to permanently manipulate the variable of another object?
Modifié par dndfreak, 09 juillet 2012 - 04:49 .