Thread: v5.0 Final Development Phase Reached

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 54
  1. #26
    Banned CryoKeen's Avatar
    Join Date
    Aug 2001
    Location
    United States
    Posts
    4,455

    Re: v5.0 Final Development Phase Reached

    Quote Originally Posted by Sniper View Post
    You'll be able to create your own custom entities for your levels or mission packs. We wanted to give as much power as possible to level designers so that they could create mini-mods. You'll have almost as much power as you would with the Half-Life SDK.

    :o
    Last edited by CryoKeen; 28-03-2015 at 12:01 AM.

  2. #27
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: v5.0 Final Development Phase Reached

    You have the ability to create new entities, and there are several categories in that; there's general purpose entities, monsters, talking monsters (like barney), player items and weapons, ammo, and pickup items like medkits and batteries. You can also create custom func_tank entities without having to rewrite the boilerplate code that handles player interaction and monster targeting.

    Here is an entity that implements a func_tank that fires human grunts:

    Code:
    class func_tankgrunt : ScriptBaseTankEntity
    {
    	string m_szMonsterType;
    	
    	void KeyValue( KeyValueData@ pkvd )
    	{
    		if( pkvd.szKeyName() == "monstertype" )
    		{
    			m_szMonsterType = pkvd.szValue();
    			
    			pkvd.fHandled = TRUE;
    		}
    		else
    			BaseClass.KeyValue( pkvd );
    	}
    	
    	void Precache()
    	{
    		BaseClass.Precache();
    		
    		if( !m_szMonsterType.empty() )
    			g_Game.PrecacheOther( m_szMonsterType );
    		else
    			g_EntityFuncs.Remove( self );
    	}
    	
    	void Fire( const Vector3D& in vecBarrelEnd, const Vector3D& in vecForward, EntVars@ pevAttacker )
    	{
    		if( self.m_flNextAttack() <= g_Engine.time )
    		{
    			BaseClass.Fire( vecBarrelEnd, vecForward, pevAttacker );
    			
    			//Le fire a monster
    			Entity@ pMonster = g_EntityFuncs.CreateEntity( m_szMonsterType );
    			
    			if( pMonster !is null )
    			{
    				pMonster.SetOrigin( vecBarrelEnd + vecForward * 10 ); //Move it a bit away from the gun
    				pMonster.pev.velocity = vecForward * 500; //Give it some chop
    				pMonster.pev.movetype = MOVETYPE_FLY;
    			}
    			
    			self.m_flNextAttack() = g_Engine.time + 1 / self.m_fireRate();
    		}
    	}
    }
    This is a custom pickup item that takes 20 health from the player that picks it up:

    Code:
    class item_test : ScriptBaseItemEntity
    {
    	void Spawn()
    	{
    		self.Precache();
    		
    		g_EntityFuncs.SetModel( self, "models/w_medkit.mdl" );
    		g_EntityFuncs.SetSize( self.pev, Vector3D( -16, -16, 0 ), Vector3D( 16, 16, 36 ) );
    		
    		BaseClass.Spawn();
    	}
    	
    	BOOL MyTouch( PlayerEntity@ pPlayer )
    	{
    		pPlayer.TakeHealth( -20, DMG_GENERIC );
    		return TRUE;
    	}
    }
    You also have the power to make pretty much whatever else you want, since you can build onto an entity whatever you want.
    You can also use some of the new Angelscript additions to extend existing entities, to some degree.
    You can attach any data to any entity, allowing you to keep track of anything. This functions much like custom keyvalues do, but you can store entire data structures, not just single values.

    You can also use the scheduler to schedule entity functions, as well as global functions for execution, allowing you to operate on an entity much like it's done in the game itself.

    As an example of a complete script, here's the script i wrote for a primitive class system:

    Code:
    /*
    *
    *	Basic class system implementation
    *
    */
    namespace ClassSystem
    {
    dictionary g_PlayerClasses; //Map of class name-> player class object instance
    
    dictionary g_ChosenClasses; //Map of Steam ID -> player class object instance
    
    class PlayerClass
    {
    	private string m_szClassName; //Name of this class, for internal purposes
    	
    	private string m_szDisplayName; //Display name, for display purposes
    	
    	PlayerClass( const string& in szClassName, const string& in szDisplayName )
    	{
    		this.m_szClassName = szClassName;
    		this.m_szDisplayName = szDisplayName;
    	}
    	
    	const string& GetClassName()
    	{
    		return m_szClassName;
    	}
    	
    	const string& GetDisplayName()
    	{
    		return m_szDisplayName;
    	}
    	
    	//Override to give players custom loadouts
    	void EquipPlayer( PlayerEntity@ pPlayer )
    	{
    	}
    }
    
    class SoldierPlayerClass : PlayerClass
    {
    	SoldierPlayerClass()
    	{
    		super( "soldier", "Soldier" );
    	}
    	
    	void EquipPlayer( PlayerEntity@ pPlayer )
    	{
    		pPlayer.RemoveAllItems( FALSE );
    		pPlayer.SetItemPickupTimes( g_Engine.time );
    		pPlayer.GiveNamedItem( "weapon_mp5" );
    		pPlayer.GiveNamedItem( "ammo_9mmclip" );
    		pPlayer.GiveNamedItem( "weapon_rpg" );
    		pPlayer.GiveNamedItem( "weapon_handgrenade" );
    		pPlayer.GiveNamedItem( "weapon_handgrenade" );
    	}
    }
    
    class MedicPlayerClass : PlayerClass
    {
    	MedicPlayerClass()
    	{
    		super( "medic", "Medic" );
    	}
    	
    	void EquipPlayer( PlayerEntity@ pPlayer )
    	{
    		pPlayer.RemoveAllItems( FALSE );
    		pPlayer.SetItemPickupTimes( g_Engine.time );
    		pPlayer.GiveNamedItem( "weapon_medkit" );
    		pPlayer.GiveNamedItem( "weapon_9mmhandgun" );
    		pPlayer.GiveNamedItem( "ammo_9mmclip" );
    	}
    }
    
    class SniperPlayerClass : PlayerClass
    {
    	SniperPlayerClass()
    	{
    		super( "sniper", "Sniper" );
    	}
    	
    	void EquipPlayer( PlayerEntity@ pPlayer )
    	{
    		pPlayer.RemoveAllItems( FALSE );
    		pPlayer.SetItemPickupTimes( g_Engine.time );
    		pPlayer.GiveNamedItem( "weapon_sniperrifle" );
    		pPlayer.GiveNamedItem( "weapon_eagle" );
    		pPlayer.GiveNamedItem( "weapon_crossbow" );
    		
    		for( uint i = 0; i < 6; ++i )
    			pPlayer.GiveNamedItem( "ammo_357" );
    		
    		for( uint i = 0; i < 5; ++i )
    			pPlayer.GiveNamedItem( "ammo_crossbow" );
    			
    		for( uint i = 0; i < 3; ++i )
    			pPlayer.GiveNamedItem( "ammo_762" );
    	}
    }
    
    class GenericPlayerClass : PlayerClass
    {
    	GenericPlayerClass()
    	{
    		super( "generic", "Generic" );
    	}
    	
    	void EquipPlayer( PlayerEntity@ pPlayer )
    	{
    		pPlayer.RemoveAllItems( FALSE );
    		pPlayer.SetItemPickupTimes( g_Engine.time );
    
    		g_PlayerFuncs.ApplyMapCfgToPlayer( pPlayer );
    	}
    }
    
    void AddPlayerClass( PlayerClass@ pClass )
    {
    	@g_PlayerClasses[ pClass.GetClassName() ] = @pClass;
    }
    
    void InitClassSystem()
    {
    	AddPlayerClass( SoldierPlayerClass() );
    	AddPlayerClass( MedicPlayerClass() );
    	AddPlayerClass( SniperPlayerClass() );
    	AddPlayerClass( GenericPlayerClass() );
    }
    
    PlayerClass@ GetPlayerClass( PlayerEntity@ pPlayer )
    {
    	const string szSteamId = g_EngineFuncs.GetPlayerAuthId( pPlayer.edict() );
    	
    	if( g_ChosenClasses.exists( szSteamId ) )
    		return cast( g_ChosenClasses[ szSteamId ] );
    	
    	return null;
    }
    
    bool GivePlayerClassItems( PlayerEntity@ pPlayer )
    {
    	bool fResult = false;
    	
    	PlayerClass@ pClass = GetPlayerClass( pPlayer );
    	
    	if( pClass !is null )
    	{
    		pClass.EquipPlayer( pPlayer );
    		fResult = true;
    	}
    	
    	return fResult;
    }
    
    bool SelectClass( PlayerEntity@ pPlayer, const string& in szClassName )
    {
    	bool fResult = false;
    	
    	string szLoweredName = szClassName;
    	
    	szLoweredName.tolowercase();
    	
    	if( g_PlayerClasses.exists( szLoweredName ) )
    	{
    		PlayerClass@ pClass = cast( g_PlayerClasses[ szLoweredName ] );
    		
    		@g_ChosenClasses[ g_EngineFuncs.GetPlayerAuthId( pPlayer.edict() ) ] = @pClass;
    		
    		fResult = true;
    	}
    	
    	return fResult;
    }
    
    void ClearClass( PlayerEntity@ pPlayer )
    {
    	@g_ChosenClasses[ g_EngineFuncs.GetPlayerAuthId( pPlayer.edict() ) ] = null;
    }
    
    void HandlePlayerSpawn( PlayerEntity@ pPlayer )
    {
    	if( GivePlayerClassItems( pPlayer ) )
    	{
    		g_PlayerFuncs.ShowMessage( pPlayer, "You are playing as " + GetPlayerClass( pPlayer ).GetDisplayName() );
    	}
    	else
    	{
    		g_PlayerFuncs.ShowMessage( pPlayer, "You must select a class!" );
    	}
    }
    
    void HandlePlayerSayText( PlayerEntity@ pPlayer, const string& in szCommand, array@ pArguments, bool& out fHide )
    {
    	if( pArguments.length() >= 1 )
    	{
    		const string szCommandName = pArguments[ 0 ];
    		
    		if( szCommandName == "!class" )
    		{
    			if( pArguments.length() == 2 )
    			{
    				const string szClassName = pArguments[ 1 ];
    				
    				fHide = true;
    				
    				if( szClassName == "reset" )
    				{
    					ClearClass( pPlayer );
    					g_PlayerFuncs.ShowMessage( pPlayer, "Resetting class" );
    				}
    				else
    				{
    					if( !SelectClass( pPlayer, szClassName ) )
    						g_PlayerFuncs.ShowMessage( pPlayer, "That class does not exist!\n" );
    					else
    					{
    						g_PlayerFuncs.ShowMessage( pPlayer, "Class " + szClassName + " selected\n" );
    						
    						Entity@ pVolume = g_EntityFuncs.FindEntityByTargetname( null, "brushvolume" );
    						
    						bool fIsInVolume = false;
    						
    						if( pVolume !is null )
    						{
    							fIsInVolume = g_Utility.IsPlayerInVolume( pPlayer, pVolume );
    						}
    						
    						if( pPlayer.IsAlive() == TRUE )
    						{
    							if( !fIsInVolume )
    								g_PlayerFuncs.RespawnPlayer( pPlayer );
    								
    							GivePlayerClassItems( pPlayer );
    						}
    					}
    				}
    			}
    			else
    				g_PlayerFuncs.ShowMessage( pPlayer, "Usage: !class " );
    		}
    		else if( szCommandName == "!buy" )
    		{
    			Entity@ pVolume = g_EntityFuncs.FindEntityByTargetname( null, "brushvolume" ); //brushvolume is the name of the brush entity whose volume we're going to use
    			
    			bool fIsInVolume = false;
    						
    			if( pVolume !is null )
    			{
    				fIsInVolume = g_Utility.IsPlayerInVolume( pPlayer, pVolume );
    			}
    			
    			if( fIsInVolume )
    			{
    				if( pArguments.length() == 2 )
    				{
    					const string szWeaponName = pArguments[ 1 ];
    					
    					if( szWeaponName == "357" )
    					{
    						if( pPlayer.pev.frags >= 1 )
    						{
    							pPlayer.pev.frags -= 1;
    							
    							pPlayer.GiveNamedItem( "weapon_357" );
    						}
    						else
    							g_PlayerFuncs.ShowMessage( pPlayer, "Not enough money" );
    					}
    					else
    						g_PlayerFuncs.ShowMessage( pPlayer, "Unknown weapon" );
    				}
    				else
    					g_PlayerFuncs.ShowMessage( pPlayer, "Usage: !buy " );
    			}
    			else
    				g_PlayerFuncs.ShowMessage( pPlayer, "Not in a buy zone" );
    		}
    		else if( szCommandName =="!addmoney" ) //Cheat command, remove for release
    		{
    			pPlayer.pev.frags += 10;
    		}
    	}
    }
    
    array g_SpawnPointClasses = { "info_player_deathmatch" };
    
    bool DefaultSpawnSpot( Entity@ pSpawnSpot, PlayerEntity@ pPlayer )
    {
    	PlayerClass@ pClass = GetPlayerClass( pPlayer );
    	
    	bool fIsSpecialSpawn = pSpawnSpot.GetTargetname() == "specialspawn";
    	
    	bool fResult = true;
    	
    	if( pClass !is null && pClass.GetClassName() == "soldier" )
    	{
    		fResult = fIsSpecialSpawn;
    	}
    	else
    		fResult = !fIsSpecialSpawn;
    		
    	g_Game.AlertMessage( at_console, "Spawn point name: %1, is special spawn: %2, used: %3\n", pSpawnSpot.GetTargetname(), fIsSpecialSpawn, fResult );
    		
    	return fResult;
    }
    
    void HandleGetPlayerSpawnSpot( PlayerEntity@ pPlayer, Entity@& out pentSpawnSpot )
    {
    	EntityList points( g_SpawnPointClasses );
    
    	points.BuildList( pPlayer, DefaultSpawnSpot );
    
    	Entity@ pEntity = points.GetRandomEntity( EntityValidForRetrieval( g_PlayerFuncs.IsSpawnPointOccupied ) );
    	
    	if( pEntity is null )
    		@pEntity = points.GetRandomEntity();
    
    	@pentSpawnSpot = pEntity;
    }
    }
    This code lets a player choose a class by saying !class , or reset it with !class reset, which gives the player the items set in the map cfg.
    You can buy items with !buy, provided you have enough money (actually frags), and if you are in a buy zone. Only the 357 can be bought, but you can easily add more options here.
    You will also spawn in another location if you are using the soldier class.

    This can easily be extended with new classes, or rewritten to be more generic, if you so please.

  3. #28
    Banned CryoKeen's Avatar
    Join Date
    Aug 2001
    Location
    United States
    Posts
    4,455

    Re: v5.0 Final Development Phase Reached

    Amazing! Thank you Sniper & SoloKiller!

    Will there be some sort of Angel script 101 thread? Or will a standard tutorial on Google be able to teach me the basics?

    I think that many members would be interested in this perhaps you could start a public thread and people could contribute code snippets of their own for plug and play functionality such as you have done here.

    I am aware that copying code is sometimes seen as a no no in the coding world but I think that this might be a unique situation and in order to help the level designers we will need a bit of a helping hand until we get the hang of this "angel script"

  4. #29
    Level Designer [CHN]iAmZC's Avatar
    Join Date
    Apr 2014
    Location
    Earth
    Posts
    46

    Re: v5.0 Final Development Phase Reached

    What is func_tankgrunt? Tank launch HECU soldiers?
    I'm a crate

    Sven Co-op Map - Black Water | Status: 2%

  5. #30
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: v5.0 Final Development Phase Reached

    Technically it can launch any monster, but it was designed with grunts in mind.

  6. #31
    Banned CryoKeen's Avatar
    Join Date
    Aug 2001
    Location
    United States
    Posts
    4,455

    Re: v5.0 Final Development Phase Reached

    Quote Originally Posted by Soctom View Post
    Hopefully everyone treats each other like garbage on release day so we can maintain this low player base or maybe the community will have an explosive growth. Just look at all those popular games being played right now they have the most toxic players around but they manage to keep growing!
    have any community's in mind?

  7. #32
    Registered User
    Join Date
    Nov 2014
    Posts
    33

    Re: v5.0 Final Development Phase Reached

    So how many months had the Final Phase has been? :L

  8. #33
    Is not hoers Streamfox's Avatar
    Join Date
    Apr 2009
    Location
    Zandronum
    Posts
    759

    Re: v5.0 Final Development Phase Reached

    Can't wait to do clientside scripts, and go mad with fancy new weapons.

  9. #34
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: v5.0 Final Development Phase Reached

    5.0 doesn't have client side scripts.

  10. #35
    Registered User Mitko's Avatar
    Join Date
    May 2015
    Location
    Xen
    Posts
    28

    Re: v5.0 Final Development Phase Reached

    Any news regarding this? I know I shouldn't be asking for any ETAs but I'm excited for this and the last news post was three month ago. Could the devs please give us some clues on how the development is going?

  11. #36
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: v5.0 Final Development Phase Reached

    We should be able to give you a news update relatively soon, but i can't say when exactly.

  12. #37
    Is not hoers Streamfox's Avatar
    Join Date
    Apr 2009
    Location
    Zandronum
    Posts
    759

    Re: v5.0 Final Development Phase Reached

    Quote Originally Posted by Solokiller View Post
    5.0 doesn't have client side scripts.
    Yeah I know that. I was joking.

  13. #38
    a person RNG's Avatar  
    Contributor
    Join Date
    Sep 2006
    Posts
    3,842

    Re: v5.0 Final Development Phase Reached

    cant wait to script crazy serious sam-esque guns and then shooting shit in 300 ping
    Last edited by RNG; 10-08-2015 at 12:02 PM.

  14. #39
    ~ Unholy Madness ~ 19941994ra's Avatar
    Join Date
    Jan 2010
    Location
    Argentina
    Posts
    244

    Re: v5.0 Final Development Phase Reached

    Quote Originally Posted by RNG View Post
    cant wait to script crazy serious sam-esque guns and then shooting shit in 300 ping
    I would like the Cannon and the Flamethrover, please!
    Sven Co-op - Player, enthusiast, alien-reaper, Shotgun-lover
    Sven Co-op Forums - Addict, spam-hater, playing 5.0 a lot
    In-game name - Delacroix

  15. #40
    Registered User Zadeon's Avatar
    Join Date
    May 2013
    Posts
    31

    Re: v5.0 Final Development Phase Reached

    Would scripting the Team Fortress Classic weapons in Sven coop 5.0 be possible?

  16. #41
    trigger_delay & func_lazy TrEmPlEr's Avatar  
    Artist
    Join Date
    Jul 2002
    Location
    Valve Hammer Editor 3.5 beta
    Posts
    2,279

    Re: v5.0 Final Development Phase Reached

    yes

    here
    Modstatus: Unknown

  17. #42
    Banned CryoKeen's Avatar
    Join Date
    Aug 2001
    Location
    United States
    Posts
    4,455

    Re: v5.0 Final Development Phase Reached


  18. #43
    Registered User MissSheepy's Avatar
    Join Date
    Jun 2012
    Posts
    25

    Re: v5.0 Final Development Phase Reached

    Quote Originally Posted by CryoKeen View Post
    This but unironically!!

    edit: holy shit you weren't kidding

  19. #44
    Registered User
    Join Date
    Apr 2009
    Posts
    48

    Re: v5.0 Final Development Phase Reached

    What about creating new hitgroups or overwriting properties of existent?

  20. #45
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: v5.0 Final Development Phase Reached

    You can create new hitgroups in custom monsters, but not override existing ones.

  21. #46
    Level Designer [CHN]iAmZC's Avatar
    Join Date
    Apr 2014
    Location
    Earth
    Posts
    46

    Re: v5.0 Final Development Phase Reached

    Add the Shaders?(like minecraft)
    http://minecraft.gamepedia.com/Shaders
    I'm a crate

    Sven Co-op Map - Black Water | Status: 2%

  22. #47
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: v5.0 Final Development Phase Reached

    I don't think you understand how much work that would be.

  23. #48
    Princess liz ^.^ m0u$3[uz]'s Avatar
    Join Date
    Nov 2011
    Location
    Quiet place in the woods ga
    Posts
    375

    Re: v5.0 Final Development Phase Reached

    This heartless mouse cant wait to play it when's the release date?

  24. #49
    Phantoms Can't Hang Indeimaus's Avatar
    Join Date
    Dec 2004
    Location
    Lordran
    Posts
    113

    Re: v5.0 Final Development Phase Reached

    Great news!

    Is 5.0 going to be on Steam or is that still a later date thing?

  25. #50
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: v5.0 Final Development Phase Reached

    5.0 will be released on Steam.

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •