Faceshifter Posted June 4, 2011 Author Share Posted June 4, 2011 This is so freaking awesome! Just what I wanted! Thank you and kudos to you!I was just thinking, it would be even more perfect if you could activate the knocked out character, and be presented with th options: Kill him, Pickpocket him or leave him alone.But then you'll have to run a script on everyone in Tamriel with begin OnActivate. At least, that is to my knowledge. I have no knowledge whatsoever about OBSE. You should release this as a mod, it is more realistic, I always hated it when people just punched eachother to death in a bar brawl. :biggrin: Link to comment Share on other sites More sharing options...
fg109 Posted June 4, 2011 Share Posted June 4, 2011 You should release this as a mod, it is more realistic, I always hated it when people just punched eachother to death in a bar brawl. :biggrin: I thought you only wanted the player to be unable to punch someone to death. If you want it to apply to everyone, this script is not going to be enough. Link to comment Share on other sites More sharing options...
Faceshifter Posted June 4, 2011 Author Share Posted June 4, 2011 You're right, didn't think of that. Well, I'll just modify it for everyone who should have it. Link to comment Share on other sites More sharing options...
fg109 Posted June 4, 2011 Share Posted June 4, 2011 (edited) Just spent a whole hour writing this. I'm not sure if it'll work but it does compile: scriptname examplequestscript array_var Targets array_var UnarmedNPC array_var NPCTargets array_var temparray float fquestdelaytime ref tempref ref tempref2 short control_var short tempshort short tempshort2 Begin GameMode ;Initialize the arrays and set the script to run once a second... didn't want it too fast with so many nested loops in the script if (fquestdelaytime != 1) let fquestdelaytime := 1 let Targets := ar_Construct Array let UnarmedNPC := ar_Construct Array let NPCTargets := ar_Construct Array endif ;When the player is unarmed, sets combat target to essential if it wasn't already and add to array "Targets" ;Had to use nested if conditions because for some reason it didn't work properly when it was all on one line if (Player.IsInCombat == 1) if (Player.GetEquippedObject 16 == 0) let tempref := GetCrossHairRef if (tempref.IsActor == 1) if (tempref.IsEssential == 0) tempref.SetRefEssential 1 ar_Append Targets tempref let control_var := 1 endif endif ;When the player is still in combat but now armed, sets all actors in array "Targets" back to being non-essential elseif (control_var == 1) let control_var := 0 while (tempshort < ar_Size Targets) let tempref := Targets[tempshort] tempref.SetRefEssential 0 let tempshort := (tempshort + 1) loop let tempshort := 0 endif ;When the player is not in combat, sets all actors in array "Targets" back to being non-essential elseif (control_var == 1) let control_var := 0 while (tempshort < ar_Size Targets) let tempref := Targets[tempshort] tempref.SetRefEssential 0 let tempshort := (tempshort + 1) loop let tempshort := 0 endif ;When the player enters a new cell, clears the arrays "UnarmedNPC" and "NPCTargets" ;All actors in all the nested arrays of "NPCTargets" are set back to being non-essential if (GetCellChanged) ar_Erase UnarmedNPC while (tempshort < ar_Size NPCTargets) ForEach (temparray <- NPCTargets[tempshort]) let tempref := temparray["value"] tempref.SetRefEssential 0 loop let tempshort := (tempshort + 1) loop let tempshort := 0 ar_Erase NPCTargets endif ;Scans the player's current cell for actors let tempref2 := GetFirstRef 69 while (tempref2) let tempshort2 := ar_Find tempref2 UnarmedNPC if (tempref2.IsInCombat) if (tempref2.GetEquippedObject 16 == 0) ;If an actor is in combat while unarmed, and not already in the array "UnarmedNPC", creates a new entry for him/her/it if (tempshort2 < 0) ar_Append UnarmedNPC tempref2 let tempshort2 := ar_Size UnarmedNPC let NPCTargets[tempshort2] := ar_Construct Array endif let tempref := tempref2.GetCombatTarget ;If the unarmed actor's combat target is not essential, changes the target to essential and adds it to a nested array of "NPCTargets" ;"UnarmedNPC" and "NPCTargets" are symmetrical arrays if (tempref != Player && tempref.IsEssential == 0) tempref.SetRefEssential 1 ar_Append NPCTargets[tempshort2] tempref endif ;If an actor was previously in combat unarmed, but now in combat armed, deletes the relevant entries from arrays "UnarmedNPC" and "NPCTargets" ;Also changes all targets in the relevant nested array of "NPCTargets" back to non-essential elseif (tempshort2 >= 0) ForEach (temparray <- NPCTargets[tempshort2]) let tempref := temparray["value"] tempref.SetRefEssential 0 loop ar_Erase UnarmedNPC tempshort2 ar_Erase NPCTargets tempshort2 endif ;If an actor was previously in combat unarmed, but now not in combat, deletes the relevant entries from arrays "UnarmedNPC" and "NPCTargets" ;Also changes all targets in the relevant nested array of "NPCTargets" back to non-essential elseif (tempshort2 >= 0) ForEach (temparray <- NPCTargets[tempshort2]) let tempref := temparray["value"] tempref.SetRefEssential 0 loop ar_Erase UnarmedNPC tempshort2 ar_Erase NPCTargets tempshort2 endif let tempref2 := GetNextRef loop End For the kill/loot unconscious actors, you can use these two scripts. But I really wouldn't recommend it because it involves changing their scripts. scriptname knockoutscript ref npcref short choice short loot short menu short tempshort Begin OnActivate set menu to 1 set npcref to GetSelf MessageBox " " "Kill" "Loot" "Cancel" End Begin GameMode if (loot == 1) if tempshort == 3 AddItem Torch02 1 EquipItem Torch02 RemoveItem Torch02 1 let tempshort := 0 ToggleActorsAI set loot to 0 elseif (tempshort == 2 && MenuMode == 0) PlaySound UIInventoryClose InvChestRef.RemoveAllItems npcref let tempshort := 3 elseif tempshort == 1 ToggleActorsAI RemoveAllItems InvChestRef InvChestRef.Activate Player let tempshort := 2 elseif tempshort == 0 ToggleActorsAI InvChestRef.MoveTo Player 0 0 -50 InvChestRef.SetOwnership let tempshort := 1 endif Return endif if (menu == 0) Return endif set choice to GetButtonPressed if (choice == 0) set menu to 0 npcref.SetRefEssential 0 npcref.Kill Return elseif (choice == 1) set menu to 0 set loot to 1 Return elseif (choice == 2) set menu to 0 Return endif End scriptname examplequestscript2 array_var Scripts array_var Unconscious float fquestdelaytime ref scriptref ref tempref1 ref tempref2 short tempshort Begin GameMode if (fquestdelaytime != 1) let fquestdelaytime := 1 let Scripts := ar_Construct Array let Unconscious := ar_Construct Array let scriptref := knockoutscript endif let tempref1 := GetFirstRef 69 while (tempref1) let tempshort := ar_Find tempref1 Unconscious if (tempref1.GetKnockedState == 1) if (tempshort < 0) ar_Append Unconscious tempref1 let tempref2 := tempref1.RemoveScript ar_Append Scripts tempref2 tempref2.SetScript scriptref endif elseif (tempshort >= 0) tempref1.RemoveScript let tempref2 := Scripts[tempshort] tempref1.SetScript tempref2 ar_Erase Unconscious tempshort ar_Erase Scripts tempshort endif let tempref1 := GetNextRef loop End You'd also need to create an empty container with the refID "InvChestRef". And that part of the script was a total copy/paste of the CM partners script. Edited June 4, 2011 by fg109 Link to comment Share on other sites More sharing options...
Faceshifter Posted June 4, 2011 Author Share Posted June 4, 2011 (edited) Wow, I'm going to try it. You really made your work of it! o_O The second loot script is a questscript, then I wouldn't have to alter the NPCs' script, right?I'm going to try them all though , see you in a sec :DOh I see now, I'll need them both Edited June 4, 2011 by Faceshifter Link to comment Share on other sites More sharing options...
Faceshifter Posted June 4, 2011 Author Share Posted June 4, 2011 The script isn't exactly working:People without the knockout script will go unconscious just fine, but when multiple people join, they all will become permanently essential. (The pain I endured from five essential guards, argh)People with the knockout script, will go unconscious once, and die when punched to "death" again. When activated, regardless of combat, death or other situations, they will yield the Kill/Loot/Cancel box.The Kill option only works when the NPC is not unconscious, only when up and running, you can activate the NPC and kill it.The Loot option halted the whole process, an unconscious NPC Looted will unequip everything, regardless of what you take from his/her corpse, and will not awake anymore. Instead it freezes in location, and blocks the path. :confused: I had another idea, people will stay on the ground when their fatigue is below zero. Maybe a spell can be added when on low health, with drain fatigue a billion. This will not stop other NPCs from killing the NPC, and you'll still be able to punch him dead. But the loot thing will work, though ... Link to comment Share on other sites More sharing options...
fg109 Posted June 4, 2011 Share Posted June 4, 2011 Wow, that sounds like a huge mess. Honestly, this is too much for me to try and troubleshoot. I think you should just go back to using the other one and be satisfied with it only affecting the player. Link to comment Share on other sites More sharing options...
Faceshifter Posted June 4, 2011 Author Share Posted June 4, 2011 Yes that's probably a better idea. Thank you very much with the script, I cannot express my appreciation. Link to comment Share on other sites More sharing options...
Recommended Posts