Test to see if campaign object exists without creating it? (Supposed to be in Scripting discussion)
NeverwinterWights
Member Posts: 340
I might be overthinking this, but I can't seem to find a function to just check if a campaign object exists in a specified campaign database without actually creating the object. RetrieveCampaignObject(); seems to HAVE to create the object somewhere even if you don't actually want to create it yet. And there is no simple GetCampaignObject(); check.
Post edited by JuliusBorisov on
0
Comments
int GetCampaignObjectExists(string sCampaignName, string sVarName, object oPlayer = OBJECT_INVALID) { string sPlayerId = ""; if (oPlayer != OBJECT_INVALID && GetIsPC(oPlayer)) sPlayerId = GetStringLeft(GetPCPlayerName(oPlayer), 16) + GetStringLeft(GetName(oPlayer), 16); sqlquery sql = SqlPrepareQueryCampaign(sCampaignName, "SELECT * FROM db WHERE varname = @varname AND vartype = @vartype" + (sPlayerId != "" ? " AND playerid = @playerid" : "") + ";"); SqlBindString(sql, "@varname", sVarName); SqlBindInt(sql, "@vartype", 79); if (sPlayerId != "") SqlBindString(sql, "@playerid", sPlayerId); return SqlStep(sql); }