Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 08-15-2008, 05:08 PM   #1
MonoXideAtWork
Pub Allstar!
Beta Tester
 
Join Date: Aug 2008
Class/Position: under en kvinna
Gametype: Capture the Flag
Affiliations: Eternal Order, Must be h4x, Mono's happy funtime.
Posts Rated Helpful 0 Times
Custom Class Creation

I did a search and was unable to find anything on the forums, wiki, or a general google search in regards to this. If this has been posted before, my apologies.

I want to create a custom class for use on my server. Here's the idea, how I am thinking about going about it, and my specific questions. If I'm thinking about this the wrong way, maybe someone can point me in the right direction. Thanks.


I want to create a soldier class that plays a little faster in order to introduce my zerofrags.com cpma players to the game, and also for a little fun when not training. I would like to be able to enable this class and disable all standard classes for the duration of any map.

My plan was to do this with a lua suffix. Basically, I'd create a modified base ctf lua with reference to this custom class and disable all others. Then copy and rename the file to "mapname__quake__.lua".

I see that under fortressForever/scripts there are scripts with class attributes.
So after tinkering with them, this is what I have come up with.

Contents of ff_playerclass_cpma.txt

Code:
PlayerClassData
{
	"slot"				"3"
	"classname"			"Fragger"

	// Text
	"printname"			"#FF_PLAYER_SOLDIER"
	"description"			"#FF_HELP_SOLDIER"

	// Model
	"model"				"models/player/soldier/soldier.mdl"

	// Health & Armour
	"max_armour"			"200"
	"initial_armour"		"0"
	"armour_type"			"0.8"
	"health"			"100"

	"speed"				"320" //boosted 5% was 252
	"masscoefficient"		"1.0"
	
	// Weapns to automatically equip the class with
	ArmamentsData
	{
		"weapon"	"ff_weapon_crowbar"
		"weapon"	"ff_weapon_quake_railgun"
		"weapon"	"ff_weapon_supershotgun"
		"weapon"	"ff_weapon_quake_rpg"
	}

	"primary_classname"		"ff_grenade_normal"
	"primary_initial"		"2"
	"primary_max"			"4"

	"secondary_classname"		"ff_grenade_nail"
	"secondary_initial"		"1"
	"secondary_max"			"2"

	"weight"			"75"
	"item_flags"			"0"

	// Ammo amounts for the player
	AmmoData
	{
		"AMMO_SHELLS"		"50"
		"AMMO_NAILS"		"0"
		"AMMO_CELLS"		"0"
		"AMMO_ROCKETS"		"10"
		"AMMO_DETPACK"		"0"
		"AMMO_MANCANNON"	"0"
	}

	MaxAmmoData
	{
		"AMMO_SHELLS"		"100"
		"AMMO_NAILS"		"100"
		"AMMO_CELLS"		"50"
		"AMMO_ROCKETS"		"50"
		"AMMO_DETPACK"		"0"
		"AMMO_MANCANNON"	"0"
	}
}
Contents of ff_weapon_quake_rpg.txt
Code:
WeaponData
{
	// Weapon characteristics:
	"CycleTime"			"0.65"		// was .8 Rate of fire
	"CycleDecrement"		"1"		// Number of bullets fired per cycle

	"Damage"			"102"		// Damage per burst
	"DamageRadius"			"125"		// Radius of damage

	"RecoilAmount"			"1"		// Amount of recoil

	// Projectile weapons
	"Speed"				"1200"		// 900 Speed for projectile to travel at, possibly wrong.  Old FF value = 800.
	
	// Hitscan weapons
	"Bullets"			"-1"		// Bullets to shoot
	"BulletSpread"			"-1"		// Spread of projectiles

	"PreReloadTime"			".3"		// was .4 Time taken for the weapon to move to reload state
	"ReloadTime"			"0.9"		// was 1.3 Time taken to reload a shell/rocket/etc
	"PostReloadTime"		"1"		// Time taken to move weapon back to firing state

	"SpinTime"			"-1"		// For AC

	"clip_size"			"100"
	
	"primary_ammo"			"AMMO_ROCKETS"	
	"secondary_ammo"		"None"		

	
	// Weapon data is loaded by both the Game and Client DLLs.
	"printname"			"#FF_WPNHUD_RPG"
	"viewmodel"			"models/weapons/rpg/v_rpg.mdl"
	"playermodel"			"models/weapons/rpg/w_rpg.mdl"
	
	"anim_prefix"			"rpg"
	"PlayerAnimationExtension" "rpg"
	"bucket"			"4"
	"bucket_position"		"0"

	"weight"			"60"
	"item_flags"			"0"

	// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
	SoundData
	{
		"empty"			"generic.empty"
		"reload"		"rpg.reload"
		"single_shot"		"rpg.single_shot"
	}

	// Weapon Sprite data is loaded by the Client DLL.
	TextureData
	{
		"weapon"
		{
				"font"		"WeaponIcons"
				"character"	"q"
		}
		"weapon_s"
		{	
				"font"		"WeaponIconsSelected"
				"character"	"q"
		}
		"ammo"
		{
				"font"		"WeaponIconsSmall"
				"character"	"8"
		}
		"crosshair"
		{
				"file"		"sprites/crosshairs"
				"x"			"0"
				"y"			"48"
				"width"		"24"
				"height"	"24"
		}
		"autoaim"
		{
				"file"		"sprites/crosshairs"
				"x"			"0"
				"y"			"48"
				"width"		"24"
				"height"	"24"
		}
		"deathnotice"
		{
				"font"		"StatusGlyphsSmall"
				"character"	"q"
		}
	}
	ModelBounds
	{
		Viewmodel
		{
			Mins	"-10 -4 -13"
			Maxs	"21 9 -1"
		}
		World
		{
			Mins	"-10 -7 -6"
			Maxs	"22 8 9"
		}
	}
}
Contents of ff_weapon_quake_railgun

Code:
WeaponData
{
	// Weapon characteristics:
	"CycleTime"			"1.5"		// Rate of fire
	"CycleDecrement"		"1"		// Number of bullets fired per cycle

	"Damage"			"80"		// Damage per burst
	"DamageRadius"			"1"		// Radius of damage

	// Projectile weapons
	"Speed"				"10000"		// Speed for projectile to travel at
	
	"RecoilAmount"			"2"		// Amount of recoil

	// Hitscan weapons
	"Bullets"			"-1"		// Bullets to shoot
	"BulletSpread"			"-1"		// Spread of projectiles

	"PreReloadTime"			"-1"		// Time taken for the weapon to move to reload state
	"ReloadTime"			"-1"		// Time taken to reload a shell/rocket/etc
	"PostReloadTime"		"-1"		// Time taken to move weapon back to firing state

	"SpinTime"			"-1"		// For AC

	"clip_size"			"-1"
	"clip2_size"			"-1"
	"default_clip"			"10"
	"default_clip2"			"-1"	

	"primary_ammo"			"AMMO_NAILS"
	"secondary_ammo"		"None"

	
	// Weapon data is loaded by both the Game and Client DLLs.
	"printname"			"#FF_WPNHUD_RAILGUN"
	"viewmodel"			"models/weapons/railgun/v_railgun.mdl"
	"playermodel"			"models/weapons/railgun/w_railgun.mdl"
	
	"anim_prefix"			"anim"
	"PlayerAnimationExtension" "railgun"
	"bucket"			"1"
	"bucket_position"		"2"

	"weight"			"50"
	"item_flags"			"0"

	// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
	SoundData
	{
		"empty"			"generic.empty"
		"single_shot"		"railgun.single_shot"
		"double_shot"		"railgun.charged_shot"
		"special1"		"railgun.chargeloop"
		"special2"		"railgun.halfcharge"		// half charge notification
		"special3"		"railgun.fullcharge"		// full charge notification
		"burst"			"railgun.overcharge"		// overcharge
//		"special2"		"ambient.electrical_zap_8"	// half charge notification
//		"special3"		"ambient.electrical_zap_9"	// full charge notification
//		"burst"			"ambient.electrical_zap_5"	// overcharge
	}

	// Weapon Sprite data is loaded by the Client DLL.
	TextureData
	{
		"weapon"
		{
				"font"		"WeaponIcons"
				"character"	"t"
		}
		"weapon_s"
		{	
				"font"		"WeaponIconsSelected"
				"character"	"t"
		}
		"ammo"
		{
				"font"		"WeaponIconsSmall"
				"character"	"6"
		}
		"crosshair"
		{
				"file"		"sprites/crosshairs"
				"x"			"0"
				"y"			"48"
				"width"		"24"
				"height"	"24"
		}
		"autoaim"
		{
				"file"		"sprites/crosshairs"
				"x"			"0"
				"y"			"48"
				"width"		"24"
				"height"	"24"
		}
		"deathnotice"
		{
				"font"		"StatusGlyphsSmall"
				"character"	"u"
		}
	}
	ModelBounds
	{
		Viewmodel
		{
			Mins	"-10 -4 -13"
			Maxs	"21 9 -1"
		}
		World
		{
			Mins	"-10 -7 -6"
			Maxs	"22 8 9"
		}
	}
}
any help / pointers would be greatly appreciated. thanks!!!!
MonoXideAtWork is offline   Reply With Quote


Old 08-15-2008, 06:03 PM   #2
Ihmhi
[AE] 0112 Ihmhi *SJB
Wiki Team
Fortress Forever Staff
 
Ihmhi's Avatar
 
Join Date: Mar 2007
Location: Newark, NJ, United States
Class/Position: A little bit o' everythin'
Gametype: Also a little bit o' everythin'
Affiliations: [AE] Asseater, *SJB Straight Jacket Brigade
Posts Rated Helpful 3 Times
Send a message via AIM to Ihmhi Send a message via MSN to Ihmhi Send a message via Yahoo to Ihmhi
Wow, so... you've edited like every class-related file.

Okay, well, you have a few problems here.

First, while Lua can currently take away weapons, it can not yet give players weapons. (We be workin' on that, yo.)

Secondly, you can indeed swap out a skin on an existing model for a player, but I don't know if you can swap out an entire model altogether.

Also don't know whether or not you can bring in custom weapons.

I'm sure one of the LADs can answer you.

PON PON PATA PON!
__________________
Support FF:
Anime: The Thread: Reloaded
The one and only anime thread on these here forums.

Select the pistol, and then, select your horse.
Ihmhi is offline   Reply With Quote


Old 08-15-2008, 09:32 PM   #3
MonoXideAtWork
Pub Allstar!
Beta Tester
 
Join Date: Aug 2008
Class/Position: under en kvinna
Gametype: Capture the Flag
Affiliations: Eternal Order, Must be h4x, Mono's happy funtime.
Posts Rated Helpful 0 Times
Update.

Ok, so just editing the class files as given me the proper results (still needs some minor tweaking). The problem is that it requires me to replace the original files whenever I would like to make a change. What I was thinking was saving them as something like the names listed above, and calling the scripts up through LUA. Lua seems to have this ability, though I have not been able to find a tutorial on how exactly to make this happen. So atm, My server has some pretty broken soldiers.

About the class files. These are the same files from fortressforever\scripts, only renamed and with tweaks to the damage variables and weapon assignments. this is not an original work and all credit belongs to the original authors. And a big thank you for all the comments within the script files, some of those variables are a little misleading in cvar name without the helpful commenting.
MonoXideAtWork is offline   Reply With Quote


Old 08-18-2008, 04:05 PM   #4
MonoXideAtWork
Pub Allstar!
Beta Tester
 
Join Date: Aug 2008
Class/Position: under en kvinna
Gametype: Capture the Flag
Affiliations: Eternal Order, Must be h4x, Mono's happy funtime.
Posts Rated Helpful 0 Times
Ok, so I've got my classes finished. I had some major issues when attempting to use different models for weapons (maybe invalid syntax?)

So basically I have my soldier saved as ff_playerclass_quake_soldier

How can I load this script in the place of ff_playerclass_soldier via lua?

My goal is to have an alternate set of player classes that can be enabled via a special LUA. Thanks.
MonoXideAtWork is offline   Reply With Quote


Old 08-19-2008, 09:27 PM   #5
thiz
Tealeaf
Beta Tester
 
thiz's Avatar
 
Join Date: Dec 2007
Location: Scotland
Affiliations: fo!
Posts Rated Helpful 1 Times
This could be cool, I remember using that exploit on tfc that allowed you to get all classes weapons and having mulch_dm battles with scouts and rocket launchers, concing around etc
thiz is offline   Reply With Quote


Old 08-19-2008, 10:26 PM   #6
Ihmhi
[AE] 0112 Ihmhi *SJB
Wiki Team
Fortress Forever Staff
 
Ihmhi's Avatar
 
Join Date: Mar 2007
Location: Newark, NJ, United States
Class/Position: A little bit o' everythin'
Gametype: Also a little bit o' everythin'
Affiliations: [AE] Asseater, *SJB Straight Jacket Brigade
Posts Rated Helpful 3 Times
Send a message via AIM to Ihmhi Send a message via MSN to Ihmhi Send a message via Yahoo to Ihmhi
That's a cheat in FF?

sv_cheats 1

give ff_weapon_NAME

fpg
sniperrifle
knife

etc.

Scout with RPG = fun
__________________
Support FF:
Anime: The Thread: Reloaded
The one and only anime thread on these here forums.

Select the pistol, and then, select your horse.
Ihmhi is offline   Reply With Quote


Old 08-22-2008, 02:49 AM   #7
Nezumi
Retired FF Staff
 
Nezumi's Avatar
 
Join Date: Mar 2007
Location: The Peoples Republic of Harmfull Free Radicals.
Class/Position: Soldier, O
Gametype: Doubble Mode
Affiliations: Cassiotone Nation
Posts Rated Helpful 1 Times
If you bspzip a file into your map with the same name as a base file, the game will load the one in your map. Many files will only be loaded once, and won't be reloaded on round resets though (like player skins). You may be able to have your own version of ff_weapon_railgun, for example, zipped into your map but I don't know what will happen when the server switches maps.
__________________
TG: pretty much you have no idea how much i fuckin own at this game.
TG: i bested no less than three flaming tornados and broke a huge wizard.
Nezumi is offline   Reply With Quote


Old 08-22-2008, 10:04 AM   #8
GeoKill----->
Community Member
Server Owner
Beta Tester
Forum Moderator
 
GeoKill----->'s Avatar
 
Join Date: Mar 2007
Location: Hawthorne, California
Class/Position: Soldier/Spy/Scout
Gametype: AvD
Affiliations: :e0:Eternal Order Leader
Posts Rated Helpful 12 Times
Well I notice in Anticitizen, the player skins stay sometimes after map change
__________________

:e0: Will live on Forever
Support FF:
GeoKill-----> is offline   Reply With Quote


Old 08-24-2008, 10:00 AM   #9
Nezumi
Retired FF Staff
 
Nezumi's Avatar
 
Join Date: Mar 2007
Location: The Peoples Republic of Harmfull Free Radicals.
Class/Position: Soldier, O
Gametype: Doubble Mode
Affiliations: Cassiotone Nation
Posts Rated Helpful 1 Times
Apparently the vmf only gets loaded when you connect, not when the map changes, so the skins in Anticitizen may get scrapped unless we can change the way the game loads resources.

(It may be possible to code a lua function that does this)
__________________
TG: pretty much you have no idea how much i fuckin own at this game.
TG: i bested no less than three flaming tornados and broke a huge wizard.
Nezumi is offline   Reply With Quote


Old 08-24-2008, 03:30 PM   #10
GeoKill----->
Community Member
Server Owner
Beta Tester
Forum Moderator
 
GeoKill----->'s Avatar
 
Join Date: Mar 2007
Location: Hawthorne, California
Class/Position: Soldier/Spy/Scout
Gametype: AvD
Affiliations: :e0:Eternal Order Leader
Posts Rated Helpful 12 Times
Well the skins do look better though
__________________

:e0: Will live on Forever
Support FF:
GeoKill-----> is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:18 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.