Jump to content

Recommended Posts

Posted (edited)

Well yea, you can access properties of any script I haven't actually scripted for FO so I am not sure I can really draw comparisons with that... hm...

 

I guess the best way to describe it is... It is the similar to way you've already been calling functions. Say I have a Quest and on that Quest I have a ReferenceAlias which is filled with the players reference, I want the alias to be able to access a float property called JumpValue on a Script that is attached to the Quest, lets call that TestQuestScript and on the ReferenceAlias I have a script called TestQuestPlayerAliasScript I could grab a reference of the quest and access the property through the following means:

Scriptname TestQuestScript extends Quest
	
	Float Property JumpValue Auto
	
	Event OnInit()
		JumpValue = 20
	EndEvent
	

Which of course would be the script attached to the Quest, which just sets it's property to 20 when OnInit is called.

Scriptname TestQuestPlayerAliasScript extends ReferenceAlias

	TestQuestScript Property TestQuest Auto

	Event OnInit()
		TestQuest = self.GetOwningQuest() as TestQuestScript
	EndEvent
	
	Event OnRaceSwitchComplete()
		Game.SetGameSettingFloat("fJumpFallHeightMin", 300 + TestQuest.JumpValue)
	EndEvent

This script is attached to the players alias, when OnInit happens it grabs a reference of the TestQuest as a quest using the GetOwningQuest function of Reference Alias. It then Casts the quest as TestQuestScript, if the quest didn't have the TestQuestScript attached this would return none but since it does, it will return the scripts reference. Then when the player's race changes we just set the game setting 'fJumpFallHeightMin' to 300 plus the TestQuest Property.

 

 

And that's a crash course in property access there's plenty of info around on how it works like here... well maybe not that much but it does cover it sorta.

Edited by Arocide
Posted (edited)

So, essentially i just have to add property to the variables and they can be accessed from different Scripts.
I could even set the base script to update at 5 while the one that there to apply changes will update at 0.5 as usual.
The alias is only used to tell the quest script event happened that the quest script itself cant get.
Like load game and race change. Alias script will just tell the base quest script that it happened and not actually apply any changes.
The base script will do everything regarding what the value is and the second quest script will apply the values.
Heres what im thinking id need.

  Reveal hidden contents

 

 

This is how FO looked like.

 

  Reveal hidden contents

 

 

Does the actual variable character length make a difference in performance?

Figured out i hope. Looks like its gonna hurt more the coder than it will the performance. xD

Edited by theimmersion
Posted

Is there a way to compare IsRunning() and IsSprinting() etc?

 

This doenst compare and thus,doesnt work.

if PlayerRef.IsRunning() == True

elseif PlayerRef.IsRunning() == False

endif

 

Instead i used a work around like this.

If PlayerRef.IsRunning()

PlayerIsRunning = 1

else

PlayerIsRunning = 0

endif

 

Want to remove those many if statements. Cuz thers a lot like this.

Posted (edited)

Theres a lot of code that checks if im running,sneaking,moving,swimming separate and at same time as well.

Take a look at the code in the first post and you can perhaps get a better idea, dont know how to actually explain other than start to write the code down. xD

 

Its under *STATES , *RAMP and *ACTIVE MODIFIERS. Unless its ok as it is or it cant be compared directly. Im in the process of eliminating any ifs and such calls i can and writing the code as small as possible. For optimization.

Edited by theimmersion
  • Recently Browsing   0 members

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