Jump to content

Recommended Posts

Posted

In both scripts recently posted there is a bool variable isTriggered. This variable is set but is never checked. It either is not needed or needs to be checked for proper value within an IF statement.

Posted (edited)
  On 3/21/2019 at 7:11 PM, IsharaMeradin said:

In both scripts recently posted there is a bool variable isTriggered. This variable is set but is never checked. It either is not needed or needs to be checked for proper value within an IF statement.

I also found an error after testing. I added the "Actor damage" after closing CK without testing, went to take a shower and then i tested it and found the error.
IsharaMeradin how should this be correctly written, with the variable checked ?.
This is the script now working :
  Reveal hidden contents

Many thanks in advance !!.
* Sorry Toby, you might want to check this script version.
Edited by maxarturo
Posted (edited)


;Actor Property PlayerREF Auto ; UnUSED by now, {to apply damage on self - Actor}

EVENT OnActivate(ObjectReference akActionRef)
IF ( isTriggered )
RETURN ; - STOP - /1 quest already triggered
ENDIF
;---------------------
IF (akActionRef == Game.GetPlayer() as ObjectReference)
ELSE
RETURN ; - STOP - /2 not the player
ENDIF
;---------------------
IF myQuest.IsStageDone(stageSetOnTriggered)
RETURN ; - STOP - /3 quest stage was already set
ENDIF
;---------------------
isTriggered = TRUE

myQuest.setStage(stageSetOnTriggered)
akActionRef.AddItem(Key01 as Form, 1) ; give player the key

StaticKey.Disable()

SoundFX.Enable()
self.Disable()
Utility.Wait(2.5)

Message01.show() ; show message
Utility.wait(1.5)

(akActionRef as Actor).DamageActorValue("Health", 100.0) ; damage player by 100 points
Game.TriggerScreenBlood(6)

;;; GoToState("Done") ; not seen in your script
ENDEVENT

 

Edited by ReDragon2013
Posted (edited)
I don't know if ReDragon version is better and in what way, but i for sure would appreciate some advice or shed some light to it.


Nevertheless thank you very much ReDragon for your trouble !!


* GoToState("Done")

i've seen it been used in so many vanilla scripts like this, that i figure there must be a reason behind it.

Edited by maxarturo
Posted (edited)

What is the key behind GoToState("Done")?

 

Script should look as follow, variant A:

  Reveal hidden contents

 

or like this, Variant B

  Reveal hidden contents

 

Edited by ReDragon2013
Posted (edited)

After seeing the four versions of the same script, i've come to understand the logic, and each coding style.

 

Thanks ReDragon !.

Edited by maxarturo
Posted (edited)
I'm just posting this because i see that this topic has a lot of views & someone might be interested.


After a lot of testing with all four Scripts, i did found some difference mainly on how the game engine executes (timing in miliseconds) the script.

The main is that removing the "Actor Property PlayerREF Auto" and replacing it with " (akActionRef as Actor).DamageActorValue" like ReDragon made it, will make the action fire 0.5seconds faster or the " Message01.show()" 0.5seconds later (i don't know why this is happening).


And why is this important ?, in my case is CRITICAL that everything happens in a linear and synchronize timing, the player is alredy in a bad place constantly taking damage and when the Script fires everything needs to be clear to the player:

1) Activate - activator (take key)

then

2) See quest updating

then

3) See boss appearing

then

4) Read message (curse)

then

5) Take damage (from script)


And all of the above needs to be completely synchronized and not overlapping each other.


Every script might need some different tweaking so that everything works synchronize, but they all work fine.

Edited by maxarturo
  • Recently Browsing   0 members

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