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

Pawn with random skins bonded to Timer

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Pawn with random skins bonded to Timer

Post by mentalhunter »

I tryd many things to make it work but apperantly i am doing something wrong. Anyone knows how to make this work?
Pravin

Re: Pawn with random skins bonded to Timer

Post by Pravin »

Well, afaik Timer is utilized all over the place in pawn code. The safest way to go would be to make some other class have the timer and skin settings logic... You could always make some new playerreplicationinfo class that sets timer and randomizes the pawn's skin after a duration of time, then destroys itself. There are a bunch of approaches to this, just be warned about overriding timer in pawn subclasses.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

Can you give a sample of this? Or is it to hard to post such a code on the forum?
Pravin

Re: Pawn with random skins bonded to Timer

Post by Pravin »

Uhhhh ok... Here's some psuedo-code because I'm unsure of some syntax..

Code: Select all

class MyPRI expands Playerreplicationinfo;

event postbeginplay()
{
     super.postbeginplay();
     settimer(1.0,false);
}

event timer()
{
     if( pawn(owner) != none )
       pawn(owner).setmultiskin ...
}
Then you just have to set the pawn in question's playerreplicationinfoclass to this new pri class.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

and setmultiskin, does that means it will go thru all multiskins filled in the pawn's properties? Ive barrerly ever worked with Replicationinfo, that's why i got so much questions.
User avatar
Age
OldUnreal Member
Posts: 848
Joined: Sat Dec 29, 2007 5:25 pm

Re: Pawn with random skins bonded to Timer

Post by Age »

Simple way without replicationinfo:

Code: Select all

var float Count;
var() texture randskins[40];

function Tick(float DeltaTime)
{      
      Count += DeltaTime;
      if (Count>0.2) // this is the timer
      {
            skin=randskins[rand(40)];
            Count=0.0;
      }
}
Last edited by Age on Fri May 30, 2008 6:24 pm, edited 1 time in total.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

Okay, thank you both.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

Hm. yours isnt working somehow Age, i don't get any errors, but the skin's aren't working in-game.
User avatar
Bane
OldUnreal Member
Posts: 493
Joined: Sun Mar 03, 2002 6:32 pm

Re: Pawn with random skins bonded to Timer

Post by Bane »

I've had very little luck using Tick and Timer inside of pawn (specifically playerpawn; it might be different for a regular pawn). I don't know why, but Tick just doesn't seem to get called at all, and timer has problems because you can only have one timer per object and the pawn code uses it in a few states. I would recommend adding 'simulated function Tick' another class with RemoteRome==Role_SimulatedProxy and use Age's code in there. You'll need to change it change owner.skin instead of just skin, of course, but otherwise it should work fine. It's a simulated function, so it'll be called clientside without any replication.
Author of Hide and Seek mod, and the NALIBALL mod

Hide and Seek can be downloaded from:
http://HideNSeek.5u.com
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

Okay, thanks ill try that.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

I did exactly that, but it still doesn't work, this is what i've got:

Code: Select all


var float Count;
var() texture randskins[2];

simulated function Tick(float DeltaTime)
{      
      Count += DeltaTime;
      if (Count>0.2)
      {
            Owner.skin=randskins[rand(2)];
            Count=0.0;
      }
}

User avatar
Bane
OldUnreal Member
Posts: 493
Joined: Sun Mar 03, 2002 6:32 pm

Re: Pawn with random skins bonded to Timer

Post by Bane »

1. Did you set the remoterole on this actor to Role_simulatedproxy, or spawn it only clientside? If you didn't then Tick won't get called.
2. Did you set owner? If you didn't then it obviously won't work. It'd also generate a bunch of accessed nones in your log.
3. what class did you put that code in? what is it a subclass of? I doubt this matters, I'm just curious.
Author of Hide and Seek mod, and the NALIBALL mod

Hide and Seek can be downloaded from:
http://HideNSeek.5u.com
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

It's subclass is ScriptedPawn. and the code is the queen's. Plus alot of modifications including this one, but this one won't wokr out for me. And at a pawn the Role is automaticly set at Role_Simulated proxy, or do you mean in script?
User avatar
Age
OldUnreal Member
Posts: 848
Joined: Sat Dec 29, 2007 5:25 pm

Re: Pawn with random skins bonded to Timer

Post by Age »

ReplicationInfo, Owner., and simulated function not needed:

Code: Select all

class MyPawn expands ScriptedPawn;

var float Count;
var() texture randskins[2];

function Tick(float DeltaTime)
{      
      Count += DeltaTime;
      if (Count>0.2)
      {
            skin=randskins[rand(2)];
            Count=0.0;
      }
}
Last edited by Age on Sat May 31, 2008 7:52 am, edited 1 time in total.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

I tryd that code before Age, it didn't worked somehow.
User avatar
Age
OldUnreal Member
Posts: 848
Joined: Sat Dec 29, 2007 5:25 pm

Re: Pawn with random skins bonded to Timer

Post by Age »

Forgotten multiskins:

Code: Select all

var float Count;
var() texture randskins[2];

function Tick(float DeltaTime)
{      
      Count += DeltaTime;
      if (Count>0.2)
      {
            skin=randskins[rand(2)];
            multiskins[0]=randskins[rand(2)];
            multiskins[1]=randskins[rand(2)];
            multiskins[2]=randskins[rand(2)];
            multiskins[3]=randskins[rand(2)];
            multiskins[4]=randskins[rand(2)];
            multiskins[5]=randskins[rand(2)];
            multiskins[6]=randskins[rand(2)];
            multiskins[7]=randskins[rand(2)];
            texture=randskins[rand(2)];
            Count=0.0;
      }
}
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

Wow, AWESOME AGE! It works now, thanks alot! thank you all.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

now i got 1 more question, the queen has the ability to spawn baby's to, ive always used the giantgasbag script and it always worked for me till now. This is what i put in there:

Code: Select all


function SpawnBabyGoddess()
{
  local BabyGoddess B;
  local Vector projStart;
  local Vector X;
  local Vector Y;
  local Vector Z;  
    
    B = spawn(class 'BabyGoddess' ,,'',projStart + (0.6 * CollisionRadius + class'BabyGoddess'.Default.CollisionRadius) * X);
    PlaySound(sound'atracefire', SLOT_Interface);  
    if ( B != None )
     {
      B.ParentGoddess = self;
      numChildren++;
    }   
}    
Last edited by mentalhunter on Sat May 31, 2008 10:52 am, edited 1 time in total.
Pravin

Re: Pawn with random skins bonded to Timer

Post by Pravin »

... you're spawning it at ProjStart which wasn't even initialized to anything. Try setting ProjStart = Location before the spawn. Plus, X doesn't equal anything. You should also call GetAxes( Rotation, X,Y,Z ); and change the 0.6 to 1.2. What all of this will do is 1) start at the queen's location, 2) pick a vector placed about 1.2 times the queen's collision out from it, and 3) choose this vector such that it's where the queen is currently "looking." You also might consider making the second spawn parameter Self so that the queen is the owner of the child (just a thought, dunno if that would have any effect).

btw, that above code with tick is going to execute only on the server and.. change skins around every frame? lol.. might want to simulate that otherwise bandwidth usage might skyrocket.
Last edited by Pravin on Sat May 31, 2008 6:14 pm, edited 1 time in total.
User avatar
mentalhunter
OldUnreal Member
Posts: 814
Joined: Sun Oct 07, 2007 10:31 am

Re: Pawn with random skins bonded to Timer

Post by mentalhunter »

Lol, thanks Pcube. Omg, i can barrerly believe i was so dumb to locate the Projstart and add GetAxes. It works now, thanks Pcube.

Return to “UScript Board”