Results 1 to 11 of 11
  1. #1
    Iron Guard
    Join Date
    Sep 2008
    Location
    Utah or California
    Posts
    562
    Gamer IDs

    Gamertag: Marscaleb PSN ID: Marscaleb

    Default Doesn't make sense to me: Static mesh component in Starter Platform Game

    I was looking at some of the classes in the Starter Platform Game.
    I was looking at the dropped health pickup, which for reference is this:

    Code:
    //=============================================================================
    // SPG_HealthPickup
    //
    // Simple health pick up.
    //
    // Copyright 1998-2011 Epic Games, Inc. All Rights Reserved.
    //=============================================================================
    class SPG_HealthPickup extends DroppedPickup
    	placeable;
    
    // Static mesh used by the pick up
    var(HealthPickup) const StaticMeshComponent Mesh;
    // Sound to play when the pick up is picked up by a pawn
    var(HealthPickup) const SoundCue PickupSound;
    // How much health to give to the pawn when picked up
    var(HealthPickup) const int HealthToGive;
    
    /**
     * Called when this pick up should be given to a pawn
     *
     * @param	P		Pawn to give to
     * @network			Server
     */
    function GiveTo(Pawn P)
    {
    	// Play sound
    	if (PickupSound != None)
    	{
    		PlaySound(PickupSound);		
    	}
    
    	// Add health to the player, but clamp it to the pawn's maximum health
    	P.Health = Min(P.Health + HealthToGive, P.HealthMax);
    	// Handle the rest of pick up
    	PickedUpBy(P);
    }
    
    auto state Pickup
    {
    	/*
    	 * Validate touch (if valid return true to let other pick me up and trigger event).
    	 *
    	 * @param	Other		Pawn to validate
    	 * @network				Server
    	 */
    	function bool ValidTouch(Pawn Other)
    	{
    		// make sure its a live player
    		if (Other == None || !Other.bCanPickupInventory || (Other.DrivenVehicle == None && Other.Controller == None))
    		{
    			return false;
    		}
    
    		// make sure thrower doesn't run over own weapon
    		if (Physics == PHYS_Falling && Other == Instigator && Velocity.Z > 0)
    		{
    			return false;
    		}
    
    		return true;
    	}
    }
    
    defaultproperties
    {
    	// Remove the sprite component
    	Components.Remove(Sprite);
    
    	// Add the static mesh component
    	Begin Object Class=StaticMeshComponent Name=MyStaticMeshComponent
    	End Object
    	Mesh=MyStaticMeshComponent
    	Components.Add(MyStaticMeshComponent);
    }
    Now as I look at this, I can't find where there is ANYTHING that tells it what mesh to use. There is an archetype, yes, but I don't see anything in here that tells it to use that archetype.
    So I'm confused.
    How does this object know what mesh to use?
    Follow my progress at:
    http://marscaleb.com/
    Read my new webcomic: Mischief in Maytia
    http://maytiacomic.com/

  2. #2
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Maybe because this is Starter Platform Game and you need add your own static mesh in def:
    StaticMesh=StaticMesh'YourPackage.YourStaticMesh'

    ...to StaticMeshComponent

  3. #3
    MSgt. Shooter Person
    Join Date
    Dec 2009
    Location
    Germany, Alsdorf
    Posts
    433
    Gamer IDs

    Gamertag: KONSUMIDIOT

    Default

    var(HealthPickup) const StaticMeshComponent Mesh

    check this...right, you set it in-editor, simple as that

  4. #4
    MSgt. Shooter Person
    Join Date
    Feb 2009
    Location
    Germany / NRW
    Posts
    144

    Default

    Quote Originally Posted by gegebel View Post
    var(HealthPickup) const StaticMeshComponent Mesh

    check this...right, you set it in-editor, simple as that
    Yep... if you see a variable has this format : var() or var(blablatext) it means that the value is set via the editor

  5. #5
    Iron Guard
    Join Date
    Sep 2008
    Location
    Utah or California
    Posts
    562
    Gamer IDs

    Gamertag: Marscaleb PSN ID: Marscaleb

    Default

    Yes, I know I can set it in the editor, but I DON'T set anything when I just play the test map. Where are they getting the instruction to use this mesh?
    Follow my progress at:
    http://marscaleb.com/
    Read my new webcomic: Mischief in Maytia
    http://maytiacomic.com/

  6. #6
    MSgt. Shooter Person
    Join Date
    Oct 2011
    Posts
    235

    Default

    I didn't looked at the starter kit, but usually this kind of stuff is done by archetypes.

  7. #7
    MSgt. Shooter Person
    Join Date
    Feb 2009
    Location
    Germany / NRW
    Posts
    144

    Default

    Yeah but afaik there's not a single archetype used as demonstration. I bet it's set in the defaults, maybe in some parent class.

  8. #8
    Iron Guard
    Join Date
    Sep 2008
    Location
    Utah or California
    Posts
    562
    Gamer IDs

    Gamertag: Marscaleb PSN ID: Marscaleb

    Default

    Yes it does use an archetype, but where is it told to do so? All we have in this code is an empty placeholder for its variables to go in, but nothing telling it to use that archetype. But when an enemy spawns it, it has all the info from the archetype.

    The parent class is DroppedPickup, which is NOT a class that is part of the Starter Kit. So it is not going to be defined in a parent class.

    This is why I am confused.
    Follow my progress at:
    http://marscaleb.com/
    Read my new webcomic: Mischief in Maytia
    http://maytiacomic.com/

  9. #9
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Look in to that DropedPickup, find function SetPickupMesh - you will know why there is no static mesh defined in defaultproperties.
    Last edited by VendorX; 03-06-2012 at 07:04 PM.

  10. #10
    MSgt. Shooter Person
    Join Date
    Dec 2009
    Location
    Germany, Alsdorf
    Posts
    433
    Gamer IDs

    Gamertag: KONSUMIDIOT

    Default

    Archetypes are made in-editor. Your archetype was imported from the zip file you copied from the starterkit. if you check the package StarterPlatformGameContent there's probably an archetype called HealthPickup and when you open it, there's an option to change the mesh.
    As for, where does it say to use the archetype: check the file called SPG_AIPawn, around line 130...there it is.

  11. #11
    Iron Guard
    Join Date
    Sep 2008
    Location
    Utah or California
    Posts
    562
    Gamer IDs

    Gamertag: Marscaleb PSN ID: Marscaleb

    Default

    Ah, I see, so the archetype is assigned by the enemies when they drop it.
    Actually, that's pretty brilliant. That way we could have enemies drop all kinds of different health items and they all use the same class.

    Thanks for the answer!
    Follow my progress at:
    http://marscaleb.com/
    Read my new webcomic: Mischief in Maytia
    http://maytiacomic.com/


 

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.