Skip to content

Why isnt this working?

I have a conversation with a realtor that sells properties. When the realtor sells a property it gives the deed and marks the item as sold.
void main()
{
    // Get the PC who is in this conversation.
    object oPC = GetPCSpeaker();
    string pcname = GetName (oPC);
    // Give deed to the PC.
    CreateItemOnObject("deedwork003", oPC);
    // mark property as sold
    SetCampaignInt ("housing","workshop3",1,oPC);
    // debug
    int itest = GetCampaignInt("housing","workshop3",oPC);
    string stest = IntToString (itest);
    FloatingTextStringOnCreature ("Int is now "+stest, oPC);
    // assign name for sign
    SetCampaignString ("housing","workshop3",pcname,oPC);
     // Take 10000 gold from the PC.
    TakeGoldFromCreature(10000, oPC, TRUE);
}

Then each property in the conversation tree checks to see if its available to show up in the conversation
int StartingConditional()
{

    // Inspect local variables
     object oPC = GetPCSpeaker ();
     if(GetCampaignInt("housing", "workshop3",oPC) > 0)
        return FALSE;

    return TRUE;
}

Problem is that the property is still showing up after its sold -
What am I doing wrong?

Comments

  • CalgacusCalgacus Member Posts: 273
    Just a guess here but:
    Have you tried getting and setting your campaign ints without passing the oPC but passing OBJECT_INVALID instead? In your script as it is now I'm thinking that if PC Tom buys the property and then later PC Bob comes by the call to GetCampaignInt("housing", "workshop3",oPC) in StartingConditional will return 0 because oPC at that time will be Bob rather than Tom whom the variable was attached to in the SetCampaignInt command.
  • vonstormvonstorm Member Posts: 66
    The original script was
    SetCampaignInt ("housing","workshop3",1);
    
    and that didnt work. Maybe I should grab the realtor Object? (NPC speaking)
    Ill play with it and see if it makes a difference. Thanks for taking the time, its the small things like this that are killing me :)
  • vonstormvonstorm Member Posts: 66
    Nope - OBJECT_INVALID didnt work either.
  • HimmelweissHimmelweiss Member Posts: 72
    It isn't working because you are overwriting the var "workshop3 (int)" with "workshop3 (string)"
        SetCampaignInt ("housing","workshop3",1,oPC);
        SetCampaignString ("housing","workshop3",pcname,oPC);
    

  • vonstormvonstorm Member Posts: 66
    And the light goes on.... Thank you I was assuming it would allow both.
  • vonstormvonstorm Member Posts: 66
    That did it. Thanks to both Himmelweiss for the fix and Calgacus for pointing out the multiplayer issue. Much appreciated.
Sign In or Register to comment.