Skip to content

Feature: Port/Recreate AddThinkToEnt() from Left 4 Dead 2 VScript #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Pacca64 opened this issue Dec 19, 2024 · 0 comments
Open

Feature: Port/Recreate AddThinkToEnt() from Left 4 Dead 2 VScript #1778

Pacca64 opened this issue Dec 19, 2024 · 0 comments
Labels
Type: Enhancement Improving an existing feature

Comments

@Pacca64
Copy link

Pacca64 commented Dec 19, 2024

Which component should be improved?

Entity

Describe your suggestion

As it currently stands, there's no clear way to apply a vscript think function to an entity beyond spawning it with one hammer; if VScript code wants to reuse entity scripts designed for hammer with think functions, it seems impossible to create a new entity with that script that will actually call the think function on its' own as expected.

Even creating the entity with a function like CreateEntityByName() with the thinkfunction keyvalue set doesn't cause the given think function to be called. It can be worked around by using entity I/O with a logic_timer or the entity script itself to send CallScriptFunction inputs at the times you want the think function to run, but this is messy, spams the console when using developer 2 to debug I/O, and I imagine is just inefficient compared to think functions.

Furthermore, if you want to disable the think function of an already existing thinking entity, or make it swap to a different think function on the fly, that seems impossible at the moment; the only way is to account for it in the entity vscript code with conditional statements in the only usable think function, but this is less efficient (since they have to be checked every time the entity thinks) then it could've been if the think function could be reassigned or disabled.

Left 4 Dead 2s' VScript apparently had a solution to this; AddThinkToEnt(Handle=TargetEntity,String=NameOfThinkFunction), a global function that sets or overrides an entities think function, allowing the think function to be changed, disabled (by passing null instead of the name of a think function), or even applied in game to entities, even ones that can't be spawned by hammer, like players.

This would make entity vscripts far more flexible and versatile, and I'd love to see it added :3

@Pacca64 Pacca64 added the Type: Enhancement Improving an existing feature label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improving an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant