Forums are in read-only mode. Data has been backed up but be sure to save anything you want.

Adding an input to a sent.



  • Does anyone know how to add a custom input to a sent that can be used with ent:fire? I can’t find it on the wiki and facepunch is taking too long.



  • Does anyone know how to add a custom input to a sent that can be used with ent:fire? I can’t find it on the wiki and facepunch is taking too long.



  • Make a custom console command insead ent_fire



  • Pretty sure I saw something like that in gmod\gamemodes\base_gamemode\entities\entities\base\output.lua.



  • @Samuel:

    Make a custom console command insead ent_fire

    no
    Now I’m not sure about this. Do I actually need to ADD an input or can I just use ENT:AcceptInput?



  • function ENT:AcceptInput(name, activator, caller, arg)
    if name == “kill” then print(“nope”) return true end
    end

    Returning true tells the game to let Lua handle it. You can use any input you want (custom too) but you should return true anyway to prevent Unhandled Input errors. Outputs are a pretty complicated and I’m pretty sure I’m the only one who has been able to create custom outputs. If you need those then ask.



  • Ok thanks, that was a lot more help than the people on facepunch. Now one more thing. When using the OnTouch output, is there a way to detect which entity actually hit the entity? Basically what I’m trying to do is detect when a specific jeep is collided with, then check whether the thing that collided with it is contained in a certain table. Is there any way to do that without using EntityTakeDamae? It doesn’t seem to be working properly.



  • If this is an “anim” entity (not a brush) then be sure to use self:SetTrigger(true) in the initialize function.

    
    JEEPTable = {}
    
    function ENT:StartTouch(ent)
        for _, val in pairs(JEEPTable) do
            if val == ent then
               // val is the jeep
            end
        end
    end
    

    You’ll have to find a way to get the jeep you want in to that table.



  • The only problem with that is that I need to detect a collision between two jeeps, meaning that I can’t use a sent. I should have been more specific before, sorry :S
    A person on facepunch suggested that I use inputs and outputs which is why I made this thread in the first place, but then I realized after the fact that I couldn’t use that to check which entity hit it. Here is my help thread,
    http://forums.facepunchstudios.com/showthread.php?t=541411
    where the first thing I tried was making a jeep sent, which failed. Anyways, the point I’m at right now is just trying to detect the collision between two jeeps, and checking if each jeep is in a table.



  • Can you post some code which demonstrates custom entity outputs?



  • Garry’s description is pretty vague, but I THINK there’s sort of an example in that file Zetanor posted.


Log in to reply
 

0
Online

11.3k
Users

15.5k
Topics

300.2k
Posts