Script to check for an item, needs some help.

Post » Fri Feb 18, 2011 9:54 pm

Alright, this is getting a little frustrating. I have nearly completed my dungeon however I am play testing it and not everything is resetting properly. I know this is because they are persistent references but there is one thing in particular I am stuck on atm.

I have these 2 scripts, one is a trigger and the other is a gate.

Trigger:
short triggeredshort DoOncefloat timerref targetref myselfbegin onTrigger player	if triggered == 0		set triggered to 1		set myself to GetSelf		set target to GetParentRef		set DoOnce to 0		set timer to 2		target.SetOpenState 0	endifendbegin GameMode	if ( timer <= 0 ) && DoOnce == 0		target.Lock 100		set DoOnce to 1	endif	if timer > 0		set timer to timer - GetSecondsPassed	endifendbegin onReset	set triggered to 0	set DoOnce to 0end


Gate:
begin onactivate		if ( getlocked == 0 )		activate	endif		if ( getlocked == 1 )		message "This gate is firmly sealed."	endifendbegin onreset		if ( getlocked == 1 )		unlock		setopenstate 1	endif		if ( getlocked == 0 )		return	endifend


The OnReset portion of this script is not unlocking/opening the gate properly. I originally had the on reset in the triggers script but once I found it was not working properly I tried many different things, re-declaring variables cause I figured they weren't being set properly in that block and finally adding the reset to the gate it self but it still doesn't work. =/

Can anyone spot the problem, I am drawing a blank here.
User avatar
Emma Parkinson
 
Posts: 3401
Joined: Wed Jul 26, 2006 5:53 pm

Post » Sat Feb 19, 2011 9:13 am

Put a Printc "Reset" in your onReset block, make sure it is running properly.
User avatar
Alyna
 
Posts: 3412
Joined: Wed Aug 30, 2006 4:54 am

Post » Sat Feb 19, 2011 4:14 am

Put a Printc "Reset" in your onReset block, make sure it is running properly.


I gave it a shot and ran it like this
begin onreset	if ( GetLocked == 1 )		printc "reset"		UnLock		SetOpenState 1	endif	if ( GetLocked == 0 )		return	endifend


The message was printed to the console, but the gate was still locked and unopen =/
User avatar
Mrs. Patton
 
Posts: 3418
Joined: Fri Jan 26, 2007 8:00 am

Post » Fri Feb 18, 2011 9:00 pm

And your sure the cell has expired? Its the only time it will reset.

http://cs.elderscrolls.com/constwiki/index.php/OnReset
User avatar
Rude_Bitch_420
 
Posts: 3429
Joined: Wed Aug 08, 2007 2:26 pm

Post » Sat Feb 19, 2011 9:55 am

Is the script actually ON the gate?
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Sat Feb 19, 2011 7:02 am

And your sure the cell has expired? Its the only time it will reset.

http://cs.elderscrolls.com/constwiki/index.php/OnReset


Yes, I waited for 96 Hours outside the cell and checked by opening another gate in the cell. Which was properly reset when I re-entered the cell.

Is the script actually ON the gate?


Yes, the script is on the gate.
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Sat Feb 19, 2011 10:46 am

I wonder if this block:

begin GameMode        if ( timer <= 0 ) && DoOnce == 0                target.Lock 100                set DoOnce to 1        endif        if timer > 0                set timer to timer - GetSecondsPassed        endifend


Is relocking the gate?
User avatar
priscillaaa
 
Posts: 3309
Joined: Sat Dec 30, 2006 8:22 pm

Post » Sat Feb 19, 2011 1:50 am

I wonder if this block:

begin GameMode        if ( timer <= 0 ) && DoOnce == 0                target.Lock 100                set DoOnce to 1        endif        if timer > 0                set timer to timer - GetSecondsPassed        endifend


Is relocking the gate?


Its possible, but does the DoOnce variable get reset along with the cell timer? It would only meet that condition if DoOnce for whatever reason was returning to 0. Although, that doesn't make sense cause that condition should also be true the first time I enter the cell and just automatically close but it doesn't. Unless I am missing something. But doesn't game mode only start when it is called? It shouldn't be called until the trigger happens.

However, I'll try changing the statement to < 0 instead of <= 0 and see if that helps anything.
User avatar
Jesus Sanchez
 
Posts: 3455
Joined: Sun Oct 21, 2007 11:15 am

Post » Sat Feb 19, 2011 2:38 am

It all depends on which command executes first. Since the game mode block is first in the script, it isn't too much of a stretch to think that it executes first.... maybe move the On-Reset block to the beginning of the script?
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am

Post » Sat Feb 19, 2011 10:34 am

No difference in changing the equation, still didn't reset properly. =/
User avatar
Solina971
 
Posts: 3421
Joined: Thu Mar 29, 2007 6:40 am

Post » Fri Feb 18, 2011 10:02 pm

begin GameMode        if ( timer <= 0 ) && DoOnce == 0                printc "Timer: %0f DoOnce: %0.f" timer doonce                target.Lock 100                set DoOnce to 1        endif        if timer > 0                set timer to timer - GetSecondsPassed        endifend


add the printc as seen here, and see what it looks like when you first go into the dungeon upon returning. (after cell reset)
User avatar
Amy Cooper
 
Posts: 3400
Joined: Thu Feb 01, 2007 2:38 am

Post » Fri Feb 18, 2011 7:45 pm

begin GameMode        if ( timer <= 0 ) && DoOnce == 0                printc "Timer: %0f DoOnce: %0.f" timer doonce                target.Lock 100                set DoOnce to 1        endif        if timer > 0                set timer to timer - GetSecondsPassed        endifend


add the printc as seen here, and see what it looks like when you first go into the dungeon upon returning. (after cell reset)


Okay, so it is running after the OnReset block.

I still had the printc reset and in the console I have
resetTimer: -0.024000 DoOnce:0

Which is the same as when it ran when I triggered it while entering the zone prior to the reset. So I am going to try specifically setting timer back to 0 after it locks the gate the first time.

EDIT: Success that was it, its properly resetting now :)

Thanks for all the help you have given me HeyYou, its much appreciated.
User avatar
Alba Casas
 
Posts: 3478
Joined: Tue Dec 12, 2006 2:31 pm

Post » Sat Feb 19, 2011 9:26 am

Awesome. :D Happy to be of service.
User avatar
SWagg KId
 
Posts: 3488
Joined: Sat Nov 17, 2007 8:26 am

Post » Sat Feb 19, 2011 3:11 am

Did a couple play tests and now it appears to be in working shape, would love if you or anyone who reads this post could check it out and tell me what you think. Also going to be making a post in the Mods section to officially let people beta test it and get peoples opinions on if they would want more of something like this or if its a flop :P It might provoke nostalgia in many people.

Anywho, heres the link: http://www.4shared.com/file/rg7u2Vh1/Water_Temple_Beta_v101.html

EDIT: Updated link.
User avatar
no_excuse
 
Posts: 3380
Joined: Sun Jul 16, 2006 3:56 am

Post » Fri Feb 18, 2011 11:21 pm

I am expanding my dungeon creation project a little and something has occured to me. Is it possible to change the texture of an object through scripting?

For instance say I have a blue welkynd crystal, is there a function that could make the object change its .nif on the fly from the blue crystal to a white or green crystal?
User avatar
Cool Man Sam
 
Posts: 3392
Joined: Thu May 10, 2007 1:19 pm

Post » Sat Feb 19, 2011 12:03 pm

Have a look at http://cs.elderscrolls.com/constwiki/index.php/SetModelPath.
User avatar
Rachael
 
Posts: 3412
Joined: Sat Feb 17, 2007 2:10 pm

Post » Fri Feb 18, 2011 8:58 pm

Have a look at http://cs.elderscrolls.com/constwiki/index.php/SetModelPath.


That says the model has to be re-loaded. I would assume by either exiting and re-entering and as the wiki says enabling/disabling.
It also says that it updates the base model so all object of that type will change. Which I guess would mean I would have to make a new base object to have it only affect a single item.

hmm, I'll give it a try regardless and see what happens.
User avatar
Connie Thomas
 
Posts: 3362
Joined: Sun Nov 19, 2006 9:58 am

Previous

Return to IV - Oblivion