Jump to content

Item cheat?


Lehcar

Recommended Posts

I think the author on cheathappens added manually each item to the script because there isn't any ResourceToString function in the toolset yet. I tried for instance UT_AddItemToInventory(sItemTag, nAmount);

additem.nss - additem.nss(57): Declaration does not match parameters (while compiling var_constants_h.nss)

 

The main issue is when the user types in runscript additem R"item.uti". The UT_AddItemToInventory function only accepts resources not strings and because you can't convert them you have to hardcode the whole function:

 

//found on social.bioware
resource StringToResource( string sTemplate )
{ if( sTemplate != "" )
 { sTemplate = StringLowerCase( sTemplate );
   if( sTemplate == "chicken.utc" ) return R "chicken.utc";
   if( sTemplate == "hurlock.utc" ) return R "hurlock.utc";
   // etc for every possible resource.
 }

 return R "";
}

Link to comment
Share on other sites

@Don_Kain

This mod spawns only merchants but isn't an additem console command.

 

@Lehcar

I made the additem script:

// -----------------------------------------------------------------------------
// additem
// -----------------------------------------------------------------------------
/*
   Adds an item to the player

   Usage:

       runscript additem <item tag> <amount>

       <item tag> - Resource of item to add to inventory
       <amount>   - Amount of this item to add to inventory

   Example:

       runscript additem gen_im_acc_amu_am17.uti 4

*/
// -----------------------------------------------------------------------------
// hdhd
// -----------------------------------------------------------------------------

 

I would post the whole code but it is too big (1255 lines). I generated it with a php script (could probably be improved some more, but it's working :biggrin: )

//script to generate the StringToResource function, *.uti files have to be exported with the toolset
<?php

$path="c:\exported";
$file="file1.txt";
$fp = fopen($file, 'w');

chdir($path);
fwrite($fp, "resource StringToResource( string sTemplate ) {\n");
fwrite($fp, "  if( sTemplate != \"\" ) {\n");
fwrite($fp,  "    sTemplate = StringLowerCase( sTemplate ); \n");    
foreach (glob("*.uti") as $filename) {
 fwrite($fp, "   if (sTemplate == \"" . $filename . "\") return R\"" . $filename . "\"; \n ");
}
fwrite($fp, "  }\n");
fwrite($fp, "  return R\"\";\n");
fwrite($fp, "}\n");

Link to comment
Share on other sites

I would post the whole code but it is too big (1255 lines). I generated it with a php script (could probably be improved some more, but it's working :biggrin: )

 

Could always pastebin it if you don't want to post that big of a script in the post. http://paste2.org/new-paste

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...