Jump to content

Need a script? Maybe I can help.


fg109

Recommended Posts

@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 by BeastlyBeast
Link to comment
Share on other sites

  • Replies 272
  • Created
  • Last Reply

Top Posters In This Topic

@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 by fg109
Link to comment
Share on other sites

@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 by BeastlyBeast
Link to comment
Share on other sites

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

@BeastlyBeast

 

That's what the values PCRoll and NPCRoll is for.

 

Example:

 

PC:

  • Let's play. *Rolls Dice*
  • call the CalculateRollsFunction

NPC

  • You 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.

PC

  • Okay.

NPC

 

  • I roll 1.
    • GetVMQuestVariable YourQuest NPCRoll == 1

    [*]I roll 2.

    • GetVMQuestVariable YourQuest NPCRoll == 2

    [*]I roll 3.

    • GetVMQuestVariable YourQuest NPCRoll == 3

    [*] etc.

PC

  • Damn, 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 by fg109
Link to comment
Share on other sites

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 by kryptopyr
Link to comment
Share on other sites

@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

@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 by AwesomeSkyrimDude
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...