Jump to content

Scripting movement and actions


Recommended Posts

Hey, so I wasnt sure if scripting questions should go under modding assistance or, here, but here goes,

Im working on a handful of small scripts to automate some of the clunkier special moves in Jedi Academy. For example if you have dual or staff saber, crouching, then coming up out of the crouch forwards and hitting attack does a sort of "scythe" move with the lightsaber(s), which for the saber staff is one of the most effective attacks in the game against other Jedi. On a keyboard/mouse at least, this is always really awkward and annoying to do.

Anyways, I wanted to write a script that automated this, but I had a bit of trouble figuring out how to effectively emulate these keystrokes in a script. I checked the keybindings in the console with the bindlist command, and then wrote a script scythe.cfg with something like

+forward

in it and executed it. The player character simply walks forward constantly and wont stop. If I counter this with

+back

the player no longer walks forward, but pressing W or S no longer works for walking forward or backward, although I can shuffle left or right (I don’t know if the "walk forward" and "walk backward" commands simply are canceling each other out?)

Is there some way to write a script that causes the player to walk forward for a certain delay time (using wait for this, although its not a good option) then stop? Sort of like,

+forward
wait 300
+stop

Link to comment

I've quite possibly scripted the wrong move, since I don't think any of them resemble a scythe movement, but this one lets you do the crouch kata thingy while running... even on ramps.

 

/bind x "+speed; wait 4; +movedown; wait 4; +forward; +attack"

 

If you bind it and press the button, and all you do is crouch, you need to raise the wait time to something a bit higher.

BruceJohnJenner likes this
Link to comment

+forward is stopped by -forward.

Thanks, I just knew it was going to be something glib like that :)

 

Does the game input client itself use the +forward/-forward commands when listening to the states of the keys?

 

Keep in mind that wait is in frames and thus depends on your frame rate. As such you might want to limit it using com_maxfps to get reproducible results.

Is there any better alternative to using the wait command? Im tempted to write a delay.cfg file to call but I dont know if its possible to pass arguments with an exec command? (ie exec delay 5 for a delay of 5 seconds...)

 

My concern is that com_maxfps does deal with high framerates, but not low ones, dont know if theres any way of dealing with that.

Link to comment

Rough outline of what I was able to produce if anyones interested

 

+movedown
wait 20.0
+attack
wait 20.0
+forward
wait 120.0
-movedown
wait 300.0
-forward
wait 25.0
-attack

It does exactly what I wanted, although if you accidentally hold down the key it is bound to, the script keeps getting executed forever for some reason.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...