Aller au contenu

Photo

failure (solved)


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

#1
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
here i have some code that is supposed to remove an item from the "loser" and give an item of the same type to the player. When the player has gained the item the code should not repeat itself. When i activate this code through a dialog the if statement seems to be ignored and the player gains an additional sword even though he's already taken the sword once.

#include "utility_h"
#include "wrappers_h"
#include "plt_takesword"
void main()
{
if(FLAG_0 == FALSE)
{
object oLoser = GetObjectByTag("loser");
RemoveItemsByTag(oLoser,"sword"); //this doesn't seem to work. the loser still has his sword equipped after the dialog is finished
CreateItemOnObject(R"sword.uti", GetHero());
WR_SetPlotFlag(PLT_TAKESWORD, FLAG_0, TRUE);
}
else {}
}

Modifié par gordonbrown82, 07 janvier 2010 - 05:41 .


#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
You are comparing one constant to another. Both FLAG_0 and FALSE are technically equal to 0, so 0 == 0 is always true.
The proper way to check the value of a plot flag would be with
[dascript]
if (WR_GetPlotFlag(PLT_TAKESWORD, FLAG_0) == FALSE)
[/dascript]

Modifié par Craig Graff, 07 janvier 2010 - 05:20 .


#3
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
thanks