Weird Problem.

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Weird Problem.

Postby Cozmo » Thu Feb 01, 07 10:33 pm

Well, until today, from last Friday, my internet didn't work. So I coded alot. :)
One thing I made was a dodgy mod that lets you 'talk' to NPC's. It compiled and it's all ok, but there's weird bugs. Example, instead of taking the players name it just says MTLPRI. And it uses the pawn chess piece instead of a mesh. And it doesn't use its name. :shock:

Big, untidy code here. :D If anyone feels like going through it.

Code: Select all
//====================================================
// MPConvoPawn
//
// Cozmo
//
//====================================================
Class MPConvoPawn2 extends ScriptedPawn;

Var DeusExPlayer ConvoPlayer;
Var() class<Pawn> AppearAsClass;
Var bool bHasWarned;
Var() String PawnsName;
//--------------
// ConvoInfo
//--------------
Var(Convo) int ConvoMessages;
Var(Convo) String BusyMessage;
Var(Convo) int TalkTurn;
Var(Convo) String TheWaitMessage;
Var int OnMessage;
Var int PreviousSpeed;
Var String Message;
Var bool bWasSpeaking;
Var bool IsSpeaking;
Var Float deltaTime2;
Var(Messages) String aMessage1;
Var(Messages) String bMessage2;
Var(Messages) String cMessage3;
Var(Messages) String dMessage4;
Var(Messages) String eMessage5;
Var(Messages) String fMessage6;
Var(Messages) String gMessage7;
Var(Messages) String hMessage8;
Var(Messages) String iMessage9;
Var(Messages) String jMessage10;
Var(Messages) String kMessage11;
Var(Messages) String lMessage12;
Var(Messages) String mMessage13;
Var(Messages) String nMessage14;
Var(Messages) String oMessage15;
Var(Messages) String pMessage16;
Var(Messages) String qMessage17;
Var(Messages) String rMessage18;
Var(Messages) String sMessage19;
Var(Messages) String tMessage20;

function BeginPlay()
{
   if(AppearAsClass != None)
   {
      UnfamiliarName=AppearAsClass.PawnsName;
      FamiliarName=AppearAsClass.PawnsName;
           BindName=AppearAsClass.PawnsName;
      Mesh=AppearAsClass.default.Mesh;
      MultiSkins[0]=AppearAsClass.default.MultiSkins[0];
      MultiSkins[1]=AppearAsClass.default.MultiSkins[1];
      MultiSkins[2]=AppearAsClass.default.MultiSkins[2];
      MultiSkins[3]=AppearAsClass.default.MultiSkins[3];
      MultiSkins[4]=AppearAsClass.default.MultiSkins[4];
      MultiSkins[5]=AppearAsClass.default.MultiSkins[5];
      MultiSkins[6]=AppearAsClass.default.MultiSkins[6];
      MultiSkins[7]=AppearAsClass.default.MultiSkins[7];
      Texture=AppearAsClass.default.Texture;
      SetCollisionSize(AppearAsClass.default.CollisionRadius,AppearAsClass.default.CollisionHeight);
      BaseEyeHeight=AppearAsClass.default.BaseEyeHeight;
      AmbientSound=AppearAsClass.default.AmbientSound;
      SoundRadius=AppearAsClass.default.SoundRadius;
      SoundVolume=AppearAsClass.default.SoundVolume;
   }
   else
   {
      Destroy();
   }
}

function Frob(Actor Frobber, Inventory frobWith)
{

//===================================================
//
// THIS SECTION IS TAKEN FROM THE  PAWN.UC
//
//===================================================
   local name animseq;
   local float rnd;
   local float tweentime;

   // update the animation timers that we are using
   animTimer[0] += deltaTime2;
   animTimer[1] += deltaTime2;
   animTimer[2] += deltaTime2;

   if (bIsSpeaking)
   {
      // if our framerate is high enough (>20fps), tween the lips smoothly
      if (Level.TimeSeconds - animTimer[3]  < 0.05)
         tweentime = 0.1;
      else
         tweentime = 0.0;

      // the last animTimer slot is used to check framerate
      animTimer[3] = Level.TimeSeconds;

      if (nextPhoneme == "A")
         animseq = 'MouthA';
      else if (nextPhoneme == "E")
         animseq = 'MouthE';
      else if (nextPhoneme == "F")
         animseq = 'MouthF';
      else if (nextPhoneme == "M")
         animseq = 'MouthM';
      else if (nextPhoneme == "O")
         animseq = 'MouthO';
      else if (nextPhoneme == "T")
         animseq = 'MouthT';
      else if (nextPhoneme == "U")
         animseq = 'MouthU';
      else if (nextPhoneme == "X")
         animseq = 'MouthClosed';

      if (animseq != '')
      {
         if (lastPhoneme != nextPhoneme)
         {
            lastPhoneme = nextPhoneme;
            TweenBlendAnim(animseq, tweentime);
         }
      }
   }
   else if (bWasSpeaking)
   {
      bWasSpeaking = False;
      TweenBlendAnim('MouthClosed', tweentime);
   }

   // blink randomly
   if (animTimer[0] > 2.0)
   {
      animTimer[0] = 0;
      if (FRand() < 0.4)
         PlayBlendAnim('Blink', 1.0, 0.1, 1);
   }
//===================================================
//
// BACK TO MY OWN WORK.
//
// It's always best to avoid the Engine.u It confuses me.
//
//===================================================

   if(ConvoPlayer == None)
   {
      ConvoPlayer = DeusExPlayer(Frobber);
      SetTimer(2.5, true);
      ConvoPlayer.ConsoleCommand("DeactivateAllAugs");
      ConvoPlayer.SetRotation(Rotation+rot(0,0,32808));
      //PreviousSpeed = ConvoPlayer.mpGroundSpeed;
      //ConvoPlayer.mpGroundSpeed = 0;
   }
   else
   {
      DeusExPlayer(Frobber).ClientMessage("|p1"@BindName@": "@BusyMessage);
   }
}

function Timer()
{
   if(OnMessage == 0)
   {
      Message = TheWaitMessage;
   }

   if(OnMessage == 1)
   {
      Message = aMessage1;
   }

   if(OnMessage == 2)
   {
      Message = bMessage2;
   }

   if(OnMessage == 3)
   {
      Message = cMessage3;
   }

   if(OnMessage == 4)
   {
      Message = dMessage4;
   }

   if(OnMessage == 5)
   {
      Message = eMessage5;
   }

   if(OnMessage == 6)
   {
      Message = fMessage6;
   }

   if(OnMessage == 7)
   {
      Message = gMessage7;
   }

   if(OnMessage == 8)
   {
      Message = hMessage8;
   }

   if(OnMessage == 9)
   {
      Message = iMessage9;
   }

   if(OnMessage == 10)
   {
      Message = jMessage10;
   }

   if(OnMessage == 11)
   {
      Message = kMessage11;
   }

   if(OnMessage == 12)
   {
      Message = lMessage12;
   }

   if(OnMessage == 13)
   {
      Message = mMessage13;
   }

   if(OnMessage == 14)
   {
      Message = nMessage14;
   }

   if(OnMessage == 15)
   {
      Message = oMessage15;
   }

   if(OnMessage == 16)
   {
      Message = pMessage16;
   }

   if(OnMessage == 17)
   {
      Message = qMessage17;
   }

   if(OnMessage == 18)
   {
      Message = rMessage18;
   }

   if(OnMessage == 19)
   {
      Message = sMessage19;
   }

   if(OnMessage == 20)
   {
      Message = tMessage20;
   }

   if(ConvoPlayer != None)
   {
      if(TalkTurn == 0)
      {
         if(OnMessage <= ConvoMessages)
         {
            ConvoPlayer.ClientMessage("|p1"@BindName@": "@Message);
            TalkTurn = 1;
            OnMessage += 1;
         }
         else
         {
            //ConvoPlayer.mpGroundSpeed = PreviousSpeed;
            ConvoPlayer = None;
            TalkTurn = default.TalkTurn;
            OnMessage = 0;
            SetTimer(0.0, false);
         }
      }
      else
      {
         ConvoPlayer.ClientMessage("|p1"@ConvoPlayer.PlayerReplicationInfo.Name@": "@Message);
         TalkTurn = 0;
         OnMessage += 1;
      }
   }
   else
   {
      LoopAnim('BreatheLight',, 0.4);
   }

   if(OnMessage == 0)
   {
      LoopAnim('BreatheLight',, 0.4);
   }

}

defaultproperties
{
     PawnsName="Warning, no name set!"
     GroundSpeed=0
     TheWaitMessage="(Please wait...)"
     TalkTurn=0
     ConvoMessages=0
     BusyMessage="I'm already talking to someone... Wait a minute."
}
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby MainMan » Thu Feb 01, 07 11:07 pm

To make it have a mesh, set DrawType=DT_Mesh (or alternatively make it extend HumanCivilian or HumanMilitary, etc).

For the problem of the Player's name, change
Code: Select all
ConvoPlayer.PlayerReplicationInfo.Name

to
Code: Select all
ConvoPlayer.PlayerReplicationInfo.PlayerName


Wow, i'm surprised how similar this is to the conversation system in my mod. Great minds think alike eh?
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK

Postby Cozmo » Fri Feb 02, 07 9:09 pm

Thanks MainMan. :D

Wow, i'm surprised how similar this is to the conversation system in my mod. Great minds think alike eh?


I actually thought I'd done it really weirdly. :D
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Allan » Sat Feb 03, 07 6:52 pm

Wow, nice work Cozmo :D
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Spiderbot01 » Sat Feb 03, 07 10:07 pm

I have no idea why I asked for access to this section.

I just don't like being left out :(
<center>------</center><center>
Image</center>
<center>Image</center><
User avatar
Spiderbot01
Alpha
 
Posts: 5363
Joined: Wed Nov 30, 05 8:24 pm
Location: LONDON!!!!

Postby Cozmo » Sat Feb 03, 07 10:58 pm

Thanks Allan. :D
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Re: Weird Problem.

Postby Allan » Sun Feb 04, 07 1:01 am

I've just had a look at it again, as NTL's internet's being up and down like a very bouncy something.
Prehaps to save on eye-strain, If statements, and Global Variables, you should make all the parts like "Var(Messages) String aMessage1;" into one big array, then change the If's in Timer. I think it should work like this:

Code: Select all
//====================================================
// MPConvoPawn
//
// Cozmo
//
//====================================================
Class MPConvoPawn2 extends ScriptedPawn;

Var DeusExPlayer ConvoPlayer;
Var() class<Pawn> AppearAsClass;
Var bool bHasWarned;
Var() String PawnsName;
//--------------
// ConvoInfo
//--------------
Var(Convo) int ConvoMessages;
Var(Convo) String BusyMessage;
Var(Convo) int TalkTurn;
Var(Convo) String TheWaitMessage;
Var int OnMessage;
Var int PreviousSpeed;
Var String Message;
Var bool bWasSpeaking;
Var bool IsSpeaking;
Var Float deltaTime2;
Var(Messages) string ConvoMessage[19]; // This is 19 "Var String"s, compressed into one bit. I think.

function BeginPlay()
{
   if(AppearAsClass != None)
   {
      UnfamiliarName=AppearAsClass.PawnsName;
      FamiliarName=AppearAsClass.PawnsName;
           BindName=AppearAsClass.PawnsName;
      Mesh=AppearAsClass.default.Mesh;
      MultiSkins[0]=AppearAsClass.default.MultiSkins[0];
      MultiSkins[1]=AppearAsClass.default.MultiSkins[1];
      MultiSkins[2]=AppearAsClass.default.MultiSkins[2];
      MultiSkins[3]=AppearAsClass.default.MultiSkins[3];
      MultiSkins[4]=AppearAsClass.default.MultiSkins[4];
      MultiSkins[5]=AppearAsClass.default.MultiSkins[5];
      MultiSkins[6]=AppearAsClass.default.MultiSkins[6];
      MultiSkins[7]=AppearAsClass.default.MultiSkins[7];
      Texture=AppearAsClass.default.Texture;
      SetCollisionSize(AppearAsClass.default.CollisionRadius,AppearAsClass.default.CollisionHeight);
      BaseEyeHeight=AppearAsClass.default.BaseEyeHeight;
      AmbientSound=AppearAsClass.default.AmbientSound;
      SoundRadius=AppearAsClass.default.SoundRadius;
      SoundVolume=AppearAsClass.default.SoundVolume;
   }
   else
   {
      Destroy();
   }
}

function Frob(Actor Frobber, Inventory frobWith)
{

//===================================================
//
// THIS SECTION IS TAKEN FROM THE  PAWN.UC
//
//===================================================
   local name animseq;
   local float rnd;
   local float tweentime;

   // update the animation timers that we are using
   animTimer[0] += deltaTime2;
   animTimer[1] += deltaTime2;
   animTimer[2] += deltaTime2;

   if (bIsSpeaking)
   {
      // if our framerate is high enough (>20fps), tween the lips smoothly
      if (Level.TimeSeconds - animTimer[3]  < 0.05)
         tweentime = 0.1;
      else
         tweentime = 0.0;

      // the last animTimer slot is used to check framerate
      animTimer[3] = Level.TimeSeconds;

      if (nextPhoneme == "A")
         animseq = 'MouthA';
      else if (nextPhoneme == "E")
         animseq = 'MouthE';
      else if (nextPhoneme == "F")
         animseq = 'MouthF';
      else if (nextPhoneme == "M")
         animseq = 'MouthM';
      else if (nextPhoneme == "O")
         animseq = 'MouthO';
      else if (nextPhoneme == "T")
         animseq = 'MouthT';
      else if (nextPhoneme == "U")
         animseq = 'MouthU';
      else if (nextPhoneme == "X")
         animseq = 'MouthClosed';

      if (animseq != '')
      {
         if (lastPhoneme != nextPhoneme)
         {
            lastPhoneme = nextPhoneme;
            TweenBlendAnim(animseq, tweentime);
         }
      }
   }
   else if (bWasSpeaking)
   {
      bWasSpeaking = False;
      TweenBlendAnim('MouthClosed', tweentime);
   }

   // blink randomly
   if (animTimer[0] > 2.0)
   {
      animTimer[0] = 0;
      if (FRand() < 0.4)
         PlayBlendAnim('Blink', 1.0, 0.1, 1);
   }
//===================================================
//
// BACK TO MY OWN WORK.
//
// It's always best to avoid the Engine.u It confuses me.
//
//===================================================

   if(ConvoPlayer == None)
   {
      ConvoPlayer = DeusExPlayer(Frobber);
      SetTimer(2.5, true);
      ConvoPlayer.ConsoleCommand("DeactivateAllAugs");
      ConvoPlayer.SetRotation(Rotation+rot(0,0,32808));
      //PreviousSpeed = ConvoPlayer.mpGroundSpeed;
      //ConvoPlayer.mpGroundSpeed = 0;
   }
   else
   {
      DeusExPlayer(Frobber).ClientMessage("|p1"@BindName@": "@BusyMessage);
   }
}

function Timer()
{
   if(OnMessage <= 0) // Set to "Less than, or Equal to", as you never
know what prat's going to try and f**k with your pawns using admin.
   {
      Message = TheWaitMessage;
   }

   else
   {
      Message = ConvoMessage[OnMessage-1];
      // This is -1, because Arrays start from 0, and count up, not 1.
      //Sadly, it's how the language was made, and we can't make it make more sense... :(
   }

   if(ConvoPlayer != None)
   {
      if(TalkTurn == 0)
      {
         if(OnMessage <= ConvoMessages)
         {
            ConvoPlayer.ClientMessage("|p1"@BindName@": "@Message); // Hmm... This might give some weird results when it's put in a ClientMessage. Not sure though
            TalkTurn = 1;
            OnMessage += 1;
         }
         else
         {
            //ConvoPlayer.mpGroundSpeed = PreviousSpeed;
            ConvoPlayer = None;
            TalkTurn = default.TalkTurn;
            OnMessage = 0;
            SetTimer(0.0, false);
         }
      }
      else
      {
         ConvoPlayer.ClientMessage("|p1"@ConvoPlayer.PlayerReplicationInfo.PlayerName@": "@Message);
         TalkTurn = 0;
         OnMessage += 1;
      }
   }
   else
   {
      LoopAnim('BreatheLight',, 0.4);
   }

   if(OnMessage == 0)
   {
      LoopAnim('BreatheLight',, 0.4);
   }

}

defaultproperties
{
     PawnsName="Warning, no name set!"
     GroundSpeed=0
     TheWaitMessage="(Please wait...)"
     TalkTurn=0
     ConvoMessages=0
     BusyMessage="I'm already talking to someone... Wait a minute."
     DrawType=DT_Mesh
}


That makes it look more neat IMO :) (I've fixed what MainMan brought up in this too :)
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby MainMan » Sun Feb 04, 07 1:05 am

True, but I've kinda given up on neatness in coding. For example, this is a real extract from some code in my mod:
Code: Select all
if(bullshit != none)
{
klopisgay += 1;
bbq.destroy();
}
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK

Postby Allan » Sun Feb 04, 07 1:14 am

ROFL. What class uses a variable called "KlopIsGay"? A ScrollingScriptedTexture with "Klop Is Gay!" as the message?
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Mastakilla » Sun Feb 04, 07 2:32 pm

Why are people still obsessed with Klop's sexual preference :(
When life gives you lemons... Squeeze them into your eyes and run across a busy intersection, faggot.
User avatar
Mastakilla
Forum Super Hero
 
Posts: 3634
Joined: Wed Aug 17, 05 7:47 pm

Postby Dae » Sun Feb 04, 07 3:51 pm

[A]MastaKilla wrote:Why are people still obsessed with Klop's sexual preference :(

Doesn't "gay" in traditional English mean something like "happy"?
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Gishank » Sun Feb 04, 07 4:09 pm

Indeed it does.

And Mainman... I think you'll find i'm not gay in your terms of speech.
Image
Gishank
Forum Super Hero
 
Posts: 4235
Joined: Sun Aug 28, 05 9:17 am
Location: London, England.

Postby Cozmo » Sun Feb 04, 07 9:12 pm

@ Allan, yeah, I should've used arrays, but I only asked Nobody about them yesterday. :)
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby ~ô¿ô~Nobody~ » Sun Feb 04, 07 9:32 pm

I was about to give you an example, about loops, but you needed to go. :(
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby Cozmo » Sun Feb 04, 07 9:33 pm

~[A]N00body~ wrote:I was about to give you an example, about loops, but you needed to go. :(


Then post it here please? :D
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby ~ô¿ô~Nobody~ » Sun Feb 04, 07 10:00 pm

Umm.. now I don't have time, but I will when I have.
Nobody is perfect...
------------------------------
Longc[A]t wrote:I still think Dae is a russian spambot.

~[A]Daedalus~ wrote:There will be a day when my patience goes away and you, along with all who rant with you, will get banned.

ô¿ô¥[GODZ]¥NOCHANC wrote:I can ban any one I want ANY time I want. You have no rights here.
User avatar
~ô¿ô~Nobody~
Alpha
 
Posts: 2520
Joined: Fri Dec 31, 04 3:20 pm
Location: Proclarush Taonas

Postby ~ScArFaCe~ » Sun Feb 18, 07 11:05 pm

thnx for sendin this mod 2 me. i tried it earlier and its excellent. gd job mate.
could u add some more stuff to it like item transfers? if not fair enuff :D
ScArFaCe
Image
Sig by Baleout
User avatar
~ScArFaCe~
Newbie
 
Posts: 43
Joined: Thu Sep 14, 06 9:50 pm
Location: England

Postby Cozmo » Sun Feb 18, 07 11:10 pm

{DXC}ScArFaCe wrote:thnx for sendin this mod 2 me. i tried it earlier and its excellent. gd job mate.
could u add some more stuff to it like item transfers? if not fair enuff :D


I was planning to, but at the time I didn't have an idea how to change it without having LOADS of variables. I'll try when I got time. :)
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Andrievskaya Veronika » Thu Apr 19, 07 1:20 pm

I have problem with MissionScript.

here is fragment (used in Function Timer()):

Code: Select all

   if (!flags.GetBool('Skills1_given')) // Если это еще не сделано...
      ForEach AllActors(class'Greasel',G)
      Count++;
      If (count==0)
      {   // то сделать это....
         DXP.ClientMessage("You killed all greasels! So get bonus: 2000 points of skillpoints ;)");
         DXP.SkillPointsAdd(2000);
         flags.SetBool('Skills1_given', true); // и защитить от повторного получения навыка...
      }
      



When all greasels killed, player should get 2000 skillpoints only ONE TIME. But skillpoints are added infinitely. What wrong? :o
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Alex » Thu Apr 19, 07 2:05 pm

How is your Timer initiated? by SetTimer(TIME HERE, True);?

That True value, means it loops. The function syntax is like this:
Code: Select all
SetTimer(Time, bLoop);
(With loop it is meant that it repeats itself.)
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Andrievskaya Veronika » Thu Apr 19, 07 5:23 pm

I never seen this in MissionScript.

Code: Select all
function Timer()
{
local Switch2 P;
local Greasel G;
local int Count;
local DeusExPlayer DXP;

DXP=DeusExPlayer(GetPlayerPawn());

      Super.timer();
.............


Anyway, i think timer in MissionScript should always loop, to check what happening on map, etc. :)
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Alex » Thu Apr 19, 07 5:28 pm

I see. And I also see you use flags, to check if the player already has the reward. I personally have no experience with flags, I usually just use a boolean in the script, and check if that is set to true or false.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Andrievskaya Veronika » Fri Apr 20, 07 7:55 am

oh, i solved my problem :D

Code: Select all
function Timer()
{
   local Switch2 P;
   local Greasel G;
   local int Count;
   local DeusExPlayer DXP;

   DXP=DeusExPlayer(GetPlayerPawn());

               Super.timer();
//-------------------------------------                              
// Защита от повторного нажатия кнопки. Не самая лучшая, BTW.
   if (flags.GetBool('Generator_is_on'))
   {   
      foreach AllActors(class'Switch2', P)
      {   //-------------------------------------
         P.SetCollisionSize(0, 0);
      }   //-------------------------------------
   }   
//-------------------------------------
// Бонус для любителей отстрела гризелов: если убили всех то дать 2000 очков навыка.
   if (!flags.GetBool('Skills1_given'))  // Если это еще не сделано...
//   if (!K)
   {
      ForEach AllActors(class'Greasel',G)
      Count++;
      log("Count greaSelS....");
      If (count==0)
      {   // то сделать это....
   log("No greasels for now.......");
         DXP.ClientMessage("You killed all greasels! So get bonus: 2000 points of skillpoints ;)");
         DXP.SkillPointsAdd(2000);
   log("Set K to true..........");
//         K=true;
         flags.SetBool('Skills1_given', true); // и защитить от повторного получения навыка...
      }
   }
}





i forgot about additional brackets (after // if (!K)) :)
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Andrievskaya Veronika » Mon Sep 24, 07 12:21 pm

I want to randomly change skins for Greasels, using MissionScript, but i don't have idea how i can do this. Of course, i can edit my map change tag for greasels, but i don't want to touch the map...

Any ideas? For example i have 100 greasels on map and i want to change TAG to something other only for 50 of them.
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Dae » Mon Sep 24, 07 12:33 pm

dunno if it's what you wanted, but each object has a name which consists of a class name + index, e.g Greasel1, or Greasel14. You could create an iteration, which would run through the indexes until it reaches 50.
Last edited by Dae on Mon Sep 24, 07 12:33 pm, edited 1 time in total.
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Alex » Mon Sep 24, 07 2:46 pm

Code: Select all
  local Greasel graySeal;
  local int i;
  ForEach AllActors(Class'Greasel', greySeal)
  {
    if(i < 50 && greySeal != None)
    {
      i++;
      greySeal.Tag      = 'SomeTagName';
    }
  }


Perhaps that works? I haven't tested it, just wrote it in this quick-post-form.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm

Postby Andrievskaya Veronika » Tue Sep 25, 07 12:18 pm

Yes, it woks. Thanks :)

Code: Select all
 If (!flags.GetBool('GreaelsMarkedRed'))
      ForEach AllActors(class'Greasel', G)
      {
    if(i < 10 && G != None)
       {
      i++;
      G.Tag = 'RedGreasel';
         G.Skin=texture'GreaselTex2'; // Red Greasels
         G.carcassType=class'RedGreaselCarcass'; // Red carcass
         RebuildRedGreasel();
         Flags.SetBool('GreaelsMarkedRed', true);
         }
      }
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby Cozmo » Tue Sep 25, 07 4:59 pm

Just out of curiosity, what's ++? Is that the same as +=1?
Cozmo_RPG (v1 & v2)
MPConversations - A tool for creating multiplayer RPG stuff
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Postby Dae » Tue Sep 25, 07 5:09 pm

yer
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Alex » Thu Sep 27, 07 7:45 pm

~Cozmo~ wrote:Just out of curiosity, what's ++? Is that the same as +=1?

Not sure if it's the same in UC, but in php you have this stuff:
for($i = 0; $i < 10; $i++) (Count $i+1)
but you can also have this:
for($i = 0; $i < 10; ++$i) (Count $i+1 AFTER this current loop)
I never use ++$i though. I think it's correct, as I wrote it in the previous line. Not 100% sure though.
Alex
Alpha
 
Posts: 8067
Joined: Wed Nov 12, 03 4:51 pm


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 2 guests