Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
2 posts • Page 1 of 1
I posted in another section and was told I might find some help here. I am trying to create an item that when you wear it, it will give you a percent chance of paralyzing the enemy no matter what weapon you are wielding. I am unsure of how to cast the spell on the enemy when the player hits them. I was told that I could do a loop to test if the actor is the one that the player is hitting, but that seems like it would take quite a while to test all of the actors. It might be possible if we were to only test the actors in the current loaded cells. I don't know how to do something like that with my current skill though. Another idea is that we could use a small explosion spell right in front of the player when they swing their weapon. That also has some possible glitches, but it could work better performance wise. To do that though, I would need to know when the player swings their weapon. Does anyone know how to test for when the player tries to hit something? Thank you for your input, I am new to coding in openmw-cs.
I've encountered this issue too and for the time being there isn't a particularly good way to deal with this. You either end up putting a script on every single NPC, looping through every single NPC, or the last option which is hacky but at least somewhat viable. When a humanoid is attacked it will usually play a voice file (which are the same ones that play when you enter combat). You can edit the dialogue of these responses to start a script which checks if they have been attacked by the player on that frame, which you do by checking if any of the "hit" sounds are playing (health damage, light armor hit, medium armor hit, etc). If they are then you can apply your paralysis. Note that you will need the paralysis script to be the same one that is started by the dialogue, you can't have a script that finds out if they've been hit which calls "startscript paralysisscript" because the function currently starts the script on the first instance of an NPC, not the current one. This means if you're attacking guards only one of them will ever get paralyzed, and if you attack his friends he will get paralyzed.
Who is online
Users browsing this forum: No registered users and 4 guests