Scout-kun is a lie... right?

Changing actors' attribute through console command

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

User avatar Gizzy
Skaarj Berserker Skaarj Berserker
Posts: 450
Joined: 02 Feb 2010, 12:55

Subject: Changing actors' attribute through console command

Post Posted: 27 Oct 2012, 13:05

Basically I'm trying to alter the texture of an actor (Laser+LaserDot) that is being drawn on the canvas by a weapon with a simple command like SetLaserColour Blue Red for example. I currently have it working where you can alter the colour via a .ini file but that's not very practical...

heeeelp?

diamond
Skaarj Berserker Skaarj Berserker
Posts: 366
Joined: 13 Nov 2007, 10:51
Location: ROFLand
Contact:

Subject: Re: Changing actors' attribute through console command

Post Posted: 27 Oct 2012, 17:47

editproperties?
this will bring the dialog with all object properties.
Image
UBerserker wrote:Architecture doesn't need to detailed, it just needs to be right.

User avatar Gizzy
Skaarj Berserker Skaarj Berserker
Posts: 450
Joined: 02 Feb 2010, 12:55

Subject: Re: Changing actors' attribute through console command

Post Posted: 27 Oct 2012, 18:36

diamond wrote:editproperties?
this will bring the dialog with all object properties.


I mean during game..using a console command when that weapon is selected to change the colour of their laser for that gun from a predefined set of textures

Bleeder91<NL>
Skaarj Assassin Skaarj Assassin
Posts: 147
Joined: 24 Jun 2011, 18:45

Subject: Re: Changing actors' attribute through console command

Post Posted: 27 Oct 2012, 19:58

Code: Select all

simulated exec function SetLaserColor(string NewColor)
{
   Switch(caps(NewColor))
   {
      Case "BLUE":
         Laser.Skin = Texture'Lasor.Color.Bluezor';
         Break;
      Case "GREEN":
         Laser.Skin = Texture'Lasor.Color.Greenzor';
         Break;
      Case "RED":
         Laser.Skin = Texture'Lasor.Color.Redzor';
         Break;
   }
}

Add that to the weapon and change it to the desired textjaz.

bob
Skaarj Lord Skaarj Lord
Posts: 205
Joined: 23 Apr 2011, 02:24
Location: USA
Contact:

Subject: Re: Changing actors' attribute through console command

Post Posted: 27 Oct 2012, 20:10

you could go one further and use dynamicloadobject to load any texture.
or have it cycle case when no string was specified
or even instead of string , use 3 args to specify color in RGB.

User avatar Gizzy
Skaarj Berserker Skaarj Berserker
Posts: 450
Joined: 02 Feb 2010, 12:55

Subject: Re: Changing actors' attribute through console command

Post Posted: 27 Oct 2012, 20:49

Bleeder: thanks man, I'll look into it!
Bob: Not sure how to use dynamicloadobject :p as for the 3 args, how could I assign that colour to an actor to draw?

Bleeder91<NL>
Skaarj Assassin Skaarj Assassin
Posts: 147
Joined: 24 Jun 2011, 18:45

Subject: Re: Changing actors' attribute through console command

Post Posted: 27 Oct 2012, 21:53

Downside of dynamicloadobject is that it floods with errors, duno if that's fixed in 227i.

In this case if you type SetLaserColor Green in-game, it will set the laser's skin to Texture'Lasor.Color.Greenzor'. You can replace that with whatever texture fits and add LaserDot below it too.. forgot that one. That does, however, mean the laser has to be a var and not a local. If it's local, you could try this:

Code: Select all

var travel texture LaserColor;

simulated exec function SetLaserColor(string NewColor)
{
   //Default laser color;
   LaserColor = Texture'Lasor.Color.Redzor';
   
   Switch(caps(NewColor))
   {
      Case "BLUE":
         LaserColor = Texture'Lasor.Color.Bluezor';
         Break;
      Case "GREEN":
         LaserColor = Texture'Lasor.Color.Greenzor';
         Break;
      Case "RED":
         LaserColor = Texture'Lasor.Color.Redzor';
         Break;
   }
}


And add the next line before the laser is drawn:
Laser.Skin = LaserColor;

User avatar Gizzy
Skaarj Berserker Skaarj Berserker
Posts: 450
Joined: 02 Feb 2010, 12:55

Subject: Re: Changing actors' attribute through console command

Post Posted: 26 Nov 2012, 19:02

FIXED.

Mahoosive thanks Bob and Bleeder, I mashed together the case/switch statements with DynamicLoadObject and it works :D


Who is online

Users browsing this forum: No registered users and 19 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited