help setting random local int
Knight_Shield
Member Posts: 51
I want to check for item when PC opens door then set random of 4 chooses local int on pc and party.
Here's what I have so far.
void main()
{
object oPC = GetLastOpenedBy();
if (!GetIsPC(oPC)) return;
if (GetItemPossessedBy(oPC, "mg_key1")== OBJECT_INVALID)
return;
object oPartyM = GetFirstFactionMember(oPC);
// If not in party avoid loop
if(!GetIsObjectValid(oPartyM))
{
SetLocalInt(oPartyM,"randomport",1);
return;
}
while(GetIsObjectValid(oPartyM))
{
SetLocalInt(oPartyM,"randomport",1);
oPartyM = GetNextFactionMember(oPC);
}
}
thnx in advance as always
Here's what I have so far.
void main()
{
object oPC = GetLastOpenedBy();
if (!GetIsPC(oPC)) return;
if (GetItemPossessedBy(oPC, "mg_key1")== OBJECT_INVALID)
return;
object oPartyM = GetFirstFactionMember(oPC);
// If not in party avoid loop
if(!GetIsObjectValid(oPartyM))
{
SetLocalInt(oPartyM,"randomport",1);
return;
}
while(GetIsObjectValid(oPartyM))
{
SetLocalInt(oPartyM,"randomport",1);
oPartyM = GetNextFactionMember(oPC);
}
}
thnx in advance as always
0
Comments
You also need to make one pass to get PCs and one to get the NPCs in the party.
Does this look like what you are going for?