[Suggestions] EntWatch Improvements

This is a discussion for the topic [Suggestions] EntWatch Improvements on the board SourceMod プラグイン (SourceMod Plugins).

Author Topic: [Suggestions] EntWatch Improvements  (Read 285 times)

0 Members and 1 Guest are viewing this topic.

Zero

  • Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
  • Gender: Male
on: September 01, 2018, 05:50:21 PM
After messing around with vscripts, entities and sourcemod documentations, there's another room to improve entwatch.

1. Adding support for grabbing item configuration through map
Most of mappers usually need to create configuration file for EntWatch to hook their map special items.
Why not add a support where the EntWatch can hook the item in-game straight away? It can be done.

As a mapper, you just need to create an entity such as 'info_target' and give it a name that follows certain naming convention such as entwatch_(youritem1) and make your item button as it's parent.
After that, disable 'SmartEdit' in entity property and add custom keys and values. Those custom keys and values will follow the format of entwatch configuration file. And done.

Now, what the EntWatch should do would be searching for the entity that contains the name that follows the naming convention when the map is loaded or on new round. If the entity is found, grab the required keys and values. Validates the properties. Setup the usual item parameters. Then, grab it's parent entity and and register the entity id for usage control. Voila. Now EntWatch can directly grab item configuration itself from the map itself.

What's the advantage by doing this?
First, it would be giving mapper another method of adding the item configurations.
Second, which is the last one and the biggest advantage of all is that, by putting the item configurations directly inside the map, vscripts can also take advantage of it. Making this item configurations usable to vscripts and entwatch.

Updated:Now I'm not confident if the 'EntWatch' plugin can access an entity's custom key values. While I could create an entity with custom keyvalues using vscript, I couldn't read any entity's keyvalues with 'Vscript'. So, I'm not even sure if custom key values will be created when a map is spawn. Hence why. Someone need to test if custom key values will be created when the map spawns and SourceMod plugins can access it. If it's possible, a mapper can just create a vscript file to be used as item configuration and let item vscript to 'include' (load) the configuration script and then create an entity with custom keyvalues for SourceMod plugins to access. Else, bad luck.  :(

Updated: Shufen confirmes that plugins can read custom entity key values.


2. Overhead Item Countdown
Displaying item countdown on top of player's head.

In order to do this, you must first prepare textures to display the countdown. Then,create a function where it creates an 'env_sprite' on top of an item holder. Make the item holder as the parent. Then, you display the sprite. Done.

To animate the countdown, you need to kill the previous 'env_sprite' and create a new one which displays a new countdown number. Repeat it until the cooldown finish. You can't animate countdown using single 'env_sprite' due to its limitation.

That's all.
« Last Edit: September 03, 2018, 02:58:07 PM by Zero »


shufen

  • Administrator
  • Jr. Member
  • *****
  • Posts: 74
  • Karma: +9/-1
  • Gender: Male
  • 常に本気
Reply #1 on: September 03, 2018, 12:45:12 PM
In general plugins can read custom keys from entity via entity property.
I can modify entWatch depending on your changes.


Zero

  • Newbie
  • *
  • Posts: 23
  • Karma: +0/-0
  • Gender: Male
Reply #2 on: September 03, 2018, 03:42:06 PM
That would be great. You just need to make the function search for entity with classname of "info_target" and check if the entity's name starts with "entwatch_" or any other prefix few seconds after map spawn or on every new round (I couldn't confirm if entity created by vscripts would last until the map changed or until the end of round). Then grab the custom key values to be assigned to entWatch.

As for sprite textures, you might want to look for someone to create them. Either numbers or highlighted clock area for the images.

The truth is, I found better method for mappers to deal with item configurations. Instead of creating those entities using hammer editor (which is a tedious task), it's better to write item configurations inside script files and let another script file to automatically create those entities containing required properties for entWatch. It's pretty handy.

I'll probably show you the vscript example of how it's done, tonight or tomorrow.

Updated: Screenshots, scripts and example map without func button has been attached.
Read below and grab script file + see the screenshot.


Look at 'vscripts/item/item_script' on how the entity was create and compare it with the console screenshot.
Other mappers can try take a look at the 'vscripts/item/configuration/include.nut' , 'vscripts/item/configuration/template_item.nut' and 'vscripts/item/configuration/item_test1.nut'. It should be very similar to entwatch configuration file except there's no hammer id but targetname instead.

'blockpickup', 'allowtransfer', and 'forcedrop' to be honest, should be server sided configuration. Since it's more to monitoring server instead of a map effect.

As for hammer id, EntWatch can just scan through info_target entities and grab the entity with 'entwatch_ prefix' in the name, grab 'buttonname' value, scan entities with that value and do GetEntProp with the entity to grab the m_iHammerID.

Updated: Uploaded webpng screenshots.
And if there's any mappers here.. Here's the folder structure
1. vscripts/item/item_script.nut
2. vscripts/item/configuration/include.nut
3. vscripts/item/configuration/template_item.nut
4. vscripts/item/configuration/item_test1.nut
5. vscripts/item/configuration/item_test2.nut
« Last Edit: September 04, 2018, 11:51:25 AM by Zero »


 

TinyPortal © 2005-2015