BeastlyBeast Posted April 26, 2012 Share Posted April 26, 2012 (edited) @BeastlyBeast OK, I suggest adding this to your quest script: Scriptname YourQuestScript extends Quest Conditional Int Property PCRoll Auto Conditional Int Property NPCRoll Auto Conditional Int Property PCWin Auto Conditional Function CalculateRolls(Int iSides, Float NPCSpeech = 50.0) PCRoll = Utility.RandomInt(1, iSides) Float PCSpeech = Game.GetPlayer().GetActorValue("Speechcraft") Float Modifier = (PCSpeech - NPCSpeech) / 100 NPCRoll = (Utility.RandomInt(1, iSides) + (Modifier * iSides)) as Int if (NPCRoll < 1) NPCRoll = 1 elseif (NPCRoll > iSides) NPCRoll = iSides endif if (PCRoll > NPCRoll) PCWin = 1 elseif (PCRoll < NPCRoll) PCWin = 0 else PCWin = 2 ;draw endif EndFunction You can call the function whenever you start the dice game, and use the condition GetVMQuestVariable on the responses. Okay, thank you. But, then again, what would you have suggested had I not wanted speechcraft to play a part, and wanted everything to be totally random. Reason I'm asking is, I'm not the best at understanding scripts, and since I haven't even really made the quest yet, I'd need to find out what most of your un-named variables, like PCRoll, NPCRoll, YourQuestScript and such, mean. I'm sure I could find it all out, and I very well may, but on the off chance just letting everything be perfectly random is easier, and still fun and not immersion-breaking, I may want to do that instead. It's nice to have 2 options :D Thank you, again. Edited April 26, 2012 by BeastlyBeast Link to comment Share on other sites More sharing options...
fg109 Posted April 26, 2012 Author Share Posted April 26, 2012 (edited) @BeastlyBeast Well then you would do what I suggested earlier, with all the GetRandomPercent conditions. You would need to save the value of the reponses somewhere so that you know whether or not the player won or lost. In the script, PCRoll would be whatever the player rolls, and NPCRoll would be whatever the NPC rolls. Edited April 26, 2012 by fg109 Link to comment Share on other sites More sharing options...
BeastlyBeast Posted April 26, 2012 Share Posted April 26, 2012 (edited) @BeastlyBeast Well then you would do what I suggested earlier, with all the GetRandomPercent conditions. You would need to save the value of the reponses somewhere so that you know whether or not the player won or lost. In the script, PCRoll would be whatever the player rolls, and NPCRoll would be whatever the NPC rolls. Okay, thanks. But, I think there may be a slight problem with the script in your other post, since you gave me a bit more info on it. If there isn't, then, I should be good, but the reason I'm saying there may be a problem is because, I'm not randomizing an in-game roll, based on my speechcraft. I'm randomizing the replies that the NPC can tell me, which would act like the roll, based on my speechcraft. That's why I was saying it'd take hundreds of dialogue. Cuz I'd press the 'topic' that read "*roll*", and then I'd want the game to randomly pick which dialogue the NPC would say. So it'd look like: Topic - *Roll* --- NPC Responses: You rolled 1. Now I'll roll/You rolled 2, Now, I'll roll/ You rolled 3. Now I'll roll...etc etc. Topic - Okay --- NPC Responses: I rolled 1 (win/lose speech)/ I rolled 2 (win/lose speech/ etc etc. The simplest way to put it is, I just want to randomize dialogue, and if Speechcraft being lower accounted for higher loss rate, and speechcraft being higher counted for higher win rate could be an effect, that'd be the whole pub game. Sorry if this is a pain. I literally know nothing of scripting. My first quest was me following the CK guide like a zombie through and through. :tongue: Edited April 26, 2012 by BeastlyBeast Link to comment Share on other sites More sharing options...
tonycubed2 Posted April 26, 2012 Share Posted April 26, 2012 Hi,for my mod sands of time I am adding encounters where a npc Highway Man appears interrupting fast travel and demands gold. Works fine after two days of working on it. But I would really like to have 2 or 3 henchmen stand by the Highway Man and assist him if there is combat or run with him if he gets the p,ayers gold and is exiting the scene . I am using the packages forcegreet and goto on the npc to,make things happen, with a on npc script to make him gracefully run away and be deleted when or of sight. I cannt make the follower npcs follow him,. They just stand there. I tried a follow package but if I include the highway mans quest in the package to use his Alias the ckit will not let me assign it to a npc! Catch 22. Any ideas or scripts for npc followers to mimic their leader? Of course you will get stellar credit on my mod page. Tonycubed2 Link to comment Share on other sites More sharing options...
fg109 Posted April 26, 2012 Author Share Posted April 26, 2012 (edited) @BeastlyBeast That's what the values PCRoll and NPCRoll is for. Example: PC:Let's play. *Rolls Dice*call the CalculateRollsFunctionNPCYou roll 1. Now it's my turn.GetVMQuestVariable YourQuest PCRoll == 1[*]You roll 2. Now it's my turn.GetVMQuestVariable YourQuest PCRoll == 2[*]You roll 3. Now it's my turn.GetVMQuestVariable YourQuest PCRoll == 3[*] etc.PCOkay.NPC I roll 1.GetVMQuestVariable YourQuest NPCRoll == 1[*]I roll 2.GetVMQuestVariable YourQuest NPCRoll == 2[*]I roll 3.GetVMQuestVariable YourQuest NPCRoll == 3[*] etc.PCDamn, I lost.GetVMQuestVariable YourQuest PCWin == 0[*]Nice, now give me my money.GetVMQuestVariable YourQuest PCWin == 1[*]Hmph, a draw.GetVMQuestVariable YourQuest PCWin == 2 @tonycubed2 Give the followers reference aliases too. Edited April 26, 2012 by fg109 Link to comment Share on other sites More sharing options...
BeastlyBeast Posted April 26, 2012 Share Posted April 26, 2012 Okay I'm starting to get it now. TY. It gets easier when I really see the big picture. I'll get started on it in a bit, and I'll let you know how it works out. :) Link to comment Share on other sites More sharing options...
kryptopyr Posted April 26, 2012 Share Posted April 26, 2012 (edited) EDIT: Thank you but, um, never mind. It seems to be working now. I'm not sure what I changed to suddenly get it to work. I decided to work on the Navmesh and a few other unrelated (or so I thought) parts of the mod. I didn't change anything about the trigger box or the script, but for whatever reason it is now working so please ignore the rest of this post. Thank you once again for all the help you've given me. I hope you don't mind if I bother you with another question. I'm trying to fix the bug where the Ebonmere animation doesn't play when the player returns there after the Nightingale quest is finished. This is what I have: Scriptname TG09BlackPoolTriggerScript extends ObjectReference Conditional Quest Property pTG09Quest Auto Conditional ObjectReference Property pPool Auto event onTriggerEnter (objectReference activateRef) if activateRef == Game.GetPlayer() if pTG09Quest.getstage() == 30 pTG09Quest.setstage(40) endif if pTG09Quest.getstage() >= 200 pBlackPool.PlayAnimation("open") debug.messagebox ("animation triggered") endif endif endevent This is a modification of an existing script that is attached to a trigger box in the cell. The part I added was this... if pTG09Quest.getstage() >= 200 pPool.PlayAnimation("open") debug.messagebox ("animation triggered") endif The "animation triggered" messagebox pops up, but the animation doesn't play. The pPool.PlayAnimation("open") was used earlier in the quest (TG09, stage 45) to play the animation, but I'm obviously missing something here. Edited April 27, 2012 by kryptopyr Link to comment Share on other sites More sharing options...
AwesomeSkyrimDude Posted April 26, 2012 Share Posted April 26, 2012 (edited) I want to make a script that detects if an enemy is staggered when he is attacked and then detects which hand the character strikes them with, left or right. I think I know basically how to do the second part but not the first. Edited April 26, 2012 by AwesomeSkyrimDude Link to comment Share on other sites More sharing options...
fg109 Posted April 27, 2012 Author Share Posted April 27, 2012 @kryptopyr I tried with a magic effect script just now using the same function the same way, and it worked fine. Did you remember to set your properties? @AwesomeSkyrimDude There is an "IsStaggering" animation variable. You can try registering for animation events "WeaponSwing" and "WeaponLeftSwing", waiting half a second, then checking the animation variable with GetAnimationVariableBool (or it might be an Int or Float). Link to comment Share on other sites More sharing options...
AwesomeSkyrimDude Posted April 27, 2012 Share Posted April 27, 2012 (edited) @fg thanks. also how do you modify the weapon swing speed with a script? I assumed there would be some speed variable or something but maybe I'm wrong. Edit: also how do you know he names of those animation events? I don't see them in the list in the creation kit. I know I asked before about animation event names but it seems I am still looking in the wrong places or something. Edited April 27, 2012 by AwesomeSkyrimDude Link to comment Share on other sites More sharing options...
Recommended Posts