You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
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
The text was updated successfully, but these errors were encountered: