Results 1 to 7 of 7
  1. #1
    MSgt. Shooter Person
    Join Date
    Mar 2002
    Posts
    250

    Default Changing an actors texture depnding on map

    For the CrateDM Mod im working on, to add some extra stuff to the mod i really want the crates (which is a randomly spawned actor with a crate mesh), to have different textures/skins depdending on the current map.

    My scripting abilities are pretty much limited to 'borrowing' code, so i borrowed some code from the crateactor.uc in bonus pack.

    This works fine offline, but in a multiplayer game, clients who connect to the server see the default skin, anyway to fix this?


    this function is called in PostBeginPlay.

    function SetMapCrateTex()
    {
    if ( Level.UV2Texture == None )
    {
    if ( (Level.Title ~= "Room5") )
    {
    Level.UV2Texture = Texture'CrateDMTex.Crates.woodencrate_01';
    SurfaceType = EST_Wood;
    }

    if ( (Level.Title ~= "Room 6") )
    {
    Level.UV2Texture = Texture'CrateDMTex.Crates.crate_rusted';
    SurfaceType = EST_Metal;
    }
    }

  2. #2
    Boomshot
    Join Date
    Mar 2002
    Posts
    2,475

    Default

    A replication problem. That function (which should be enclosed in code tags, not quote tags, btw) only gets called on the server.

    To get it to work on te client, the actor will need to have RemoteRole set to ROLE_SimulatedProxy, and the function will need to be simulated (as will PostBeginPlay, since simulated functions will only be simulated when called from other simulated functions).

    More info on simulation: http://wiki.beyondunreal.com/wiki/Simulated_Function

  3. #3
    Palace Guard
    Join Date
    May 2003
    Posts
    3,461

    Default

    so in other words put the word 'simulated' before the words 'function PostBeginPlay()' and likewise before 'function SetMapCrateTex()' This will make them simulated functions that get updated to versions of that actor with a role like 'ROLE_SimulatedProxy'. So to give the versions of the actors only on clients machines (not on the server) the role 'ROLE_SimulatedProxy' just add to your default properties 'RemoteRole=ROLE_SimulatedProxy'

  4. #4
    MSgt. Shooter Person
    Join Date
    Jul 2000
    Posts
    54

    Default

    isn't replication fun?

  5. #5
    Palace Guard
    Join Date
    May 2003
    Posts
    3,461

    Default

    More fun than AI scripting

  6. #6
    MSgt. Shooter Person
    Join Date
    Mar 2002
    Posts
    250

    Default

    cool thanks heaps :up:

    i was hoping it was only something small and easy like that

  7. #7
    Boomshot
    Join Date
    Mar 2002
    Posts
    2,475

    Default

    Originally posted by FireCrack
    More fun than AI scripting
    At least when doing AI you have tangible results, whereas replication is just there so things don't break, not to actually add features. Makes it sort of boring.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.