Faceshifter Posted June 3, 2011 Share Posted June 3, 2011 Sadly, I have little to no idea whatsoever how to do this. I have an idea, which needs a lot of polishing: Scn SomeName Begin OnStartCombat SetEssential TargetRef 1 End Begin OnKnockout [some Restore Health] SetEssential TargetRef 0 End You get the idea. But my main concern is that it has to happen only when you are fighting barehanded.Anyone has an idea? It can have nothing to do with my current script. Greetz,Face Link to comment Share on other sites More sharing options...
fg109 Posted June 3, 2011 Share Posted June 3, 2011 (edited) Try this: scriptname examplequestscript array_var Targets float fquestdelaytime ref tempref short control_var short tempshort Begin GameMode if (fquestdelaytime != 0.1) set fquestdelaytime to 0.1 let Targets := ar_Construct Array endif if (Player.IsInCombat == 1 && Player.GetEquippedObject 16 == 0) set tempref to GetCrossHairRef if (tempref.IsActor == 1 && tempref.IsEssential == 0) SetEssential tempref 1 ar_Append Targets tempref set control_var to 1 endif Return elseif (control_var == 1) set control_var to 0 while (tempshort < ar_Size Targets) let tempref := Targets[tempshort] SetEssential tempref 0 set tempshort to (tempshort + 1) loop set tempshort to 0 Return endif End I used "Player.GetEquippedObject 16 == 0" for having no weapons equipped, but I'm not sure if that will work. Also, since there's no way to use GetCombatTarget for the player, I used GetCrosshairRef. Edited June 3, 2011 by fg109 Link to comment Share on other sites More sharing options...
Faceshifter Posted June 3, 2011 Author Share Posted June 3, 2011 (edited) Can you explain to me how this works? I do not understand it completely, and I'd like to know :biggrin: Also because the CS reports several errors in this script, I assume I have to modify all the targets ( array_var Targets) but there are other reports. Oh it uses OBSE, I see now. Lemme test it there. Still needs some explanation, my scripting knowledge goes as far as an if-function :DThe GetEquippedObject 16 == 0 works, but the rest doesn't, or what should I have done with the script? Edited June 3, 2011 by Faceshifter Link to comment Share on other sites More sharing options...
fg109 Posted June 3, 2011 Share Posted June 3, 2011 (edited) This part if (fquestdelaytime != 0.1) set fquestdelaytime to 0.1 let Targets := ar_Construct Array endif makes it so that the script runs every 0.1 seconds. The reason for making it run so often is because this is supposed to be combat related, so I thought faster would be better. It also initializes the "Targets" array variable. This part if (Player.IsInCombat == 1 && Player.GetEquippedObject 16 == 0) set tempref to GetCrossHairRef if (tempref.IsActor == 1 && tempref.IsEssential == 0) SetEssential tempref 1 ar_Append Targets tempref set control_var to 1 endif Return only runs when the player is in combat without any weapons on (assuming that the if condition works properly). It checks to see if the reference in your crosshair is an actor and if it's essential. If it's an unessential actor, then it'll turn it into an essential actor, and add the actor's reference ID to the "Targets" array. It'll also set a variable to say, "Yes, we've set some actor to be essential when it wasn't before." This part elseif (control_var == 1) set control_var to 0 while (tempshort < ar_Size Targets) let tempref := Targets[tempshort] SetEssential tempref 0 set tempshort to (tempshort + 1) loop set tempshort to 0 Return endif runs whenever the player is both not in combat and not wearing a weapon, and if previously an actor was set to essential. So it'll run if the player is in combat with a weapon, or out of combat with a weapon, or out of combat without a weapon, as long as some actor was set to essential earlier. What it does is to turn all those actors we previously set to essential, back to unessential. It'll also reset the variable telling us that we set some actor to essential. There are lots of OBSE commands here so you need to compile this with OBSE. Edited June 3, 2011 by fg109 Link to comment Share on other sites More sharing options...
Faceshifter Posted June 3, 2011 Author Share Posted June 3, 2011 All right, I think I understand it now. But I do not understand why it isn't working. Link to comment Share on other sites More sharing options...
fg109 Posted June 3, 2011 Share Posted June 3, 2011 Do you mean that it won't compile, or that it's not doing what it's supposed to do? Link to comment Share on other sites More sharing options...
Faceshifter Posted June 3, 2011 Author Share Posted June 3, 2011 (edited) Well I just killed a guy, barehanded. I did make a little adition to the script:If Player.GetEquippedObject 16 == 0 Message "You're not wielding a weapon." EndifAnd the message appeared.I tried it without the message, still not working. Edited June 3, 2011 by Faceshifter Link to comment Share on other sites More sharing options...
fg109 Posted June 3, 2011 Share Posted June 3, 2011 Try using SetRefEssential instead of SetEssential and see what happens. Link to comment Share on other sites More sharing options...
Faceshifter Posted June 3, 2011 Author Share Posted June 3, 2011 I'll give it a shot, I'll let you know tommorow. Link to comment Share on other sites More sharing options...
fg109 Posted June 3, 2011 Share Posted June 3, 2011 I got it to work after modifying the script to this: scriptname examplequestscript array_var Targets float fquestdelaytime ref tempref short control_var short tempshort Begin GameMode if (fquestdelaytime != 0.1) set fquestdelaytime to 0.1 let Targets := ar_Construct Array endif if (Player.IsInCombat == 1) if (Player.GetEquippedObject 16 == 0) set tempref to GetCrossHairRef if (tempref.IsActor == 1) if (tempref.IsEssential == 0) tempref.SetRefEssential 1 ar_Append Targets tempref set control_var to 1 endif endif Return elseif (control_var == 1) set control_var to 0 while (tempshort < ar_Size Targets) let tempref := Targets[tempshort] tempref.SetRefEssential 0 set tempshort to (tempshort + 1) loop set tempshort to 0 Return endif elseif (control_var == 1) set control_var to 0 while (tempshort < ar_Size Targets) let tempref := Targets[tempshort] tempref.SetRefEssential 0 set tempshort to (tempshort + 1) loop set tempshort to 0 Return endif End Link to comment Share on other sites More sharing options...
Recommended Posts