Anmelden

Archiv verlassen und diese Seite im Standarddesign anzeigen : AllWelder für Gmod9



vulcano66
07.06.2007, 16:00
Hiho
Bin neu im Forum^^
Also ich suche ein Waffe die es mir ermöglicht mehrere Gegenstände aufeinmal zu welden (zusammenzukleben).
Ich hab hier eine .lua doch leider weiss ich nicht wie ich diese im Spiel einfüge.

-- This is the base SWEP (Scripted Weapon).
-- DO NOT change this file.
-- When making a new weapon you only need to override what you need.

_OpenScript( "includes/defines.lua" );
_OpenScript( "includes/vector3.lua" );
_OpenScript( "includes/misc.lua" );
_OpenScript( "includes/backcompat.lua" );


-- These variables are passed by the engine
-- Don't re-define them in your SWEP.
MyIndex = 0; -- Weapon's entity index.
Owner = 0; -- The player that owns this weapon
CurrentTime = 0; -- The current game time

props = { };

weldlimit = -1 --Maximum number of props to group weld. (-1 is unlimited)

-- Called when the weapon is created.

function onInit( )
_WeaponFlipHands("weapon_groupweld", true);
_SWEPSetSound(MyIndex, "single_shot", "Weapon_M4A1.Silenced");

_RunString([[
if (gw == nil) then gw = {}; end
if (constraints == nil) then constraints = {}; end

function gw.think()
for i in constraints do
if not _EntExists(constraints[i].firstprop) or not _EntExists(constraints[i].secprop) then
_EntRemove(constraints[i].id);
--_Msg("GW Const " .. constraints[i].id .. " removed.\n");
table.remove(constraints, i);
end
end
end

AddThinkFunction(gw.think);

_Msg("GW Loaded!\n");
]]);



end


-- Called when player picks up weapon
function onPickup( playerid )
end


-- Called when player drops weapon
function onDrop( playerid )
end


-- Weapon is about to be destroyed.
function onRemove( )
end


-- Called every frame


-- When the player presses left mouse button

function onPrimaryAttack( )

local vecpos = _PlayerGetShootPos( Owner );
local plyang = _PlayerGetShootAng( Owner );

_TraceLine( vecpos, plyang, 8000, Owner );
if (_TraceHitWorld() == true) or (_TraceHit() == false) then return; end
local hitpos = _TraceEndPos();

local ent = _TraceGetEnt();

local check = false

for i in props do
if (props[i] == ent) then
_EntFire(ent, "color", "255 255 255", 0);
table.remove(props, i);
check = true
end
end

if check ~= true and table.getn(props) < weldlimit or check ~= true and weldlimit == -1 then
_EntFire(ent, "color", "0 255 0", 0);
table.insert(props,ent);
end

end



-- When the player presses right mouse button

function onSecondaryAttack( )
local propsexist = { }
local propswelded = { }
local welds = 0
local welded = false

for i in props do
if _EntExists(props[i]) then
table.insert(propsexist, props[i]);
end
end


for i in propsexist do
for j in propsexist do
welded = false

for k in propswelded do
if propsexist[j] == propswelded[k] then
welded = true
end
end

if propsexist[j] ~= propsexist[i] and welded ~= true then
local firstprop = propsexist[i];
local secprop = propsexist[j];
local id = WeldEntities(firstprop, secprop);
welds = welds + 1

_RunString([[
hash = {};
hash.firstprop = ]] .. firstprop .. [[
hash.secprop = ]] .. secprop .. [[
hash.id = ]] .. id .. [[

table.insert(constraints, hash);

]]);


end
end
table.insert(propswelded, propsexist[i]);
end

for i in propsexist do
_EntFire(propsexist[i], "color", "255 255 255", 0);
end

props = { }

_PrintMessage(Owner, 2, welds .. " welds (" .. table.getn(propsexist) .. " props) done!\n");
end


-- When Weapon is swapped to

function Deploy( )
end


-- When weapon swapped away from

function Holster( )
end


-- When player presses reload. Returning false means DON'T RELOAD. Although this will hitch on the client.

function onReload( )
return false;
end



-- Primary Attack Settings

function getDamage()
return 10;
end

function getPrimaryShotDelay()
return 0.1;
end

function getPrimaryIsAutomatic()
return false;
end

function getBulletSpread()
return vector3( 0.01, 0.01, 0.01 );
end

function getViewKick()
return vector3( 0, 0, 0);
end

function getViewKickRandom()
return vector3( 0, 0, 0 );
end

function getNumShotsPrimary()
return 1;
end

function getPrimaryAmmoType()
return "pistol";
end

function getMaxClipPrimary() -- return -1 if it doesn't use clips
return -1;
end

function getDefClipPrimary() -- ammo in gun by default
return 1;
end

function getTracerFreqPrimary() -- 0 = none, 1 = every bullet, 2 = every 2nd bullet etc
return 2;
end


-- Secondary attack Settings

function getDamageSecondary()
return 10;
end

function getSecondaryShotDelay()
return 0.1;
end

function getSecondaryIsAutomatic()
return false;
end

function getBulletSpreadSecondary()
return vector3( 0.001, 0.001, 0.001 );
end

function getViewKickSecondary()
return vector3( 0, 0.0, 0.0);
end

function getViewKickRandomSecondary()
return vector3( 0, 0, 0 );
end

function getNumShotsSecondary()
return 1;
end

function getSecondaryAmmoType()
return "pistol";
end

function getMaxClipSecondary() -- return -1 if it doesn't use clips
return -1;
end

function getDefClipSecondary()
return 1;
end

function getTracerFreqSecondary()
return 2;
end




-- Weapon Configuration

function getViewModel( )

return "models/weapons/v_pist_deagle.mdl";

end

function getWorldModel( )

return "models/weapons/w_pist_deagle.mdl";

end

function getClassName()
return "weapon_groupweld";
end

function getHUDMaterial( )
return "gmod/SWEP/default";
end

function getDeathIcon( )
return "swep_default";
end

function getWeaponSwapHands()
return true
end

function getWeaponFOV()
return 70
end

function getWeaponSlot()
return 5
end

function getWeaponSlotPos()
return 2
end

function getFiresUnderwater()
return true
end

function getReloadsSingly()
return false
end

-- How the player model holds the weapon:
-- pistol, smg, ar2, shotgun, rpg, phys, crossbow, melee, slam, grenade
function getAnimPrefix()
return "pistol";
end

function getPrintName()
return "Group Welder";
end

-- 0 = Don't override, shoot bullets, make sound and flash
-- 1 = Don't shoot bullets but do make flash/sounds
-- 2 = Only play animations
-- 3 = Don't do anything
function getPrimaryScriptOverride()
return 1;
end

function getSecondaryScriptOverride()
return 1;
end

Also ich hoffe mir kann jemmand eine Waffe posten oder sagen wie ich diese im Spiel einfüge.

MfG
Vulcano

Scarecrow
07.06.2007, 16:04
Das was du da hast, ist ein SWEP, also eine gescriptete Waffe. Ich kenne mich nur noch wenig mit dem System von Gmod9 aus, aber ich denke, dass es einen Ordner mit den ganzen SWEPs gibt, wo du das Script einfügen musst.

vulcano66
07.06.2007, 16:12
Das habe ich schon versuch aba InGame war die Waffe nirgends zu finden.

MfG
Vulcano

Scarecrow
07.06.2007, 16:15
Ok, dann versuch folgendes: Stecke dieses Script in einen Ordner, sowie alle Anderen SWEPs auch. Dann lade dein Gmod und gehe auf eine beliebige Map. Sobald du gespawnt wurdest, öffnest du die Konsole und kopierst alles. Den Log postest du hier rein.

Oder du schaust selbst in der Konsole nach etwas "auffälligem" nach ;)

Lucid
07.06.2007, 17:16
OMFG ICH KNUTSCH DICH WENN DIE LUA FUNZT !
sorry das musste echt raus
ich suche EWIG einen groupwelder fuer gmod9
und was ist? jemand fragt wie man den installiert :D

- super, ich hab dem drogenviech da jetzt geholfen, wie installier ich das nun? :P

- erstelle im ordner C:\Programme\Steam\steamapps\SourceMods\gmod9\lua\ weapons\ einen neuen ordner mit dem namen "waffen"
- dann oeffnest du windows notepad, auch bekannt als windows editor
- du kopierst den code da rein und speicherst das ganze als "groupweld.lua" im ordner C:\Programme\Steam\steamapps\SourceMods\gmod9\lua\ weapons\waffen\
- vergesse nicht im "speichern unter"-dialog bei notepad als dateityp "alle dateien" zu wählen, und als speicher-dateinamen gleich "groupwelder.lua" (mit dateiendung) zu verwenden

ich hoffe das war verständlich

Scarecrow
07.06.2007, 18:42
Ne, bei ihm geht es irgendwie nicht, denke ich.

vulcano66
08.06.2007, 08:29
Dank Euch !
Es hat geklappt ^^ hatte es wohl nur falsch abgespeichert.

MfG
Vulcano

The | Line
02.07.2007, 15:36
wie geil! thx!

Mr.Man
02.07.2007, 23:34
Was bewirkt denn n Groupwelder?

Scarecrow
05.07.2007, 23:14
Was bewirkt denn n Groupwelder?

Genau das was der Name sagt: Du weldest eine Menge Objekte auf einmal, musst nicht zwischen jedem Objekt einen Weld machen und das Beste - dadurch, dass alles mit allem geweldet wird, ist das Endobjekt sehr stabil.