PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Melon Pill



Stein_Steinland
16.06.2008, 16:29
Hi,
Da ja jetzt seit kurzem auch der Melonracer Gamemode draussen ist hätte ich mir gedacht das irgendjemand der sich mit sowas auskennt vielleicht für Sandbox eine Pille machen könnte (kennt ihr ja bestimmt von solchen NPC Pills also eine SWEP wenn man die nimmt ist man z.B. eine Headcrab) mit der man zur Melone wird und auch die Funktionen wie bei Melonracer hat. Ich selbst kenne mich mit sowas nicht aus und frage deswegen mal hier.
Hoffe auf baldige Antwort

Brick_Birkland

WeltEnSTurm
26.06.2008, 16:25
ENT.Type = "anim"

ENT.PrintName = ""
ENT.Author = ""
ENT.Contact = ""

ENT.Spawnable = false
ENT.AdminSpawnable = false
ENT.RenderGroup = RENDERGROUP_OPAQUE

AddCSLuaFile( "shared.lua" )

AccessorFunc( ENT, "m_pPlayer", "Player" )
AccessorFunc( ENT, "m_fJumpPower", "JumpPower" )

/*---------------------------------------------------------
Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()

if ( SERVER ) then
self:SetModel( "models/props_junk/watermelon01.mdl" )

self:PrecacheGibs()

self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )

self:StartMotionController()

self:SetJumpPower( 1 )
end

end

/*---------------------------------------------------------
Name: Initialize
---------------------------------------------------------*/
function ENT:Think()

if ( SERVER ) then

if ( !IsValid(self.m_pPlayer) ) then self:Remove() return end

self:GetPhysicsObject():Wake()

self.m_fJumpPower = math.Approach( self.m_fJumpPower, 1, 0.1 )

// Shouldn't Observer mode automatically do this?
self.m_pPlayer:SetPos( self:GetPos() )

end

end

/*---------------------------------------------------------
Name: Simulate
---------------------------------------------------------*/
function ENT:PhysicsSimulate( phys, deltatime )

if ( !IsValid(self.m_pPlayer) ) then return SIM_NOTHING end

local ply = self.m_pPlayer
local vMove = Vector(0,0,0)
local aEyes = ply:EyeAngles()

if ( ply:KeyDown( IN_FORWARD ) ) then vMove = vMove + aEyes:Forward() end
if ( ply:KeyDown( IN_BACK) ) then vMove = vMove - aEyes:Forward() end
if ( ply:KeyDown( IN_MOVELEFT ) ) then vMove = vMove - aEyes:Right() end
if ( ply:KeyDown( IN_MOVERIGHT ) ) then vMove = vMove + aEyes:Right() end

vMove.z = 0;

vMove:Normalize()
vMove = vMove * 200000 * deltatime

if ( ply:KeyDown( IN_JUMP ) ) then
local Speed = Vector( 0, 0, 6000 ) * deltatime
self.m_fJumpPower = math.Approach( self.m_fJumpPower, 0, Speed.z * 0.001 )
phys:AddVelocity( Speed * self.m_fJumpPower )
end

return Vector(0,0,0), vMove, SIM_GLOBAL_FORCE

end

/*---------------------------------------------------------
Name: PhysicsCollide
Desc: Called when physics collides. The table contains
data on the collision
---------------------------------------------------------*/
function ENT:PhysicsCollide( data, physobj )

if ( IsValid( data.HitEntity ) && data.HitEntity:GetClass() == "prop_physics" ) then

data.HitEntity:Fire( "break", "", 0 )
physobj:SetVelocityInstantaneous( data.OurOldVelocity )

return end

// How head on was the collide?
local MoveDir = data.OurOldVelocity:Normalize()
local Dot = MoveDir:Dot( data.HitNormal )
if ( Dot < 0.3 ) then return end

local HitSpeed = data.Speed * Dot

if ( HitSpeed < 600 ) then return end

self:GibBreakClient( data.OurOldVelocity )
//self:GibBreakServer( data.OurOldVelocity )
self:Remove()

if ( IsValid(self.m_pPlayer) ) then
self.m_pPlayer:Kill()
end

end

garrysmod\gamemodes\melonracer\entities\entities\p layer_melon\shared.lua :gmod:
Vielleicht kannst du damit selbst was schönes basteln :D

Mr Jack
26.06.2008, 16:37
Du WEltensturm kannst du eigentlich .lua scripten?

Happy_Killer
26.06.2008, 16:39
like this?

http://www.garrysmod.org/img/?t=dll&id=30068 (http://www.garrysmod.org/downloads/?a=view&id=30068)

wenns das richtige ist drück doch bitte auf bedanken ;)

wenn nicht fang an mich zu hassen :D

ich hab sie selbst und finde sie toll

Pac_187
26.06.2008, 16:43
Hier ist auch noch eine:

http://www.garrysmod.org/img/?t=dll&id=16657 (http://www.garrysmod.org/downloads/?a=view&id=16657)