Please or Register to create posts and topics.

Publishing a map with custom nut file (scripting)

Hi,

Today I successfully uploaded my first hammer-made map in my workshop.

However, since I added a custom script to a trigger box, this doesn't seem to be uploaded correctly.

My question is: What do I need to do, to include the nut file in the uploaded bsp file?

Some more details:

This is the file to be executed:

Code: Select all
printl("==== calling 1.nut");

GivePlayerPortalgun();

theDoor <- Entities.FindByName(null,"testdoor");
EntFire( theDoor.GetName(), "close" );

printl("script ok 2!!!");

The file is called 1.nut and resides in steamappscommonportal 2portal2scriptsvscripts

If you want to try it out, here's the link: http://steamcommunity.com/sharedfiles/f ... d=75054902

The script is called when you walk through the first door (the one with no walls nearby). This is done with a trigger_multiple with an output "OnStartTouch" via the input "RunScriptFile" and a parameter "1.nut". The script should close the door and give you half of the portal gun.

Now, this all works fine if I test it locally (via the "map" command in the console), even if I open it via the "community test chambers". But if I comment out all the lines in the script, it doesn't work anymore in the workshop (and of course it doesnt work locally any more, but that's to be expected).

So I assume that it can't work for anyone but me, because only I have this damned nut file.

... one hour later ...

Ok, I figured I have to run bspzip to include the file.
I did that:

Code: Select all
./bspzip.exe -addorupdatelist ../sdk_content/maps/test3.bsp  ../sdk_content/maps/test3_includes.txt ../sdk_content/maps/test3_public.bsp

I know it included the file, because I ran bspzip again on test3_public and now it said "updating" instead of "addind" (or something like that).

Then I uploaded test3_public.bsp via p2map_publish again, but it still behaves like I mentioned above.

Can anyone tell me how to fix that? If I open a file with the workshop, I want to play the version that was uploaded, not my local version!

Can you tell me if my map works for you (door closes after you run through it)?

Any help is much appreciated.

You do realise the whole point in scripts right? They are used for complex functions which would otherwise be impossible or very difficult using just entities inside the hammer editor.
If you just want to close a door and give a player a gun, that would be much simpler to just use outputs/inputs inside hammer.
You can execute server commands through a point_servercommand and player commands through a point_playercommand.

Scripting commands and functions can actually be run in hammer WITHOUT using a script. i.e. There is nothing in the 'EntityScripts' field in your logic_script or any other entity that can have the RunScriptCode input.
e.g. OnThisEvent -> nameOfInfo_target -> RunScriptCode -> GivePlayerPortalgun()

Global variables can also be defined WITHOUT scripts as long as they are not strings.
e.g. OnThisEvent -> nameOfInfo_target -> RunScriptCode -> ::GlobalVariable <- parm

?????????????????????????????TWP Releases | My Workshop
Quote:
You do realise the whole point in scripts right? They are used for complex functions which would otherwise be impossible or very difficult using just entities inside the hammer editor.

I am well aware of that. It's just a test map to help me understand how all this works.

I just used pakrat to pack a script to the .bsp and published it to the workshop. Works fine.

You can also test it by renaming your script while you play your own map in the workshop.

?????????????????????????????TWP Releases | My Workshop

Ok, I just figured it out 10 minutes ago.

I used the wrong filename.

I'll give pakrat a try. That seems a lot easier to use.

Thanks.