Disable Speaking command

Started by Slasher, Sat 19/08/2017 13:20:52

Previous topic - Next topic

Slasher

Hi,

I'm using the code below to run if a Character is Talking or not and then to set their Transparency:

Code: ags

 if(cMulder.Speaking==true)
cMulder.Transparency=0;
else cMulder.Transparency=100;
if(cSkimmer.Speaking==true)
cSkimmer.Transparency=0;
else cSkimmer.Transparency=100;
if(cScully.Speaking==true)
cScully.Transparency=0;
else cScully.Transparency=100;
if(cSmoking.Speaking==true)
cSmoking.Transparency=0;
else cSmoking.Transparency=100;
if(cOtto.Speaking==true)
cOtto.Transparency=0;
else cOtto.Transparency=100;
if(cDaughter.Speaking==true)
cDaughter.Transparency=0;
else cDaughter.Transparency=100;
if(cEgo.Speaking==true)
cEgo.Transparency=0;
else cEgo.Transparency=100;
if(cNARR.Speaking==true)
cNARR.Transparency=0;
else cNARR.Transparency=100;
if(cKimble.Speaking==true)
cKimble.Transparency=0;
else cKimble.Transparency=100;
if(cBouncer.Speaking==true)
cBouncer.Transparency=0;
else cBouncer.Transparency=100;
if(cSubman.Speaking==true)
cSubman.Transparency=0;
else cSubman.Transparency=100;
if(cBoatman.Speaking==true)
cBoatman.Transparency=0;
else cBoatman.Transparency=100;
if(cNaziWare.Speaking==true)
cNaziWare.Transparency=0;
else cNaziWare.Transparency=100;


The Speaking command property appears to be View only so can't set it to off...

A character appears in room and shows momentarily before it goes Transparent 100 until they talk.

I need a way for the room to disable speaking until they actually speak..

arj0n

Why not set all of them to Transparency=100 in room_Load?

Crimson Wizard

#2
Quote from: arj0n on Sat 19/08/2017 17:08:03
Why not set all of them to Transparency=100 in room_Load?
Yes, the actual problem is perhaps that your code does not run immediately at the room load, so there is a split second when transparency was not applied yet.



Also, this may be a simplier way to code this ;):
Code: ags

int i;
while(i < Game.CharacterCount)
{
  // Check every character in the room and adjust their transparency
  if (character[i].Room == player.Room)
  {
    if(character[i].Speaking)
      character[i].Transparency=0;
    else character[i].Transparency=100;
  }
  i++;
}

Slasher


SMF spam blocked by CleanTalk