map a key to overhead sword swing

Users who are viewing this thread

Would this be something complicated? I find the mouse easy for side-to-side, but I'd love to just hit a key and use this as a 'finishing move' which is a bit sloppy with the mouse since it changes your camera as well.

Anyway, are there examples of changing combat stuff to a key? I'll poke around the scripts but it's easier when the smart people have beaten down a path. :wink:
 
for an example of linking stuff to a key, look at the formation kit, it's somewhere on this page or the next one 'battlefield formations'

the thing is, I can think of how to link an animation to a key, but I'm not sure if the game would interpret that as an actual attack.

Come to think of it, try having a look at the shield bash kit. That uses both attack buttons to trigger the left hand attack, that's basically the same thing you're trying to do.

It's in this thread.

you'll have to include the tests for weapon type the way Mirathei has implemented it and then you'll have to figure out which animation to use and such.

Not a one hour job but also not impossible...
 
taking a quick look at the shield bash code, you will need to use the operation:

agent_set_animation

Look it up in module_operations.py for the syntax usage.  A piece of the shield bash code:

    (agent_set_animation, ":agent", "anim_release_bash"),

pretty straight forward for making a swing, you just need to find the name of the animation.  The hard part is testing when you can do it.  if you want to assign it to a key, the trigger would be something like:

(0, 0, 0,[(key_clicked, key_enter)],  ## show the string
[(call_script,"script_show_text_string"),]

Of course you may want a different key, and the operations block would be a bit more complex... :wink:
 
I just want to do it to the 'r' key for example. so it's (key_clicked, key_r) I guess, now

I found 3 things with overhead animation swing so I'll put them all to it.

ready_overswing_twohanded
release_overswing_twohanded
parry_overswing_twohanded

overswing_onehanded
release_overswing_onehanded
parry_overswing_onehanded

ready_overswing_staff
release_overswing_staff
parry_overswing_staff

but I wonder, should I just use release or is ready important, I don't think parry matters for this


as far as editing the shield code, it's a bit overly complicated for what I'm doing so it might take awhile for me to sort away all the stuff I don't want.

don't want AI using it, don't need variety of types of hit, don't want it neq against calvalry, but I do need to figure out what to do for damage, how to make it the sword's normal damage code or similar.

plus I need to dig up all the items for this part but that's the easiest part (try_for_range,":shield","itm_wooden_shield","itm_heraldic_mail_with_surcoat"),
              (agent_has_item_equipped,":agent",":shield"),









 
It depends on how you want the r key to work.  Is the player holding down the key until he's ready to release the attack?  There are checks for key down and up.  Or you could do a kep press and then do the ready and release one after the other.  You may have to do some timing work for that.  As to when to use which swing, you will have to test for that.  It would be funny seeing a guy with a knife use the 2 handed swing...  :lol:
 
The best you can hope to do is write a full script that mimics an attack, but you can never write a script that forces an attack.  It's one of the limitations of the module system.  So you can write something that causes the animation when the key is pressed, but then you also have to write in all the code that calculates and delivers the damage as well as ranging, readiness, etc.

I hope someone proves me wrong on this, but I don't think I am.
 
Jinnai said:
The best you can hope to do is write a full script that mimics an attack, but you can never write a script that forces an attack.  It's one of the limitations of the module system.  So you can write something that causes the animation when the key is pressed, but then you also have to write in all the code that calculates and delivers the damage as well as ranging, readiness, etc.

I hope someone proves me wrong on this, but I don't think I am.

You've seen the code for the shield bash haven't you?  Looks like you do need all that.  I would really start there for something like this.
 
Back
Top Bottom