You need to log in to create posts and topics.

Add a custom key/button

Fracture wrote:
scripts can be pakratted, right?

Sure :thumbup:

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]

LONG TIME NO SEE, and late as hell to get back to this thread for obvious reasons.

how does one employ a script in hammer??

I have never made or used scripts before, fyi

Just when I think I understand the system, it changes on me.

You write one, and save in the scripts/vscripts/ folder. It's written in Squirrel (.nut files). To use them, set the Entity Scripts field on an entity to a script file - then that script file will be run on the entity during spawn, letting you set functions and variables on it. You can then use the RunScriptCode input to run functions at other times.

The script API gives you functions to do things such as find entities in the map by classname/targetname, fire outputs on them, get/set things like their location, angles, name, model, etc. Additionally creating functions with certain names will permit them to be called when certain events happen (for example naming a function InputEnable will make it be called whenever the entity receives an Enable input).

My stuff:
[spoiler]- BEE2 Addons | (BEE2)
- Hammer Addons
Maps:
- Crushed Gel
- Gel is Not Always Helpful[/spoiler]
TeamSpen210 wrote:
(for example naming a function InputEnable will make it be called whenever the entity receives an Enable input)

Wait WHAT?!

Falsi sumus crusto!

okay so wrote a script for the first time, and it seemed to work as intended, however when i pakratted it and uploaded it to the workshop and tried it there AFTER deleting the script from the folder, it did abssolutely nothing

Just when I think I understand the system, it changes on me.
FelixGriffin wrote:
TeamSpen210 wrote:
(for example naming a function InputEnable will make it be called whenever the entity receives an Enable input)

Wait WHAT?!

It does indeed, although I think it might need to be Inputenable() (kinda a bug). In addition, the vars 'activator' and 'caller' in the local script scope are set to the relevant entities while the function is executing. I think that also happens for CallScriptFunction, I can't remember. You can also return False to cancel the event before it gets to the entity. The Alien Swarm SDK has the code for part of VScript in it, so you can read the code behind this stuff.

My stuff:
[spoiler]- BEE2 Addons | (BEE2)
- Hammer Addons
Maps:
- Crushed Gel
- Gel is Not Always Helpful[/spoiler]

That is a very useful feature! Especially since the "Use" input is so universal.

Falsi sumus crusto!
Thank you for visiting Thinking With Portals!
Fracture wrote:
okay so wrote a script for the first time, and it seemed to work as intended, however when i pakratted it and uploaded it to the workshop and tried it there AFTER deleting the script from the folder, it did abssolutely nothing

Usually, you need to edit the path for the script inside the BSP file to make it to work. Make sure that, after being packed, it is right inside the /scripts/vscripts folder (sometimes it's under a /dlc1 for example...)

TeamSpen210 wrote:
FelixGriffin wrote:
TeamSpen210 wrote:
(for example naming a function InputEnable will make it be called whenever the entity receives an Enable input)

Wait WHAT?!

It does indeed, although I think it might need to be Inputenable() (kinda a bug). In addition, the vars 'activator' and 'caller' in the local script scope are set to the relevant entities while the function is executing. I think that also happens for CallScriptFunction, I can't remember. You can also return False to cancel the event before it gets to the entity. The Alien Swarm SDK has the code for part of VScript in it, so you can read the code behind this stuff.

That is SO helpful indeed! (and truly weird!) :thumbup:

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]

still wondering why scripts wont pak over here

Just when I think I understand the system, it changes on me.

If you want, send the packratted map to me via a pm, I'll check the paths and stuff and see if there's any problem.

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]