L4Dmaps
<a href="http://www.game-advertising-online.com/" rel="nofollow" target=_blank>Game Advertising Online</a><br> banner requires iframes
CS:GO Maps and Mods
[Solved] Vscripts in-game issue. created by Kantham
This thread contains 13 posts
1, 2

(34)
PostPosted: June 24th, 2012, 12:24 pm 
User avatar
In the current campaign I am making, I want the special infected spawn rate to be increased along with a tank spawn probability reduction.

What is the best way to go on around with this? All I can find is vscripts actions triggered from in-game via a trigger brush entity which triggers the info_director and yaddy yadda.

I've tried Vscripts, it just doesn't work. At all. I read some of the very few step-by-steps to go on about this without any luck; I keep getting "script (scriptname) not found".

Is this even legit? Does it even work - has anyone ever had it working in the L4D 2 mapping history? I tried placing the stupid .nut file everywhere; in the direct folders (scripts/vscripts) and inside the campaign VPK. It never worked.

Anyway here's the script for this:

Code:
DirectorOptions <-
{
BoomerLimit = 4
ChargerLimit = 4
SmokerLimit = 4
SpitterLimit = 4
JockeyLimit = 4
HunterLimit = 4

MaxSpecials = 20
SpecialRespawnInterval = 5

ProhibitBosses = true
}


These values are for testing purposes, but yeah, tanks/witches still spawns, and there's nothing new to report.

-Signed, someone who's about to go f'in .nuts.

Thank you very much.


 

(262)
PostPosted: June 24th, 2012, 3:39 pm 
User avatar
Moderator
Are you using an "logic_auto" to trigger the "info_director" and fire the script?

Here's an example from c5m1_waterfront:
Code:
entity
{
   "id" "2158"
   "classname" "logic_auto"
   "spawnflags" "1"
   connections
   {
      "OnMapSpawn" "director,BeginScript,c5m1_nothreat,0,-1"
   }
   "origin" "716 580 -448"
   editor
   {
      "color" "220 30 220"
      "visgroupshown" "1"
      "visgroupautoshown" "1"
      "logicalpos" "[4000 14500]"
   }
}

What this is doing, is when the map spawns (is loaded) the director gets called to begin a script. Make sure the "info_director" is named "director", and your VScript .nut file(s) are in the vscripts folder.

It should work for you, but if it doesn't, let me know.

_________________
Image
Image
Image


 

(34)
PostPosted: June 24th, 2012, 4:26 pm 
User avatar
Thanks for the reply,

But no. I noticed my info_director was named "Director" with a capital 'D', I changed it to a lowercase 'd', and specifically put that logic_auto and linked it properly with the info_director. When I go in-game, I can see in the console, it clearly states "script (scriptname) not found". I hexa-checked again, it's clearly in the right folder pattern: left4dead2/scripts/vscripts/.


 

(262)
PostPosted: June 24th, 2012, 7:44 pm 
User avatar
Moderator
Kantham wrote:
Thanks for the reply,
But no. I noticed my info_director was named "Director" with a capital 'D', I changed it to a lowercase 'd', and specifically put that logic_auto and linked it properly with the info_director. When I go in-game, I can see in the console, it clearly states "script (scriptname) not found". I hexa-checked again, it's clearly in the right folder pattern: left4dead2/scripts/vscripts/.

Hmm I see. Can you upload the actual .nut file you're trying to use? And perhaps PM me the map you're testing it on as well? Don't worry, I don't redistribute or steal anything when I look at other people's files. I give you my word on that. I just want to see if there's anything I can do to resolve this issue for you.

_________________
Image
Image
Image


 

(34)
PostPosted: June 25th, 2012, 8:09 am 
User avatar
Hey,

It was the file extension. Even though I saved it to .nut, the thing kept putting a "hidden" .txt at the end, making the extention look like .nut.txt no matter what I did to it. Now it finally works, I have one last question..

I am a little familiar with generic scripting, what I want to do however is probably going to require 1 week of compiling and wasted time effort. So I was thinking I could put what I have in mind and someone would re-format it to working script language?


Code:
TankProbability = randomint(1-100)

if (TankProbability > 20)
{
TankLimit = 0
}


I know I am pretty close to how it should look, I am just not sure how I need to do it.

Thanks.


 

(444)
PostPosted: June 25th, 2012, 7:36 pm 
User avatar
Moderator
Welcome to the forum :) Here is one link that explains the squirrel language, and another link that explains Valve's port of the VM.

First, you're going to end up using the following function:
Code:
int RandomInt(int nLowerLimit, int nUpperLimit)

I'm not sure what you are trying to do with the if statement. You can set the bounds from 0,20 and do a bitwise shift, and compare that value with a flag you set to check whether or not you want a tank to spawn.

Quote:
In the current campaign I am making, I want the special infected spawn rate to be increased along with a tank spawn probability reduction.

Because the two probability functions are linear, you can just do 1-x to get your fractional spawn rate. For example, local someValue = RandomInt(0,20) and using that with the expression (100 - someVal)/100 would equal your special infected spawn rate as a fraction of 1. You can possibly scale that fraction and use them with infected limits and respawn intervals.

If you wanted to change the director options when a tank is in play, you can possibly use IsTankInPlay() and make necessary changes.

Quote:
1 week of compiling and wasted time effort

Time spent on the coding side is never wasted ;) I know the above may not be of much use to you, but what you are asking to do can be achieved in many ways (if I understood your request).

_________________
My Mods/Tools: HammerCode | L4D2 Sound Mod Creator
Games I am involved with:Mutation:Source
I say "no" instead of "yes" to those that say "pls" instead of "please" because it's faster to type.


 

(34)
PostPosted: June 26th, 2012, 1:30 pm 
User avatar
Hello,

Thanks for the reply. I wish not to learn much about Squirrel, I'd rather stick with Java and other authentic programming languages. With that said, it is only if I really was in a spot where I felt the necessity of learning such language, which I am not; the director options are all listed in one of the links you posted and they fully accomplish what I was wanting to do as far as it goes with Special Infected control.

Back to my question/request:

All I want to do is have a tank spawn restriction based on a probability. I already know "TankLimit = 0" means there will be no tank(s). With that said, I'd have another variable which would have a generated Integer in it ranging from 1 to 100. In other words, a percentage; probability. This variable would be named 'TankProbability' and if the generated integer to it is higher than a specific number, the following will be read in the script:

TankLimit = 0

I hope this is clearer now. Thank you.


 

(444)
PostPosted: June 27th, 2012, 6:27 pm 
User avatar
Moderator
Code:
TanksToSpawn <- 1;

if (RandomInt(0, 100) > 20)
     TanksToSpawn = 0;

DirectorOptions <-
{
     TankLimit = TanksToSpawn
}

_________________
My Mods/Tools: HammerCode | L4D2 Sound Mod Creator
Games I am involved with:Mutation:Source
I say "no" instead of "yes" to those that say "pls" instead of "please" because it's faster to type.


 

(34)
PostPosted: June 27th, 2012, 6:37 pm 
User avatar
Ahh, straight to the point.

Thank you very much, I'll make sure to credit you (also Rayman1103) in my campaign once I release it.


 

(444)
PostPosted: June 27th, 2012, 6:45 pm 
User avatar
Moderator
I haven't tested that script yet, so let me know if there are any compiler errors.

Don't worry about the credits.

_________________
My Mods/Tools: HammerCode | L4D2 Sound Mod Creator
Games I am involved with:Mutation:Source
I say "no" instead of "yes" to those that say "pls" instead of "please" because it's faster to type.


 
 
1, 2