Jump to content

Help with Yield script...


Dielos

Recommended Posts

Posted

Hello all,

 

This is my first post, but I've been around this great place for quite some time. I badly need help with a script I'm trying to do. I'm not good at scripting at all and I'm having a hard time understanding how scripting works with GECK. Maybe someone with better understanding of how this all works could help me?

 

Be warned, I'm new to GECK scripting, so please don't run away screaming when you see the script!!!

 

I'm trying to create a plugin for Sexout that allows you to yield in combat. The idea is that if you are ambushed or enter somehow combat with human opponents, if you unequip all weapons, your enemy should stop combat and approach you. Then they will give you the option to pay for your life, or, if you have no money or don't want to pay, to maybe rape you, rob you, or both. At the moment they will approach with or without weapons equiped, as this part is not implemented yet. I'm stuck at them approaching you correctly and with the dialogue packages. The script shouldn't kick in if there are more targets than you around.

 

The script should pick any enemies targeting you (works) and make them approach you (partially works, sometimes they just run in some other direction or past you). Once near, the first one should talk to you and give you the options (no options yet, only rape happens), and the next around get a guard package and wait their turn. One of the problems is that the dialogue package keeps on repeating constantly, and sometimes it doesn't. Something has to be very wrong there... The sexout animations work fine. The first dialogue sometimes jumps in with a big delay (don't know why), forcing you sometimes to run behind your agressor to make him start it.

 

There are three packages involved (travel, dialogue and guard), and some form lists, which should check who is involved in the attack and another one to check who already had their turn with the player and eventually releasing them from the script.

 

Almost nothing has worked as expected, so I kept adding checks and modifying conditions to try to get at least approximately the desired results. Thus, the code is EXTREMELY dirty and newbish. I'm sure all this can be accomplished with half of the code... There are a lot of checks which I'm sure can be accomplished in more simpler ways. I also tried to press everything into a single script, as the result scripts in the topics don't seem to throw the same results as in the quest script. The only thing in the topic scripts are the sexout commands. Also, I somehow can't pass variables from the topic script to the quest script and viceversa (why? Sexout does it! How?)

 

scn 000DYieldQuestScript

int AttackerListCount
int LoopID1
int ActivePlayer
int NoTalk
short PlayerDist
short PlayerGreeted
ref Attacker

begin gamemode
set Attacker to GetFirstRef 200 2 0 ; Actors
set PlayerGreeted to 0

Label 11
if ActivePlayer == 1
	;if Attacker.GetIsCurrentPackage 000DYieldTalkPackage == 1
	;	return
	;endif
	ListRemoveForm 000DYieldFormAttackers Attacker ;(not working correctly? Added another different check further below)
	Attacker.EvaluatePackage ;(somehow packages don't seem to start unless I put this before, doing something wrong?)
	AddFormToFormList 000DYieldFormFinished Attacker
set NoTalk to 1
if NoTalk == 1 ;Should stop this from running until sex has started (not working)
	if player.GetItemCount 00SexoutFucking
		;set NoTalk to 0
		set Attacker to Pencil01 ; Prevent apple bug
		set Attacker to GetNextRef
		if Attacker.GetCombatTarget == player && Attacker.GetGroupTargetCount <= 1
			Attacker.setav aggression 0 ;(using this repeatedly to stop them from attacking you)
			AddFormToFormList 000DYieldFormAttackers Attacker
			Attacker.AddScriptPackage 000DYieldGuardPackage
		elseif ListGetFormIndex 000DYieldFormAttackers Attacker >= 0 && ListGetFormIndex 000DYieldFormFinished Attacker < 0
			Attacker.setav aggression 0
			AddFormToFormList 000DYieldFormAttackers Attacker
			Attacker.AddScriptPackage 000DYieldGuardPackage
		endif
		return
	endif
	set NoTalk to 0
else
	return
endif

set NoTalk to 1
if NoTalk == 1
	if player.GetItemCount 00SexoutRecovering
		set Attacker to Pencil01 ; Prevent apple bug
		set Attacker to GetNextRef
		if Attacker.GetCombatTarget == player && Attacker.GetGroupTargetCount <= 1
			Attacker.setav aggression 0
			Attacker.EvaluatePackage
			AddFormToFormList 000DYieldFormAttackers Attacker
			Attacker.AddScriptPackage 000DYieldGuardPackage
		elseif ListGetFormIndex 000DYieldFormAttackers Attacker >= 0 && ListGetFormIndex 000DYieldFormFinished Attacker < 0
			Attacker.setav aggression 0
			Attacker.EvaluatePackage
			AddFormToFormList 000DYieldFormAttackers Attacker
			Attacker.AddScriptPackage 000DYieldGuardPackage
		endif
		return
	endif
	set ActivePlayer to 0
	set NoTalk to 0
else
	return
endif
endif

Label 10
if Attacker
	if Attacker.GetCombatTarget == player && Attacker.GetGroupTargetCount <= 1
			Attacker.setav aggression 0
			AddFormToFormList 000DYieldFormAttackers Attacker
			Attacker.AddScriptPackage 000DYieldGotoPackage
	endif
	if ListGetFormIndex 000DYieldFormAttackers Attacker >= 0 && ListGetFormIndex 000DYieldFormFinished Attacker < 0
			Attacker.setav aggression 0
			set PlayerDist to Attacker.GetDistance Player
			if PlayerDist < 255 && PlayerGreeted == 0 ;(Try to ensure this runs only once, first greeting...)
				Attacker.EvaluatePackage
				Attacker.AddScriptPackage 000DYieldTalkPackage
				set PlayerGreeted to 1
				set ActivePlayer to 1
				goto 11
			elseif PlayerDist < 255 && PlayerGreeted == 1
				Attacker.EvaluatePackage
				Attacker.AddScriptPackage 000DYieldGuardPackage
				if ActivePlayer == 0
					Attacker.EvaluatePackage
					Attacker.AddScriptPackage 000DYieldTalkPackage ;(This package should be another, which at the moment crashes, so leave this for testing)
					set PlayerGreeted to 1
					set ActivePlayer to 1
					set NoTalk to 1
					if NoTalk == 1 ;Should stop other NPC's from starting topic during sex (not working)
						if player.GetItemCount 00SexoutFucking
							set NoTalk to 0
						else
							return
						endif
					endif
					goto 11
				endif
			endif
	endif
	set Attacker to Pencil01 ; Prevent apple bug
	set Attacker to GetNextRef
	Goto 10
endif

 

I'm attaching the plugin in case it's better to check the code. It only needs Sexout and NVSE. But be warned that it's extremely buggy and not really playable yet at all. I usually test this in Primm before doing any quests there, as there are a lot of enemies to test with (sometimes quite a lot standing line). There are no checks yet for female, male, creatures, or anything else at all (the rest has to work first).

 

Thanks a lot in advance!!! And great community here!

 

 

Posted

Would be great! It's a great mod. Have it installed! If I ever get this working as desired I'll try and see how to tie it in. But as I said, I'm not too good at this yet, so let's see how this one ends...

Posted

Solved the problem! The solution was a good night sleep...

 

Rewrote the script from scratch and now works almost without problems. It looks also now more orderly.

 

The problem I still have which I don't know whats causing it, is that sometimes some random NPC will completely freeze, as if it's AI had been removed. If I go near them, they engage in the scripted conversation (000DYieldNextPackage) and after it's finished, it recovers it's AI (EvaluatePackage is run on the NPC after the conversation). This didn't happen in the last script. Any idea why this might happen?

 

This is the new script

scn 000DYieldQuestScript2

int TokensCount
short PlayerGreeted
ref Attacker

begin gamemode

set Attacker to GetFirstRef 200 2 0 ; Actors

Label 10

if Attacker
	if Attacker.GetCombatTarget == player && Attacker.GetGroupTargetCount <= 1
			Attacker.setav aggression 0
			Attacker.AddItem 000DYieldTokenAttacker 1 1
			set TokensCount to TokensCount + 1
			Attacker.EvaluatePackage
			Attacker.AddScriptPackage 000DYieldGotoPackage
			set Attacker to Pencil01 ; Prevent apple bug
			set Attacker to GetNextRef
			Goto 10
	endif

	if Attacker.GetItemCount 000DYieldTokenAttacker && Attacker.GetDistance Player <= 300 && PlayerGreeted != 1
			Attacker.setav aggression 0
			Attacker.EvaluatePackage
			Attacker.AddScriptPackage 000DYieldTalkPackage
			Player.AddItem 000DYieldTokenPlayerActive 1 1
			Attacker.RemoveItem 000DYieldTokenAttacker 1 1
			Attacker.AddItem 000DYieldTokenHadPlayer 1 1
			set TokensCount to TokensCount - 1
			if TokensCount != 0
				set PlayerGreeted to 1
			endif
			set Attacker to Pencil01 ; Prevent apple bug
			set Attacker to GetNextRef
			Goto 10
	endif

	if Attacker.GetItemCount 000DYieldTokenAttacker && Attacker.GetDistance Player <= 300 && PlayerGreeted == 1
			Attacker.setav aggression 0
			if player.GetItemCount 00SexoutFucking || player.GetItemCount 00SexoutRecovering || player.GetUnconscious || player.GetItemCount 000DYieldTokenPlayerActive
					;Attacker.EvaluatePackage
					;Attacker.AddScriptPackage 000DYieldGotoPackage
					set Attacker to Pencil01 ; Prevent apple bug
					set Attacker to GetNextRef
					Goto 10
			else
					Attacker.EvaluatePackage
					Attacker.AddScriptPackage 000DYieldNextPackage
					Player.AddItem 000DYieldTokenPlayerActive 1 1
					Attacker.RemoveItem 000DYieldTokenAttacker 1 1
					Attacker.AddItem 000DYieldTokenHadPlayer 1 1
					set TokensCount to TokensCount - 1
					set Attacker to Pencil01 ; Prevent apple bug
					set Attacker to GetNextRef
					if TokensCount == 0
						set PlayerGreeted to 0
					endif
					Goto 10
					endif	
	endif
	set Attacker to Pencil01 ; Prevent apple bug
	set Attacker to GetNextRef
	Goto 10
endif

end

 

Replaced also the form lists for tokens, seems easier to control...

 

Now to the fun part, the dialogues and conditions!

 

Thanks!

Posted

How did you set the AI package ?? what checks did you enable in the flags area ??

If you use Must complete this will override all previous packages till you remove it again.

 

Continue if player is near is not very good option if you have it checked remove the check.

Posted

I did have in all packages the "Continue if PC near flag", which I removed. It's only enabled in the Guard package, as without it somehow they don't go into the conversation.

 

I had to leave the "Must Complete" flag enabled in the follow package, as it's end result script fires the guard package. If I untick it, conversations start to repeat themselves (dialogue package 000DYieldNextPackage).

 

The only other flags I have set are "Always run" (only follow package), "Weapon Drawn", "Friendly fire comments" and "Avoid Radiation".

 

Most of the time only a single NPC freezes, but I've seen two of them at some point. They allways trigger the dialogue package 000DYieldNextPackage when I come near them by myself and then they recover movement.

 

There are no other conditions set for these packages under the "Conditions Tab". Could this be the cause of trouble?

 

Thanks for the help!

  • 3 weeks later...
Posted

Any new updates on this?

 

I really think its a great idea. I've long wanted something closer to a "hardcore mode" where... instead of being killed and just reloading from a save... you're robbed... or left for dead (err... left for dead AGAIN). The "yield" provides a good way to lose a battle, lose some gear, etc. but not lose your life.

 

 

 

I also wouldn't mind seeing an option for a "yield" after any combat rape, as... again, my character usually just ends up dying and reloading to a prior point otherwise.

Posted

Any new updates on this?

 

I really think its a great idea. I've long wanted something closer to a "hardcore mode" where... instead of being killed and just reloading from a save... you're robbed... or left for dead (err... left for dead AGAIN). The "yield" provides a good way to lose a battle' date=' lose some gear, etc. but not lose your life.

 

 

 

I also wouldn't mind seeing an option for a "yield" after any combat rape, as... again, my character usually just ends up dying and reloading to a prior point otherwise.

[/quote']

 

You need a companion!

 

Whenever I get combat raped, by the time the rape is done, EDE and Veronica have facemelted everyone with their lasers and powerfist. ;)

Posted

Any new updates on this?

 

I really think its a great idea. I've long wanted something closer to a "hardcore mode" where... instead of being killed and just reloading from a save... you're robbed... or left for dead (err... left for dead AGAIN). The "yield" provides a good way to lose a battle' date=' lose some gear, etc. but not lose your life.

 

 

 

I also wouldn't mind seeing an option for a "yield" after any combat rape, as... again, my character usually just ends up dying and reloading to a prior point otherwise.

[/quote']

 

Sorry, but I haven't been working much on this now. It works partially right now.

 

As it is now. They will start shooting at you, (like warning shots), but abort as soon as you unequip all weapons. Then they will race towards you and engage in dialogue. The dialogue options now only lead to rape, for testing purposes, but more options were planned. All enemies will go to a guard package and wait their turn, until they are all finished. It's actually fun because they'll guard you quite well and will shoot at anything that aproaches them which aren't in their faction, warning them first. After they are done, they will return to their normal activities. Once you leave the area they should reset.

 

The problem is that it works as it should, but not always and not perfect. It's extremely buggy, AI sometimes freeze, the reseting after you leave doesn't work properly, and sometimes the dialogue packages get screwed and they jump topics. I'm having problems also with the different tokens I'm using to control who has had the player or not and other checks.

 

I'm just not that good at scripting yet, so the code is dirty and not well optimized. I've just hit bumps which I don't know how to solve, so I'm stuck with them until I get better. Also Skyrim is out...

 

I wouldn't mind though if anyone with better scripting wants to revamp it or modify it or repair it as they want, as I fear I won't be able to solve all the problems...

 

As it is now, it's not really playable.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...