Is there any way to give kill credit for func_tankmortar?
Is there any way to give kill credit for func_tankmortar?
yourEntity:SetOwner(yourPlayer)
I know that's usually the case but it says killed by #mortarshell
Your entity fires a mortarshell right? Did you also do setOwner on that entity in your launcher?
Don't see any way to get that entity?
How does the player access/utilize the launcher?
myEnt = ents.Create("func_tankMortar");
Your shell is now "myEnt"
that's how.
What hook is that done in?
you can do this ANYWHERE serverside.
Derp. I know. But when is it being done in your code?
What code? Code where? I didnt write any code. I anwsered a question:
Thought you were OP, sorry.
Anyways, you didn't answer his question, he asked how to get the entity that the thing fired, and you just showed him how to create another tank shell.
Yes. I kind of did. When you assign something to a VARIABLE, it gives you a reference to it, mate. the reference to the entity that was created was the variable called myEnt.
Would you care to tell me where I did not answer his question?
Because the answer to his question is: Show us your code, OP.
Plus generally the variable it is assigned to is local, and if it was global it would conflict with other player's tankmortars
You clearly arent getting the point. Do you understand Lua, mate?
He wants to set the mortar shell's owner to something.
When he creates the shell, assign it to a variable, I called it myEnt. He now has a reference to his shell. That was his question. Now he can set the owner to what he wants by saying myEnt:SetOwner( <SOME PLAYER > )
It doesnt matter if it is local or global, because all you are doing is setting an owner of the entity before it is being created. You do not need a constant reference to the entity, nor do you need any sort of globalization for any further information or calls.
You don't need to see any code. And if you do, clearly you lack the proper solving techniques to be helping others in this forum.
Now, please don't bother posting any further.
Edited:
WRONG... It would be a reference to the last mortar created, so it would only affect the last mortar spawned, which, in a sense could affect at most, 1 shell belonging to 1 player, not every single mortar in existence.
And it's impossible for two mortars to be in the air at once. Also, what you said was right, but we need the hook it's being created in. (Presumably ENT.Use, so we can use the player argument to assign the owner to).
Oh really? You know how his code works without seeing it? How do you know this?
Player 1 fires mortar from ent1 at 2:22
Player 2 fires mortar from ent2 at 2:22
Congrats! There are 2 mortars in the air at the EXACT SAME TIME.
That's up to him to figure out. You don't need hook information. Didn't I already explain this to you before? It can go anywhere, and ent think, weapon primary fire, hell it could be called by a gamemode timer that just spawns random ones around the map. It doesnt matter.
There are LOADS of ways to get a player:
SQL
player.GetByID
Networked Entity
another function
etc.
Just leave while you are ahead.
Edit:
Love the boxes. Keep em coming.![]()
That was sarcasm.
If a person fires a mortar, then the global is set to him. Then another person fires a mortar and the global is set to that person. If the person who fired first gets a kill, then it will be accredited to the other person, because the global is set to him.
Edited:
Except you need to get the person who fired it, which means you need to assign something to that person when you fire it, so no, it cannot go anywhere.
Edited:
Gladly, as long as you continue to post dumb things.
You have rated me dumb more times than I have you. I rated you dumb there because it was a dumb post.
And you are being quite belligerent. I generally rate disagree when someone is civil with their wrong post, but for posts like that I save my boxes.
That's exactly my point. . .In order to tell him how to get the player, we need to know how it is used.
Edited:
I never accused you of giving me wrongful boxes.
Edited:
Actually:
Is false, which was why I was arguing.
Edited:
Isn't what I was arguing about.
Your code never had SetOwner in it.
Edited:
Although I see now that the next logical step would be to do myEnt:SetOwner(whatever the player is)
... I come back to this old thread and there's a pissing contest?
Anyway, I ended up just recreating everything in lua so I can OCD all over it:
![]()