Topic: Script Help

I'm trying to get this grenade script to work in COOP but the behavior is strange. Basically what I'm trying to do is let my teammates know I'm priming the grenade with a team vsay command like "Clear the path!" and then execute another vsay like "Fire in the hole" when I release the grenade.

I'm using Outcasts example but it's not working properly. It forces me to press attack again to release the grenade and I also have to toggle between the attack1.cfg and attack2.cfg for it to work at all again. Any script gurus out there?

Prime Grenade Script

-------------------------------------------------------------
Warn teammates about incoming grenades;

press key to switch to grenade and vsay_team ClearPath
release key to throw grenade and vsay_team FireintheHole
-------------------------------------------------------------
adjust binds like below,

bind x "weaponbank 1; exec attack1.cfg"
bind x "weaponbank 2; exec attack1.cfg"
bind x "weaponbank 3; exec attack1.cfg"
bind x "weaponbank 4; exec attack2.cfg"
bind x "weaponbank 5; exec attack1.cfg"
bind x "weaponbank 6; exec attack1.cfg"

-------------------------------------------------------------

Now create 2 extra .cfg files;

1= attack1.cfg, with:
--------------------------------------------------------------
bind mouse1 "+attack"

--------------------------------------------------------------

2= attack2.cfg, with:
--------------------------------------------------------------
bind mouse1 "+button4; vstr cgren; -button4"
set cgren "vstr cgren1"
set cgren1 "vsay_team ClearPath; +attack; set cgren vstr cgren2"
set cgren2 "vsay_team FireInTheHole; -attack; -attack; exec attack1; set cgren vstr cgren1"

--------------------------------------------------------------

RTCW
will
NEVER
die!

2 (edited by nate 2014-08-14 09:51:39)

Re: Script Help

You'll have to use wait and single command otherwise you'll have to toggle it.  In pseudo something like:

bind X "vsay fireinthehole; weaponbank 4; +attack; wait 250; say_team fire in the hole!; wait 1000; -attack; weaponbank 3"

Explanation (May need some fine tuning): 
use vsay / switch to nade / prime the nade so it starts ticking / wait approx. 1/4 of a Second / print in team chat a print.. / wait approx. 1 sec / drop the nade / switch back to SMG


Key is to unload any persistent settings. Commands that start with + (like +salute) are meant to be toggle'ables, meaning they work until you hold the button and then call - prefixed command when you release the key to stop doing whatever it is doing. If you type or add in multi line bind + prefixed command it will be like you keep holding that button so make sure you always 'unload' it with - command... etc +attack; -attack.

Re: Script Help

nate wrote:

You'll have to use wait and single command otherwise you'll have to toggle it.  In pseudo something like:

bind X "vsay fireinthehole; weaponbank 4; +attack; wait 250; say_team fire in the hole!; wait 1000; -attack; weaponbank 3"

Explanation (May need some fine tuning): 
use vsay / switch to nade / prime the nade so it starts ticking / wait approx. 1/4 of a Second / print in team chat a print.. / wait approx. 1 sec / drop the nade / switch back to SMG


Key is to unload any persistent settings. Commands that start with + (like +salute) are meant to be toggle'ables, meaning they work until you hold the button and then call - prefixed command when you release the key to stop doing whatever it is doing. If you type or add in multi line bind + prefixed command it will be like you keep holding that button so make sure you always 'unload' it with - command... etc +attack; -attack.

Hi nate

Thanks for the response and the information. Very helpful to learn from.

About the "wait" command. Somebody told me this is probably the last thing I want to use because it depends on my FPS and is very unreliable. Is that true?

I tried it with different values but I am not able to move, shoot or whatever while the wait command is being executed.

Does the +button4 command do anything? It's recognized but does not seem have any effect.

I might just have to move on but I hate to throw in the towel on something that seems within my reach!

I understand this COOP and not MP so I really can't expect certain things to work but if you could make the script that I shared work, that would be a dream come true!! big_smile

BTW, loving the mod!

RTCW
will
NEVER
die!

4 (edited by nate 2014-09-05 12:36:13)

Re: Script Help

This is the only single line way I can think of atm:

bind space "weaponbank 6; vsay_team clearpath; +attack; wait 200; vsay_team fireinthehole; -attack; weaponbank 3; 

Brief explanation;
- weaponbank 6; Switches to grenades. Not sure if it's nazi nade only but time will tell.
- vsay_team ... ; Fires a voice message
- Primes the nade
- Holds the nade
- Drops the nade
- vsay_team ... ; Fires a voice message
- weaponbank 3; Switches back to SMG

Side effects
a) During wait you're locked for brief time
b) If there's no nade, it will fire a short burst with what weapon you have..

Optional to fix b bug:

bind space "vsay_team clearpath; +attack; wait 200; vsay_team fireinthehole; -attack; 

Brief explanation:
Same thing as above but doesn't switch to nade or back to SMG but assumes you switched to grenades manually..if you do it while holding a weapon it will again do a short burst..

EDIT;
I added +vstr so with next release you'll be able to use toggable actions -> one action while holding a button & another when you release it.

That's it so far.