Jump to content

Scripting Help Thread


sukeban

Recommended Posts

I think the over-encumbrance prevents sprinting is hard coded. You won't find any mention of it in the scripts. If you want to prevent sprinting at low move speeds, instead of scripting, you could try editing the conditions for the sprinting animations.

 

Gameplay -> Animations... -> Actors\Characters\Behaviors\0_Master.hkx -> ActionSprintStart -> SprintStartRoot

 

Add a condition such as "GetActorValue SpeedMult > 25".

 

I do not know how to force an update of the PC's move speed. You could try experimenting with SendAnimationEvent to force the player to change animation states. There may be some event that will update the PC's move speed without any visible changes in animation.

 

No idea on how to get time to pass while in menus.

Edited by fg109
Link to comment
Share on other sites

Mwaha, finally got to put some of your suggestions into effect. I was able to use conditions on the running animations, so that nuisance is definitely solved :) Epic huge "Thank You" for leading this horse to water!

 

I wasn't quite able to get the SendAnimationEvent function to work, but I have hope that it's on the right track as per the trace logs. I'll see if I can't work a bit more on that and see if I can get it functional.

 

In the meantime, I've another question. In another script, I have been attempting to advance time when crafting by a set amount per item material and equipment type. I've been trying to do this via my standard "quest --> alias --> script" procedure, but I can't get the Event OnStoryCraftItem to fire properly. I wonder if this is because it is intended for placement on an activator, say, a forge or workbench, and not on an actor. But even when I attached the script to the forge furniture in the CK, nothing happened when I crafted an item. Likely, I am misunderstanding the purpose of this function. If this is true, what sort of function should I use to achieve an "on item crafted" condition. On Activate seems the closest, but I don't know how to ensure that the PC actually crafts something instead of just activating the furniture.

 

I include my incomplete script, if it is useful:

 

Scriptname TimeCraftScript extends Quest 

;WORK

;Script first identifies crafted material type and adds a fixed amount to the game time. 
;Next it adds to that value depending on the piece of equipment created

	Event OnStoryCraftItem(ObjectReference akBench, Location akLocation, Form akCreatedItem)
		Debug.Messagebox("At least the OnEvent works :D")
			float GameTime = GameHour.GetValue() 
				If (akCreatedItem.HasKeyword(ArmorMaterialFur))
					float NewTime = GameTime
						If (akCreatedItem.HasKeyword(ArmorCuirass))
							float ModTime = NewTime + 4
									GameHour.Mod(ModTime)
						ElseIf (akCreatedItem.HasKeyword(ArmorBoots)) || (akCreatedItem.HasKeyword(ArmorGauntlets))
							float ModTime = NewTime + 1
									GameHour.Mod(ModTime)
						ElseIf (akCreatedItem.HasKeyword(ArmorHelmet))
							float ModTime = NewTime + 2
									GameHour.Mod(ModTime)
						Else
							float ModTime = NewTime + 3
									GameHour.Mod(ModTime)
						EndIf
				ElseIf (akCreatedItem.HasKeyword(ArmorMaterialHide))
					float NewTime = GameTime + 1
						If (akCreatedItem.HasKeyword(ArmorCuirass))
							float ModTime = NewTime + 4
									GameHour.Mod(ModTime)
						ElseIf (akCreatedItem.HasKeyword(ArmorBoots)) || (akCreatedItem.HasKeyword(ArmorGauntlets))
							float ModTime = NewTime + 1
									GameHour.Mod(ModTime)
						ElseIf (akCreatedItem.HasKeyword(ArmorHelmet))
							float ModTime = NewTime + 2
									GameHour.Mod(ModTime)
						Else	
							float ModTime = NewTime + 3
									GameHour.Mod(ModTime)
						EndIf
				EndIf
	EndEvent

;PROPERTIES

;TIME VARS
	GlobalVariable Property GameHour Auto

;ARMOR TYPE VARS
	Keyword Property ArmorMaterialFur Auto
	Keyword Property ArmorMaterialHide Auto

;ARMOR PIECE VARS
	Keyword Property ArmorCuirass Auto
	Keyword Property ArmorBoots Auto
	Keyword Property ArmorGauntlets Auto
	Keyword Property ArmorHelmet Auto
	Keyword Property ArmorShield Auto

 

NOTE: It extends "Quest" right now, but I've changed it to just about everything ( :laugh:) and haven't gotten any of them to work.

Edited by sukeban
Link to comment
Share on other sites

  • 3 weeks later...

@fallout. from what i see in default scripts (they always have a only once property) they do like this

 

bool property OnlyOnce = true auto

 

stuff stuff stuff

 

if OnlyOnce
   gotostate("AlreadyRun")
endif

 

stuff stuff

 

STATE AlreadyRun
EndSTATE

 

Basically it sets the script into an empty state if i understand well.

Edited by gasti89
Link to comment
Share on other sites

The if is usually inside the event and inside the ifs for a function. Yes, right after the function like:

 

Event OnTriggerEnter(ObjectReference akActionRef)
   if akActionRef == Game.GetPlayer()
      Debug.MessageBox("FUSRODAH!")
      if OnlyOnce
         gotostate("ShutUp!")
      endif
   endif
endEvent

STATE ShutUp!
EndSTATE

Link to comment
Share on other sites

  • Recently Browsing   0 members

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