Sometimes hostile orcs are having dinner when the hero walks in. The orcs naturally stand up, get out their axes, and kill the hero. Once done, the orcs go back to their dinner.
I've adapted Kaldor Silverwand's sitting scripts to account for combat. The npc records it's location and facing on first heartbeat (and sits). If it enters combat, it will behave normally, stand up, run around fighting etc. When combat ends it returns to it's original location, facing, and sits down again. This all happens via the heartbeat script, without need to place a post waypoint. It also means friendly npcs who are sitting and get bumped out of position or reoriented will assume their initial position/facing/action, so when you interrupt an npc who is eating to talk to them, they will turn to face you for the conversation and then resume their original facing and return to eating when you are done.
In this example video, the sitting elf is set to the defender faction and running my modified heartbeat (the rest are running a regular kaldor sit script, and are a neutral faction). I spawn a goblin and the elf gets up to attack the goblin. Once the fight it over, the elf goes and sits back down and resumes "eating".
www.youtube.com/watch
Once I get all six of his sit scripts modified and take care of a potential bug with the facing I will post an erf of the modified scripts.
Sitting enemies/better sitting
Débuté par
kamal_
, janv. 05 2013 05:53
#1
Posté 05 janvier 2013 - 05:53
#2
Posté 05 janvier 2013 - 09:06
Demo module
Dropbox
In the demo module the elf (named "drink", as that's the hb script he runs) is set to the defender faction. The other npc's are a neutral faction. The elf will put his bow away and equip a cup of some sort on first heartbeat, selected randomly from the three cup types provided by DannJ's Handy VFX Here. For whatever reason, elves are apparently left handed, and by default the script uses a right hand mug.
If you talk to the standing human, you can have him spawn a goblin, which will spawn 10 meters or so behind the line of chairs. As the goblin is hostile, it will try to kill you. Since the elf is in the defender faction, it will equip one of it's equipped weapons and attack the goblin (the elf is marked plot). After the first heartbeat of combat, the elf will remove the mug, so there will be a few seconds where the elf is holding the mug and a weapon.
If the elf moves as part of combat, once combat is over it will return to where it began, unequip it's weapon, and sit and begin playing animations. The elf will equip the same type cup it held initially when required by the random animations.
The elf also has a conversation, so you can see how the script handles orienting on dialog and then returning to default after conversation.
You can spawn more goblins via the standing human if you wish.
The behavior of the npc's is handled entirely via the hb script, so there's no need to put in waypoints, the npc automatically determines it's "post" on first heartbeat. If you are spawning the npcs instead of placing them, you may want to move the runonce section of the heartbeat (at the end of the hb) to the OnSpawn script for better performance of the heartbeat. If you don't have DannJ's vfx in your module/override, things play as stock.
These were based on Kaldor Silverwand's sitting scripts, I kept the script names so you can override if you want. Otherwise rename.
Dropbox
In the demo module the elf (named "drink", as that's the hb script he runs) is set to the defender faction. The other npc's are a neutral faction. The elf will put his bow away and equip a cup of some sort on first heartbeat, selected randomly from the three cup types provided by DannJ's Handy VFX Here. For whatever reason, elves are apparently left handed, and by default the script uses a right hand mug.
If you talk to the standing human, you can have him spawn a goblin, which will spawn 10 meters or so behind the line of chairs. As the goblin is hostile, it will try to kill you. Since the elf is in the defender faction, it will equip one of it's equipped weapons and attack the goblin (the elf is marked plot). After the first heartbeat of combat, the elf will remove the mug, so there will be a few seconds where the elf is holding the mug and a weapon.
If the elf moves as part of combat, once combat is over it will return to where it began, unequip it's weapon, and sit and begin playing animations. The elf will equip the same type cup it held initially when required by the random animations.
The elf also has a conversation, so you can see how the script handles orienting on dialog and then returning to default after conversation.
You can spawn more goblins via the standing human if you wish.
The behavior of the npc's is handled entirely via the hb script, so there's no need to put in waypoints, the npc automatically determines it's "post" on first heartbeat. If you are spawning the npcs instead of placing them, you may want to move the runonce section of the heartbeat (at the end of the hb) to the OnSpawn script for better performance of the heartbeat. If you don't have DannJ's vfx in your module/override, things play as stock.
These were based on Kaldor Silverwand's sitting scripts, I kept the script names so you can override if you want. Otherwise rename.
#3
Posté 06 janvier 2013 - 09:58
Nice work.
I usually just make weapons and shields invisible while people sit (via SetWeaponVisibility), rather than unequipping and re-equipping things. It makes the scripting a lot easier.
I've got sittable placeables in a module I'm currently working on, which the player can also use. I found that unequipping items could be dangerous if a character's inventory was completely full. I suppose that's not an issue if you only let NPCs sit though.
I usually just make weapons and shields invisible while people sit (via SetWeaponVisibility), rather than unequipping and re-equipping things. It makes the scripting a lot easier.
I've got sittable placeables in a module I'm currently working on, which the player can also use. I found that unequipping items could be dangerous if a character's inventory was completely full. I suppose that's not an issue if you only let NPCs sit though.
#4
Posté 18 février 2013 - 07:00
Hey Kamal, tried it but for some reason everyone wants to kill each other when I get into the area
Had a look through the coding though and looks very good. It even gave me a few ideas for how to tackle a few things I've been pondering over ... so thanks for the contribution!
#5
Posté 20 février 2013 - 03:56
NIce work. Though I don't think the original scripts are mine. I don't remember them and I usually put comments at the top of my scripts.
Regards
Regards
#6
Posté 20 février 2013 - 04:14
Hmm, I was sure I'd gotten the basic sitting script from Kings Festival/Queen's Harvest, and the original scripts are named b_stuff... and I'm aware your real life initials are BB (you link your personal site in your signature). The original base script just made the npc do a sit animation on heartbeat.Kaldor Silverwand wrote...
NIce work. Though I don't think the original scripts are mine. I don't remember them and I usually put comments at the top of my scripts.
Regards
#7
Posté 23 février 2013 - 12:28
Yes, if I recall correctly I think I got that sitting script from an OC area. It is used on Nasher in his throne room. I don't recall if I had to modify it or anything. Anyway, you've done far more with it than I'm sure I ever did.
#8
Posté 24 février 2013 - 01:36
How cool!
I plan on designing a really involved bar scene into my "Ancient Memories" module, and this will surely increase the depth of the plot line.
Thanks kamal_
I plan on designing a really involved bar scene into my "Ancient Memories" module, and this will surely increase the depth of the plot line.
Thanks kamal_
#9
Posté 27 février 2013 - 06:44
hey kamal_
any chance of a read me?
nvm - (askin a bit much considering you did all the work already)
:innocent:
nvm - (askin a bit much considering you did all the work already)
:innocent:
Modifié par Morbane, 27 février 2013 - 08:12 .
#10
Posté 30 septembre 2013 - 07:50
I usually just make weapons and shields invisible while people sit (via SetWeaponVisibility), rather than unequipping and re-equipping things. It makes the scripting a lot easier.
Hello,
DannJ, how do you actually manage to make SetWeaponVisibility work?
I am trying to hide a dart for a duration of time while the character is casting an instant spell feat, but it isn't working for me, even though the function is returning true. If I use the unequip on the same object in the same scope, it works.
I'm doing something like this:
object oWeapon;oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, OBJECT_SELF);SetWeaponVisibility( oWeapon, 0, 0 );
#11
Posté 30 septembre 2013 - 10:51
SetWeaponVisibility() targets the creature holding the weapons, not the weapons themselves.
#12
Posté 30 septembre 2013 - 11:42
DannJ, thanks a lot for that!
I think the name of the function together with its comments led me to think it would apply on a weapon...
SetWeaponVisibility
// Returns TRUE if it found an object to set weapon visibilty on
// oObject is the object to set weapon visibility on
Thanks again!
I think the name of the function together with its comments led me to think it would apply on a weapon...
SetWeaponVisibility
// Returns TRUE if it found an object to set weapon visibilty on
// oObject is the object to set weapon visibility on
Thanks again!
#13
Posté 01 octobre 2013 - 12:16
Yes, the function description is a bit vague.
#14
Posté 03 novembre 2013 - 01:56
there doesnt seem to be a sh_onspawn_sitdown.nss in there?
is it integral or happenstance?
is it integral or happenstance?





Retour en haut







