[ POMOC] podmiana / repleacer

Uczymy się edytowania P2 i rozwiązujemy nasze problemy. Nowi adepci mile widziani!

Moderatorzy: Moderatorzy, Admini

Awatar użytkownika
Bartkov
Zabójca na sterydach
Zabójca na sterydach
Posty: 519
Rejestracja: 02 gru 2012, 10:43
Lokalizacja: Wielkopolska
Kontakt:

01 lut 2017, 18:41

Witam, mam pytanie jak napisać repleacer do granatnika? chodzi o to, że zamiast granatnika będzie inna broń. Chodzi oczywiście o "świetny" granatnik z p2 complete. Będę wdzięczny za pomoc ;)


Od śmiechu niedaleko jest do płaczu, bo szczęście jest kruche jak szkło.
Awatar użytkownika
Pan Szatan
Modder
Modder
Posty: 6207
Rejestracja: 05 gru 2013, 13:16
Lokalizacja: Paradise
Postawił piwo: 5 razy
Otrzymał  piwo: 8 razy
Kontakt:

01 lut 2017, 19:04

W modzie Xetreme Launcher jest repleacer który zamienia zwykłą wyrzutnię na właśnie tą.
Ja bym spróbował odtworzyć sobie te pliki w PostED a potem wyexportować skrypt i zobaczyć jak to działa ;)


I'm fucking insane in the brain. :axe:
Awatar użytkownika
Rycho3D
Modder
Modder
Posty: 11978
Rejestracja: 24 kwie 2011, 15:47
Lokalizacja: SinCity
Postawił piwo: 8 razy
Otrzymał  piwo: 1 raz
Kontakt:

01 lut 2017, 22:45

Podobnie do tego

Kod: Zaznacz cały

///////////////////////////////////////////////////////////////////////////////
// Asset Replacer
//
// This is a sample Workshop mod based off of P2GameMod.
// Feel free to copy this code and use it as a basis for your own game mods.
//
// This is a mod that reads in a list of textures and sounds in the default
// properties, and attempts to replace them in-game wherever possible.
//
// Limitations:
// * BSP surfaces can't be messed with. If you want to change the texture on
//   a wall, rebuild the map and include it with your mod.
// * Dialog won't be replaced. Script a new dialog class and assign it to
//   the desired pawns.
// * Some classes change materials or sounds on the fly; this mod won't change
//   those.
// * Certain specific sounds or skins won't be replaced, you'll have to change
//   them manually.
///////////////////////////////////////////////////////////////////////////////
class AssetReplacer extends P2GameMod;

struct MaterialReplaceStruct {
	var() Material OldMaterial, NewMaterial;
};

struct SoundReplaceStruct {
	var() Sound OldSound, NewSound;
};

var&#40;&#41; array<MaterialReplaceStruct> MaterialReplace;
var&#40;&#41; array<SoundReplaceStruct> SoundReplace;

///////////////////////////////////////////////////////////////////////////////
// ReplaceMaterial
// Attempts to replace passed-in material
///////////////////////////////////////////////////////////////////////////////
function Material ReplaceMaterial&#40;Material ReplaceMe&#41;
&#123;
	local int i;
	
	for &#40;i = 0; i < MaterialReplace.Length; i++&#41;
	&#123;
		if &#40;ReplaceMe == MaterialReplace&#91;i&#93;.OldMaterial&#41;
			return MaterialReplace&#91;i&#93;.NewMaterial;
	&#125;
	
	return None;
&#125;

///////////////////////////////////////////////////////////////////////////////
// ReplaceSound
// Attempts to replace passed-in sound
///////////////////////////////////////////////////////////////////////////////
function Sound ReplaceSound&#40;Sound ReplaceMe&#41;
&#123;
	local int i;
	
	for &#40;i = 0; i < SoundReplace.Length; i++&#41;
	&#123;
		if &#40;ReplaceMe == SoundReplace&#91;i&#93;.OldSound&#41;
			return SoundReplace&#91;i&#93;.NewSound;
	&#125;
	
	return None;
&#125;

///////////////////////////////////////////////////////////////////////////////
// ParseActor
// Looks to replace any textures, sounds on new actor
///////////////////////////////////////////////////////////////////////////////
function ParseActor&#40;Actor Other&#41;
&#123;
	local int i, j;
	local Material NewMaterial;
	local Sound NewSound;
	local Name NewName;
	
	if &#40;Other == None&#41;
		return;
	
	// Try Actor skins and sounds
	for &#40;i = 0; i < Other.Skins.Length; i++&#41;
	&#123;
		NewMaterial = ReplaceMaterial&#40;Other.Skins&#91;i&#93;&#41;;
		if &#40;NewMaterial != None&#41;
			Other.Skins&#91;i&#93; = NewMaterial;
	&#125;
	NewMaterial = ReplaceMaterial&#40;Other.Texture&#41;;
	if &#40;NewMaterial != None&#41;
		Other.Texture = NewMaterial;
	NewSound = ReplaceSound&#40;Other.AmbientSound&#41;;
	if &#40;NewSound != None&#41;
		Other.AmbientSound = NewSound;
		
	// Emitters.
	if &#40;Emitter&#40;Other&#41; != None&#41;
	&#123;
		for &#40;i = 0; i < Emitter&#40;Other&#41;.Emitters.Length; i++&#41;
		&#123;
			NewMaterial = ReplaceMaterial&#40;Emitter&#40;Other&#41;.Emitters&#91;i&#93;.Texture&#41;;
			if &#40;Texture&#40;NewMaterial&#41; != None&#41;
				Emitter&#40;Other&#41;.Emitters&#91;i&#93;.Texture = Texture&#40;NewMaterial&#41;;
		&#125;
	&#125;
	
	// Sound Things
	if &#40;SoundThing&#40;Other&#41; != None&#41;
	&#123;
		for &#40;i = 0; i < SoundThing&#40;Other&#41;.Settings.Sounds.Length; i++&#41;
		&#123;
			NewSound = ReplaceSound&#40;SoundThing&#40;Other&#41;.Settings.Sounds&#91;i&#93;&#41;;
			if &#40;NewSound != None&#41;
				SoundThing&#40;Other&#41;.Settings.Sounds&#91;i&#93; = NewSound;
		&#125;
	&#125;
	
	// Pistol.
	if &#40;PistolWeapon&#40;Other&#41; != None&#41;
	&#123;
		NewSound = ReplaceSound&#40;PistolWeapon&#40;Other&#41;.FireSound&#41;;
		if &#40;NewSound != None&#41;
			PistolWeapon&#40;Other&#41;.FireSound = NewSound;
	&#125;
&#125;

///////////////////////////////////////////////////////////////////////////////
// CheckReplacement
// This function is called for any actor spawned into the world.
// You can use this function to change any default properties of that actor,
// or replace it entirely with something else using ReplaceWith.
// Return FALSE if you replace the actor or just want it to be destroyed.
// Return TRUE if you want to keep the actor and don't want to replace it.
// Unlike other functions you do NOT need to call Super here.
///////////////////////////////////////////////////////////////////////////////
function bool CheckReplacement&#40;Actor Other, out byte bSuperRelevant&#41;
&#123;
	ParseActor&#40;Other&#41;;
	return true;
&#125;

///////////////////////////////////////////////////////////////////////////////
// ModifyNPC
// Called by PersonController/AnimalController after adding default inventory.
// Use this function to alter any aspect of the NPC you like.
// At this point the pawn's head and body are set, so we can change their skins
// now!
///////////////////////////////////////////////////////////////////////////////
function ModifyNPC&#40;Pawn Other&#41;
&#123;
	local int i;
	Super.ModifyNPC&#40;Other&#41;;
	
	// Do both the body and head separately.
	ParseActor&#40;Other&#41;;
	if &#40;P2MocapPawn&#40;Other&#41; != None&#41;
	&#123;
		ParseActor&#40;P2MocapPawn&#40;Other&#41;.MyHead&#41;;
		// And while we're at it get the boltons too
		for &#40;i = 0; i < P2MocapPawn&#40;Other&#41;.MAX_BOLTONS; i++&#41;
			ParseActor&#40;P2MocapPawn&#40;Other&#41;.Boltons&#91;i&#93;.part&#41;;
	&#125;
&#125;

///////////////////////////////////////////////////////////////////////////////
// Default properties required by all P2GameMods.
///////////////////////////////////////////////////////////////////////////////
defaultproperties
&#123;
	// GroupName - any Game Mods with the same GroupName will be considered incompatible, and only one will be allowed to run.
	// Use this if you make mods that are not designed to run alongside each other.
	GroupName=""
	// FriendlyName - the name of your Game Mod, displayed in the game mod menu.
	FriendlyName="Asset Replacer"
	// Description - optional short description of your Game Mod
	Description="Replaces textures and sounds in-game."
	
	MaterialReplace&#91;0&#93;=&#40;OldMaterial=Texture'AnimalSkins.Dog',NewMaterial=Texture'Engine.DefaultTexture'&#41;
	MaterialReplace&#91;1&#93;=&#40;OldMaterial=Texture'ChameleonSkins.MB__033__Avg_M_SS_Pants',NewMaterial=Texture'Engine.DefaultTexture'&#41;
	SoundReplace&#91;0&#93;=&#40;OldSound=Sound'AnimalSounds.insects.katydid1',NewSound=Sound'AmbientSounds.fart4'&#41;


8=======D
ODPOWIEDZ