Quick question on local variables and scripts
#1
Posté 01 août 2011 - 04:17
Alassirana
#2
Posté 01 août 2011 - 04:49
void main()
{
object oPC = GetItemActivatedTarget();
if (!GetIsPC(oPC)) return; //End if this isn't a PC
object oInvItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oPC)) {
if (GetLocalInt(oInvItem, "YourFactionVariable")) {
SetPlotFlag(oInvItem, FALSE);
DestroyObject(oInvItem);
}
oInvItem = GetNextItemInInventory(oPC);
}
}
Modifié par Thayan, 01 août 2011 - 04:49 .
#3
Posté 01 août 2011 - 05:07
#4
Posté 02 août 2011 - 12:50
#5
Posté 02 août 2011 - 07:21
Axe_Murderer wrote...
You don't have to turn off the plot flag to destroy an item.
I'm guessing that is meant as a failsafe in case the item was marked as plot. Turning off the plot flag on a non-plot marked item won't do anything.
#6
Posté 02 août 2011 - 08:05
_Knightmare_ wrote...
Axe_Murderer wrote...
You don't have to turn off the plot flag to destroy an item.
I'm guessing that is meant as a failsafe in case the item was marked as plot. Turning off the plot flag on a non-plot marked item won't do anything.
It doesn't matter if it's checked as plot though. Like Axe said you don't have to set plot to false. You can destroy any plot item, object, or creature via scripting without having to uncheck it's plot flag using the "DestroyObject" function. You just can't destroy them in game via spells or damage. So that is just an unnecessary line in the script. The Lexicon doesn't really clarify this.
Modifié par GhostOfGod, 02 août 2011 - 08:22 .
#7
Posté 04 août 2011 - 12:30
void main()
{
object oPC = GetItemActivatedTarget();
if (!GetIsPC(oPC)) return; //End if this isn't a PC
SetDeity(oPC, "Fate");
object oInvItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oPC)) {
if (GetLocalInt(oInvItem, "fate")) {
DestroyObject(oInvItem);
}
oInvItem = GetNextItemInInventory(oPC);
}
}
#8
Posté 04 août 2011 - 12:33
void main()
{
object oPC = GetItemActivatedTarget();
if (!GetIsPC(oPC)) return; //End if this isn't a PC
SetDeity(oPC, "Fate");
object oInvItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oPC)) {
if (GetLocalInt(oInvItem, "fate")) {
DestroyObject(oInvItem);
}
oInvItem = GetNextItemInInventory(oPC);
}
}
#9
Posté 04 août 2011 - 12:47
[nwscript]void main()
{ object oPC = GetItemActivatedTarget();
if( !GetIsPC( oPC )) return; // End if this isn't a PC
SetDiety( oPC, "Fate" );
object oInvItem = GetFirstItemInInventory( oPC );
while( GetIsObjectValid( oInvItem ))
{ if( GetLocalInt( oInvItem, "Fate" )) DestroyObject( oInvItem );
oInvItem = GetNextItemInInventory( oPC );
}
}[/nwscript]
Modifié par Axe_Murderer, 04 août 2011 - 12:53 .
#10
Posté 04 août 2011 - 01:34
#11
Posté 04 août 2011 - 01:39
#12
Posté 04 août 2011 - 01:42
#13
Posté 18 août 2011 - 02:32
Thanks in advance.
Alassirana
#14
Posté 18 août 2011 - 03:21
#15
Posté 18 août 2011 - 06:24
#16
Posté 18 août 2011 - 06:41
#17
Posté 18 août 2011 - 06:42
#18
Posté 18 août 2011 - 07:03
object oPButton = GetItemPossessedBy(oPC, "PanicButton");
int iFokual = GetLocalInt(oPButton, "Fokual");
if (iFokual == TRUE)
{
//do something
}
If I'm understanding correctly. haha. Hope it helps.
P.S. It is also good practice to specify "items" as apposed to "objects" when talking about items in player inventory. "Objects" are usually going to be placeables. While they are all objects, it just gets confusing when talking about these things sometimes.
Modifié par GhostOfGod, 18 août 2011 - 07:06 .
#19
Posté 18 août 2011 - 07:22
#20
Posté 27 août 2011 - 08:14
int StartingConditional()
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();
object oPButton = GetItemPossessedBy(oPC, "panicbutton");
int iFokual = GetLocalInt(oPButton, "Fokual");
if (iFokual == TRUE)
return FALSE;
// If we make it this far, we have passed all tests.
return TRUE;
}
I've tried making iFokual != TRUE, and that makes it disappear for my character with the variables...so I'm doing something wrong here..
Alassirana
#21
Posté 27 août 2011 - 08:39
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();
object oPButton = GetItemPossessedBy(oPC, "panicbutton");
int iFokual = GetLocalInt(oPButton, "Fokual");
if (iFokual == TRUE || oPButton == OBJECT_INVALID)
return FALSE;
// If we make it this far, we have passed all tests.
return TRUE;
}
#22
Posté 27 août 2011 - 08:59
So... if PC *has* oPButton and iFokual is *not* set, it will return true...Lightfoot8 wrote...
...
object oPButton = GetItemPossessedBy(oPC, "panicbutton");
int iFokual = GetLocalInt(oPButton, "Fokual");
if (iFokual == TRUE || oPButton == OBJECT_INVALID)
return FALSE;
...
But, if I read Alassirana correctly, her problem is that it is still returning TRUE, i.e. iFokual is SET, regardless of "who did not have the local variables set"...
Try having the PC speak the value of iFokual to see if it has somehow been set somewhere along the line?
<...sighs and takes off his boots>
#23
Posté 27 août 2011 - 09:49
#24
Posté 27 août 2011 - 09:55
Alassirana wrote...
I've gone into Leto, looked at the item in question, and it did not have the variables. I've also gone into the toolset, verified that the variables were not set in the toolset...and still it comes up in the game as ringing true to having the variables, though she does not have them. I'm really very, very confused by all of this, and don't know how to fix it...it's almost enough to make me go back to using tokens that the player will complain about filling up their inventory, just to make it necessary to walk to a town before being able to port to it.
Are there any other items by the same tag?
#25
Posté 27 août 2011 - 10:00





Retour en haut






