Archiv verlassen und diese Seite im Standarddesign anzeigen : Mein erster Gmod Mod...ein paar fragen
Andynator
18.07.2008, 13:36
Hallo!
Ich bin kein LUA Profi, um genau zu sein bin ich ein Lua noob!
Naja ich brauch eigentlich nur eins!
Garry hat den Base Gamemode gemacht damit man eine Mod Grundlage hat, meine Frage ist, wie kann ich die Waffen austauschen, und Stargate Waffen reintun, damit man beim Start nur mit Stargate Waffen started?
Cool wäre noch wenn mir jemand sagen könnte wie ich zwei Teams hinbekomme, und die Zwei Teams mt Unterschidlichen Waffen Starten!
Aber mir reicht wenn ich das erste weis!
Danke!
Was haben Lua-Fragen mit Mods & Addons zu tun?
> Verschoben...
Andynator
18.07.2008, 14:45
Sry
Kann mir jetz wer helfen`?
TheStargater
18.07.2008, 14:46
ich geb dir ein tipp:
finde es selber heraus. probiers erstmal aus ob du es hinbekommst und dann kannste wieder kommen.
Andynator
18.07.2008, 14:51
Was glaubst du hab ich?
Natürlich habn ichs versucht!
Aber das ist für mich Japanisch oO! (Nicht wortwörtlich)
Du müsstes nur mit den TeamLibrary (http://wiki.garrysmod.com/wiki/?title=Team) und den
PlayerSpawn (http://wiki.garrysmod.com/wiki/?title=Gamemode.PlayerSpawn) hook arbeiten(bzw den PlayerInitalSpawn (http://wiki.garrysmod.com/wiki/?title=Gamemode.PlayerInitialSpawn) für das setzen des Team des Spieler)
Ist sehr einfach,müsste auch ein Anfänger schaffen.
Ps. Ich gebe immer nur Anregungen,damit ihr was lernt und nicht einfach kopiert.
Andynator
18.07.2008, 17:08
ja nur in welche datei soll ich das Editieren?
Die Waffen^
Wenn du nen eigenen Gamemode machst,müsstes du das in deiner Init.lua machen können.
Andynator
18.07.2008, 17:20
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
include( "ai_translations.lua" )
SWEP.Weight = 5 // Decides whether we should switch from/to this
SWEP.AutoSwitchTo = true // Auto switch to if we pick it up
SWEP.AutoSwitchFrom = true // Auto switch from if you pick up a better weapon
local ActIndex = {}
ActIndex[ "pistol" ] = ACT_HL2MP_IDLE_PISTOL
ActIndex[ "smg" ] = ACT_HL2MP_IDLE_SMG1
ActIndex[ "grenade" ] = ACT_HL2MP_IDLE_GRENADE
ActIndex[ "ar2" ] = ACT_HL2MP_IDLE_AR2
ActIndex[ "shotgun" ] = ACT_HL2MP_IDLE_SHOTGUN
ActIndex[ "rpg" ] = ACT_HL2MP_IDLE_RPG
ActIndex[ "physgun" ] = ACT_HL2MP_IDLE_PHYSGUN
ActIndex[ "crossbow" ] = ACT_HL2MP_IDLE_CROSSBOW
ActIndex[ "melee" ] = ACT_HL2MP_IDLE_MELEE
ActIndex[ "slam" ] = ACT_HL2MP_IDLE_SLAM
ActIndex[ "normal" ] = ACT_HL2MP_IDLE
/*---------------------------------------------------------
Name: SetWeaponHoldType
Desc: Sets up the translation table, to translate from normal
standing idle pose, to holding weapon pose.
---------------------------------------------------------*/
function SWEP:SetWeaponHoldType( t )
local index = ActIndex[ t ]
if (index == nil) then
Msg( "SWEP:SetWeaponHoldType - ActIndex[ \""..t.."\" ] isn't set!\n" )
return
end
self.ActivityTranslate = {}
self.ActivityTranslate [ ACT_HL2MP_IDLE ] = index
self.ActivityTranslate [ ACT_HL2MP_WALK ] = index+1
self.ActivityTranslate [ ACT_HL2MP_RUN ] = index+2
self.ActivityTranslate [ ACT_HL2MP_IDLE_CROUCH ] = index+3
self.ActivityTranslate [ ACT_HL2MP_WALK_CROUCH ] = index+4
self.ActivityTranslate [ ACT_HL2MP_GESTURE_RANGE_ATTACK ] = index+5
self.ActivityTranslate [ ACT_HL2MP_GESTURE_RELOAD ] = index+6
self.ActivityTranslate [ ACT_HL2MP_JUMP ] = index+7
self.ActivityTranslate [ ACT_RANGE_ATTACK1 ] = index+8
self:SetupWeaponHoldTypeForAI( t )
end
// Default hold pos is the pistol
SWEP:SetWeaponHoldType( "pistol" )
/*---------------------------------------------------------
Name: weapon:TranslateActivity( )
Desc: Translate a player's Activity into a weapon's activity
So for example, ACT_HL2MP_RUN becomes ACT_HL2MP_RUN_PISTOL
Depending on how you want the player to be holding the weapon
---------------------------------------------------------*/
function SWEP:TranslateActivity( act )
if ( self.Owner:IsNPC() ) then
if ( self.ActivityTranslateAI[ act ] ) then
return self.ActivityTranslateAI[ act ]
end
return -1
end
if ( self.ActivityTranslate[ act ] != nil ) then
return self.ActivityTranslate[ act ]
end
return -1
end
/*---------------------------------------------------------
Name: OnRestore
Desc: The game has just been reloaded. This is usually the right place
to call the GetNetworked* functions to restore the script's values.
---------------------------------------------------------*/
function SWEP:OnRestore()
end
/*---------------------------------------------------------
Name: AcceptInput
Desc: Accepts input, return true to override/accept input
---------------------------------------------------------*/
function SWEP:AcceptInput( name, activator, caller, data )
return false
end
/*---------------------------------------------------------
Name: KeyValue
Desc: Called when a keyvalue is added to us
---------------------------------------------------------*/
function SWEP:KeyValue( key, value )
end
/*---------------------------------------------------------
Name: OnRemove
Desc: Called just before entity is deleted
---------------------------------------------------------*/
function SWEP:OnRemove()
end
/*---------------------------------------------------------
Name: Equip
Desc: A player or NPC has picked the weapon up
---------------------------------------------------------*/
function SWEP:Equip( NewOwner )
end
/*---------------------------------------------------------
Name: EquipAmmo
Desc: The player has picked up the weapon and has taken the ammo from it
The weapon will be removed immidiately after this call.
---------------------------------------------------------*/
function SWEP:EquipAmmo( NewOwner )
end
/*---------------------------------------------------------
Name: OnDrop
Desc: Weapon was dropped
---------------------------------------------------------*/
function SWEP:OnDrop()
end
/*---------------------------------------------------------
Name: ShouldDropOnDie
Desc: Should this weapon be dropped when its owner dies?
---------------------------------------------------------*/
function SWEP:ShouldDropOnDie()
return true
end
/*---------------------------------------------------------
Name: GetCapabilities
Desc: For NPCs, returns what they should try to do with it.
---------------------------------------------------------*/
function SWEP:GetCapabilities()
return CAP_WEAPON_RANGE_ATTACK1 | CAP_INNATE_RANGE_ATTACK1
end
/*---------------------------------------------------------
Name: NPCShoot_Secondary
Desc: NPC tried to fire secondary attack
---------------------------------------------------------*/
function SWEP:NPCShoot_Secondary( ShootPos, ShootDir )
self:SecondaryAttack()
end
/*---------------------------------------------------------
Name: NPCShoot_Secondary
Desc: NPC tried to fire primary attack
---------------------------------------------------------*/
function SWEP:NPCShoot_Primary( ShootPos, ShootDir )
self:PrimaryAttack()
end
// These tell the NPC how to use the weapon
AccessorFunc( SWEP, "fNPCMinBurst", "NPCMinBurst" )
AccessorFunc( SWEP, "fNPCMaxBurst", "NPCMaxBurst" )
AccessorFunc( SWEP, "fNPCFireRate", "NPCFireRate" )
AccessorFunc( SWEP, "fNPCMinRestTime", "NPCMinRest" )
AccessorFunc( SWEP, "fNPCMaxRestTime", "NPCMaxRest" )
WO soll ich da jetz was eintragen/hinzufügen/ersetzen?
Nirgendswo?
Das ist die Base Gamemode?
Scarecrow
19.07.2008, 00:28
Du musst die player.lua - Datei öffnen! Sobald du das mit den Stargate Waffen hast (ich glaub das war mit content/lua oder so), musst du in der Datei ändern, welche Startwaffen man erhält, weil du ja wolltest, dass man am Anfang nur die Gate-Waffen hat.
Andynator
19.07.2008, 09:21
Danke Scarecrow!
Ich werds versuchen!
EDIT: Habs gefunden, aber wie weis ich wie die STargate Waffen heisen? In Lua Sprache!
Also "weapon_waffenname" <<< Wie kann ich das herrausfinden`?
Schau dir den Ordner Namen der Waffe an.
Und warum räts du ihn dazu die Base files zu kopieren Scarecrow?
Würde doch nur die LadeZeit verdoppeln,da er den Base Gamemode zweimal lädt :/
Andynator
19.07.2008, 09:39
WIe sollte ich es sont machen?
Wenn du mir ne erklärung gibst wie das funzt, und was ich da Lua'n muss gerne, dann mach ichs ohne Base Mod!
Nicht ohne,Garrysmod lädt bei jeden Gamemode automatisch die Base(Außer du sagst im explizit,dass er es nicht tun soll)
Klar kannst du dir ja angucken wie was im Base code funktioniert,und die Funktion die du veränderst rüberkopieren.
(Alles was im Base Gamemode mit cl_ beginnt müsste in die cl_init in dein Gamemode geschrieben werden,und die,die es nicht tun,in die Init.
(Bzw die die Shared in sich haben in deine Shared.lua)
Hier kannst du dir übrigens super die Struktur Struktur in einen Gamemode Ordner anschauen.
http://wiki.garrysmod.com/wiki/?title=Category:Lua:Articles:Gamemodes
Andynator
20.07.2008, 18:54
Also, ich hab mich jetzt so weit ich die Wiki Anleitung verstanden hab, alles genau gemacht.
1Frage bleibt immer ungeklärt, wo trage ich die Waffen beim Spawnen ein und wo die Models beim Spawnen?
Scarecrow
21.07.2008, 02:03
Ach ja: Es geht sowohl über Content/lua als auch über entities/weapons. Ich empfehle aber trotzdem letzteres als Ablage für SWEPs zu benutzen, weil es so übersichtlicher wird.
PS: Irgendwo müsste ein fetter Codeblock sein, wo sowas wie Weapon Loadout in den Comments steht.
Andynator
21.07.2008, 07:23
Ok ich werd mal guggn!
Ich werde dann nochmal fragen und eure hilfe brauchen, ich danke euch das ihr soviel gedult mit mir habt!
Ich komm da grad nicht weiter!
Ich finde Loadout oder sowas nicht!
Kann mir einer diese Lua machen? und mir schicken, ich häng da voll ^ danke
Scarecrow
21.07.2008, 19:36
Du hast die Lua bereits, aber anscheinend nicht richtig nachgeguckt. Ich überseh auch ständig Sachen und reg mich auf, wie dúmm andere Leute sind und mir aufdrehen wollen, ich sei blind.
Jedenfalls werde ich sobald ich an meinem PC bin, mal nachschauen, wo es ist.
Andynator
22.07.2008, 07:20
danke!
Scarecrow
22.07.2008, 12:33
Datei: player.lua
Zeile: 380 und folgenden
function GM:PlayerLoadout( pl )
pl:GiveAmmo( 255, "Pistol", true )
pl:GiveAmmo( 90, "SMG1", true )
pl:GiveAmmo( 1, "grenade", true )
pl:GiveAmmo( 32, "Buckshot", true )
pl:GiveAmmo( 16, "357", true )
pl:Give( "weapon_stunstick" )
pl:Give( "weapon_crowbar" )
pl:Give( "weapon_pistol" )
pl:Give( "weapon_smg1" )
pl:Give( "weapon_frag" )
pl:Give( "weapon_physcannon" )
//pl:Give( "weapon_physgun" )
// Switch to prefered weapon if they have it
local cl_defaultweapon = pl:GetInfo( "cl_defaultweapon" )
if ( pl:HasWeapon( cl_defaultweapon ) ) then
pl:SelectWeapon( cl_defaultweapon )
end
end
Powered by vBulletin® Version 4.2.2 Copyright ©2025 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.