Binding buttons to script commands?
Moderator: Moderators
-
Master-Of-Fungus-Foo-D
- Muffin Man
- Posts: 1544
- Joined: Tue Jan 27, 2004 12:33 am
- Location: cali, United States
Binding buttons to script commands?
How would i bind buttons to script commands.... not using a cvar but, for example, if the player is in a trigger i want him to be able to push a button like 'b' and the script would execute a thread like shooting a nearby cannon...
any help?
any help?
You can't not exactly you can use fireheld or useheld for example for a trigger you can do this
main:
$mytrigger thread check_player
end
check_player:
while(1)
{
self waittill trigger
local.player = parm.other
if(local.player.useheld == 1)// or while(local.player.useheld == 1)
{
do stuff here
}
waitframe
}
end
you can do the same thing useing fireheld . There is a flakfire script at my site if you want to look at how that one was done .
main:
$mytrigger thread check_player
end
check_player:
while(1)
{
self waittill trigger
local.player = parm.other
if(local.player.useheld == 1)// or while(local.player.useheld == 1)
{
do stuff here
}
waitframe
}
end
you can do the same thing useing fireheld . There is a flakfire script at my site if you want to look at how that one was done .
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
All the input you can get from a player is the movement - forward/backward/strafing/jumping/crouching etc. (via state files),
fire ($player.fireheld by script or specifically primary and secondary attack via state files), reloading (via state files) and useheld. These apply for both MP & SP. In SP you can also pass commands via cvars - for more info look into Lizard's squad command script (I suggested this solution
).
fire ($player.fireheld by script or specifically primary and secondary attack via state files), reloading (via state files) and useheld. These apply for both MP & SP. In SP you can also pass commands via cvars - for more info look into Lizard's squad command script (I suggested this solution
-
Master-Of-Fungus-Foo-D
- Muffin Man
- Posts: 1544
- Joined: Tue Jan 27, 2004 12:33 am
- Location: cali, United States
keys
Master-Of-Fungus-Foo-D - The players can set up their keys as they wish, so you can't use B or M because they may have already set them to some other function. Instead, you just flash a message on the screen that tells them to press, or hold, their "Use" key to fire the gun.
If you want to have a lot of gun buttons, have a look at my Test_Pointer tutorial map.
If you want to have a lot of gun buttons, have a look at my Test_Pointer tutorial map.
-
Master-Of-Fungus-Foo-D
- Muffin Man
- Posts: 1544
- Joined: Tue Jan 27, 2004 12:33 am
- Location: cali, United States
not possible, my design was to have a bunch of different commands, like regroup, move there, fire there, follow me, etc. i couldn't have done it with a trigger use.Elgan wrote:lizardkid wrote:yes actually there is, i used cvars in my squad script (yay! i got referenced!), making binds to them in a custom.cfg (such as bind END setcvar mycvar "MUAHAHA!") and checking the cvars with a while loop.
Why not just use a trigger use?
at the very least, it was simplest to make five command buttons.
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
Re: Binding buttons to script commands?
i didn't see anything here that said MP...Master-Of-Fungus-Foo-D wrote:How would i bind buttons to script commands.... not using a cvar but, for example, if the player is in a trigger i want him to be able to push a button like 'b' and the script would execute a thread like shooting a nearby cannon...
any help?
but if it is probably best to go with useheld or fireheld.
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
-
Master-Of-Fungus-Foo-D
- Muffin Man
- Posts: 1544
- Joined: Tue Jan 27, 2004 12:33 am
- Location: cali, United States
When I wrote that scirpt originally I use a trigger_multiple that when triggered checked to see if the player was useing his fire key and if so fire the flak . I later changed it to the use key . Had I started out doing it for the use key I would have spawned a trigger_use in the script instead that ran the thread to fire the flak . It is only a small script easy to change to your likeing or use in a different mod . If this is for a single player map you can just make a trigger_use even a menu would work to set a cvar but the server can't read cvars on the client so that won't work for MP .
-
Master-Of-Fungus-Foo-D
- Muffin Man
- Posts: 1544
- Joined: Tue Jan 27, 2004 12:33 am
- Location: cali, United States




