Datacube text vs. Note text?

Talk about any Deus Ex game modification here, e.g. maps, package or a total conversion.

Moderator: Forum Guards

Datacube text vs. Note text?

Postby eeZee » Mon Oct 24, 11 6:59 am

Is there an easy way to have it so that a Datacube says one thing, but registers another thing in your notes?

Simple example: A datacube reads "Hey Jimmy, blah blah blah blah blah long weekend blah blah blah protocols blah blah blah security door blah blah code is 1234 blah blah blah have a good time." and the note in the UI registers as "The code to the security door is 1234"?
eeZee
Newbie
 
Posts: 22
Joined: Thu Sep 29, 11 2:36 am

Postby SimonDenton » Thu Dec 29, 11 12:41 pm

I do have one method, this is a first attempt:

1. Write your desired concise sentence as a text file.
2. Import a custom datacube in order to edit one simple property

[spoiler]
Code: Select all
//=============================================================================
// DataCube2.
//=============================================================================
class DataCube2 extends DataCube;

defaultproperties
{
    bAddToVault=False
 
}
[/spoiler]

2. Import the class of and place this custom NoteAddTrigger I got from TNM, in your level.
[spoiler]
Code: Select all
//=============================================================================
// NoteAddTrigger.
//=============================================================================
class NoteAddTrigger expands Trigger;

// Set bCollideActors to False to make it triggered

var() name NoteTag;
var() string Textpackage;
var deusexplayer player;
var string vaultstring;
var bool bFirstParagraph;

function Trigger(Actor Other, Pawn Instigator)
{
   Super.Trigger(Other, Instigator);

   player = DeusExPlayer(Instigator);

   if (player != None)
   {
      givenote();
   }
}

function Touch(Actor Other)
{
   Super.Touch(Other);

   if (IsRelevant(Other))
   {
      player = DeusExPlayer(Other);

      if (player != None)
      {
         givenote();
      }
   }
}

function givenote()
{
   local DeusExTextParser parser;
   local DeusExNote note;

   // First check to see if we have a name
   if ( notetag != '' )
   {
      // Create the text parser
      parser = new(None) Class'DeusExTextParser';
                           
      // Attempt to find the text object
      if ((player != None) && (parser.OpenText(noteTag,TextPackage)))
      {
         parser.SetPlayerName(player.TruePlayerName);

         vaultString = "";
         bFirstParagraph = True;

         while(parser.ProcessText())
            ProcessTag(parser);

         parser.CloseText();

         // Check to see if we need to save this string in the
         // DataVault
            note = player.GetNote(NoteTag);

            if (note == None)
            {
               note = player.AddNote(vaultString,, True);
               note.SetTextTag(NoteTag);
            }
            vaultString = "";
      }
      CriticalDelete(parser);
   }
}

// ----------------------------------------------------------------------
// ProcessTag()
// ----------------------------------------------------------------------

function ProcessTag(DeusExTextParser parser)
{
   local String text;
//   local EDeusExTextTags tag;
   local byte tag;
   local Name fontName;
   local String textPart;

   tag  = parser.GetTag();

   switch(tag)
   {
      case 0:            // TT_Text:
      case 9:            // TT_PlayerName:
      case 10:         // TT_PlayerFirstName:
         text = parser.GetText();

         vaultString = vaultString $ text;
         break;

      // Create a new text window
      case 18:         // TT_NewParagraph:

         // Only add a return if this is not the *first*
         // paragraph.
         if (!bFirstParagraph)
            vaultString = vaultString $ CHR(10) $ CHR(13); //can't use CR()easily

         bFirstParagraph = False;
         break;

   }
}

defaultproperties
{
    TextPackage="MyPackage"
    bTriggerOnceOnly=True
}
[/spoiler]
3. In the note add trigger add the neccessary parameters for adding a note.
4. Do the trigger and events stuff with this trigger and Datacube 2.
5. Test it and let me know how it goes!
Last edited by SimonDenton on Thu Dec 29, 11 12:55 pm, edited 2 times in total.
SimonDenton
Wannabe
 
Posts: 117
Joined: Sun Oct 03, 10 12:06 pm


Return to Modifications

Who is online

Users browsing this forum: No registered users and 106 guests