Yeah, me again – same game, but a much more complicated problem now.
Two of my NPCs are twins. In my game, as in life, these twins are treated sometimes as individuals and sometimes as a group. How they are handled depends on whether or not they’re in the same location and doing the same thing.
Ex:
Vs.
After several attempts, I finally came up with something that seems to be capable of handling most of what I want; the twins each belong to a CollectiveGroup, and their ActorStates are all custom-made TwinStates designed to report its own specialDesc and distantDesc when the twin is unique, and nothing when they’re together and in “equivalent” states. The group, natch, has the opposite instructions:
twinGroup: CollectiveGroup 'twins' 'twins'
t1State = twin1.curState
t2State = twin2.curState
desc()
{
"<<twin1.name>> and <<twin2.name>> <<twin1.lastName>> are identical twins. ";
if(t1State.isEqualTo == t2State)
t1State.dittoDesc;
else
inherited;
}
specialDesc()
{
if(t1State.isEqualTo == t2State)
specialDesc = t1State.dittoDesc;
else
specialDesc = nil;
}
distantSpecialDesc()
{
if(t1State.isEqualTo == t2State)
distantSpecialDesc = t1State.distantDittoDesc;
else
distantSpecialDesc = nil;
}
dobjFor(Examine)
{
verify() {}
preCond = [Twin1Seen, Twin2Seen]
}
;
class TwinState: ActorState
dittoDesc = "The twins are here. "
distantDittoDesc = "The twins are off in the distance. "
t1State = twin1.curState
t2State = twin2.curState
identicalStateCheck
{
if(t1State.isEqualTo == t2State)
{
specialDesc = nil;
remoteSpecialDesc = nil;
}
}
;
//Coding is then applied thusly:
twin1: Person 'Tweedle Dum' 'Tweedle Dum'
@beach2
isHim = true
isProperName = true '
desc="Tweedle Dum is a twin "
dittoDesc = curState.dittoDesc
distantDittoDesc = curState.distantDittoDesc
collectiveGroups = [twinGroup]
;
+t1rollerskate : TwinState
isInitState = true
stateDesc = "Tweedledum is rollerskating. "
dittoDesc = "The twins are both rollerskating. "
distantDittoDesc = "The twins are far away, rollerskating."
isEqualTo = t2rollerskate
;
/*
*t2rollerskate is an actorstate in the second twin.
*It does not contain the last 3 properties in t1rollerskate, because twin1 handles all of that coding.
*/
/whew/
It’s probably sloppy, but it does most of what I want. However, there are some problems I can’t seem to hash out.
First of all, while the distantDesc for the CollectiveGroup is working just fine, its specialDesc is not reporting at all. At first I thought it was a coding error (All those brackets and parentheses and semicolons…) but when I replaced it with a simple doublequoted string, (eg., specialDesc = “WORK, YOU STUPID PROGRAM!!!”) I still got nothing. Is there something about collectiveGroups that I’m not aware of, or is there a flaw in my code?
Another problem which I’ve been having involves the Actors themselves. While I’m able to turn off specialDesc and distantDesc in favor of the Group descriptions, the twins are still being reported.
Ex:
How do I turn that off?
Does this all make sense? I can elaborate and provide more of my coding if needs be. I’m just so confused at the moment.