Jump to content
Sign in to follow this  
Hatchet_Harry

Eventhandler for throwing grenades

Recommended Posts

Hello there,

currently we are reworking some parts of the wastenland code. In the very first steps we rework some scripts, which are just historical copy&paste additions.

We have the following function on our server:

- If a player thows a yellow grenade, it is being threated as teargas grenade.

It works good but the code is our problems. It uses wierd performance costing loops, which should not be used.

We planned the feature from the scratch and we are missing a very basic eventhandler: throwing grenades

The plan is simple:

- If a player throws a grenade

- An event should be raised the event should deliver: What has been thrown? and The "landing" location?

- We could set a trigger to this position, which would start teargas scripts

Now the question: Is there any known function or handler which could to it?

I could use the fired handler, but it would include all shooting events on the server. This event could influence the performance too, because every shot would cause a check like "Was it a grenade?".

Do you have a really good integration for such an integration?

Would you need a throw whatever eventhandler too?

One additional idea: Is it possible to use the throw animation as handler (idea came up, while i wrote this post). Need to check it. -> Would cause to many checks too.

Thanks for your help / possible feature request like.

Hatch

Share this post


Link to post
Share on other sites

Yes, the fired EH is the only reasonable for the moment. But it would be triggered on every shot of the player.

From a performance perspective it is not completely perfect, but seems to be the only handler we can use at the moment.

I think i will script very short precompiled script for the checks.

The real code execution will follow in another one. Than we have a general make teargas and check for grenade throwing function which could be used for other crazy ideas too ^^

It will be a win in comparison to the current integration.

Thanks for the confirmation :)

Share this post


Link to post
Share on other sites

Well, like you said it would be fired every time anyhow, and if it isn't a grenade object it won't run any of that code, so I don't see a performance issue with that? Here is the issue with not knowing exactly how EH's are handled within the engine, but it is guaranteed that they will run, code or no code, so as long as you have a lot of code the "entry" condition should completely reflect whether or not the code should actually run.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×