For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

is it even possible?..

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

is it even possible?..

Post by []KAOS[]Casey »

to create an actor/object that will persist from level change to keep some information on travel, specifically stored variables such as bools, strings etc. Just wanted to ask here before I bust out the c++ compiler and do some read/write file input/output with the headers.
User avatar
.:..:
OldUnreal Member
Posts: 1637
Joined: Tue Aug 16, 2005 4:35 am

Re: is it even possible?..

Post by .:..: »

Yes! there is 1 way which works based on a hack and it works both on dedicated server and single player mode.

First do this:
Create a new class under 'Console' (in here called class 'StaticData').
On some actor (or object) set the Engine default console class to that (example: Class'Engine'.Default.Console = Class'StaticData') to force engine to keep the information about the class so it dosent get garbage collected.
add variables to 'StaticData' class what you wish to store information about, I.E:

Code: Select all

Class StaticData extends Console;

var MyMapData MapObject;
var bool bBooleanA;
Then fill in the variables:

Code: Select all

Class'StaticData'.Default.MapObject = New(None) Class'MyMapData';
Class'StaticData'.Default.bBooleanA = True;
And so you can read the data after mapchange:

Code: Select all

Log(Class'StaticData'.Default.MapObject@Class'StaticData'.Default.bBooleanA)
Which would give some output like:

Code: Select all

ScriptLog: Transient.MyMapData0 True
Hope this made any sense at all.
Last edited by .:..: on Sat Nov 10, 2007 8:31 pm, edited 1 time in total.
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)
User avatar
.:..:
OldUnreal Member
Posts: 1637
Joined: Tue Aug 16, 2005 4:35 am

Re: is it even possible?..

Post by .:..: »

So a practical example would be:

Code: Select all

Class ActorCounter extends Actor;

var MyMapData MyData;

function PostBeginPlay()
{
      local Actor A;

      if( Class'Engine'.Default.Console==Class'StaticData' )
      {
            MyData = Class'StaticData'.Default.MapData;
            Log("Found old data:"@MyData@MyData.ActorCount);
      }
      else
      {
            Log("Generating new data");
            MyData = New(None) Class'MyMapData';
            ForEach AllActors(Class'Actor',A)
                  MyData.ActorCount++;
            Class'StaticData'.Default.MapData = MyData;
            Class'Engine'.Default.Console = Class'StaticData';
            Log("Counted map actors to"@MyData.ActorCount);
      }
}

Code: Select all

Class MyMapData extends Object;

var int ActorCount;

Code: Select all

Class StaticData extends Console;

var MyMapData MapData;
And summon ActorCounter in 2 maps and you see the output will be on second map something like
"ScriptLog: Found old data: Transient.MyMapData0 2734"
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)
User avatar
Shivaxi
OldUnreal Member
Posts: 2232
Joined: Wed Mar 08, 2006 4:43 pm

Re: is it even possible?..

Post by Shivaxi »

Uscript pwnz
Image  Image
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: is it even possible?..

Post by []KAOS[]Casey »

I found another way before Dots posted, it uses an Object and config(myconfig) with variables flagged as Config, and it saves them using saveconfig();

It works for what I want to do, but i may switch to the method dots has depending if i require it in the long run.
User avatar
Bane
OldUnreal Member
Posts: 493
Joined: Sun Mar 03, 2002 6:32 pm

Re: is it even possible?..

Post by Bane »

Hmm. I see that it'd work for data storage, but is there anyway to call functions using that method, dots? A while back I had tried to make a better chatlog for ICD but gave up after I realized that I had to make a new file for every map because the statlogfile automatically closes on map change and you can't re-open a file in UScript (and I can't figure out native code. Casey don't tell me you finally got it and didn't tell me...).
Author of Hide and Seek mod, and the NALIBALL mod

Hide and Seek can be downloaded from:
http://HideNSeek.5u.com
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: is it even possible?..

Post by []KAOS[]Casey »

Hmm. I see that it'd work for data storage, but is there anyway to call functions using that method, dots? A while back I had tried to make a better chatlog for ICD but gave up after I realized that I had to make a new file for every map because the statlogfile automatically closes on map change and you can't re-open a file in UScript (and I can't figure out native code. Casey don't tell me you finally got it and didn't tell me...).
I gave up because i couldn't get it to work with 225 at all due to no 225 headers, but hopefully we can get some 227 headers so i wont be discouraged.

Return to “UScript Board”