Script using GameHour

Post » Tue Jul 19, 2011 1:07 pm

Hi everyone.

Ok I need to build a script. The idea is to have a creature (a deer) spawn at a specific hour and go in a specific location.(a bit like the ghost quest near Bravil)
For the going part I will use a specific AI package that make a creature "wander" to a specific location.

Now for spawning script: here is the way I've done. Does it sound "solid" to you? or is there a simpler way

Float gamehourIfGetStageDone  DeerCaller 20 == 0 (DeerCaller is the name of the Quest so I can have the spawning stopped when the Quest is fullfilded)   If Gamehour >0 and gamehour < 5 (Note that the spawning happens between 0am and 5am)        Enable MADeerGhost        MADeerGhost Moveto StartingPointRef (StartingPointRef is an X marker)   Endif	   ElseIf Gameday  > 5      Move MADeerGhost to StoragePlaceRef (StoragePlaceRef is an X marker in a unused cell)      Disable MaDeerGhost   EndifEndifIfGetStageDone  DeerCaller 20 == 1   MADeerGhost  Moveto  StoragePlaceRef (StoragePlaceRef is an X marker in a unused cell)   Disable MaDeerGhostEndif


Thanks for your help guys.
User avatar
Amanda Furtado
 
Posts: 3454
Joined: Fri Dec 15, 2006 4:22 pm

Post » Tue Jul 19, 2011 3:18 pm

Good evening Guys,

Here is my latest script which I placed on a dagger...the problem is: the script does not work and the Boar does not spawn...
The script compile just fine but no spawn.

It's probably has to do with the On Add blocktype which I fear is not appropriate.

Should I place the script on the Boar instead with an other Blocktype and in this case which blocktypes should be appropriate?

Scn MASpectralBoarScriptFloat gamehourBegin OnAdd player	Setstage MABoarCaller 10	If GetStageDone  MABoarCaller 20 == 0    		If Gamehour >0			Elseif Gamehour < 5        			GhostBoarRef.Moveto BoarStartRef				GhostBoarRef.Enable   			Endif		Endif          		If Gamehour  > 5			GhostBoarRef.Disable      		GhostBoarRef.Moveto BoarStorageRef   		Endif	Endif	If GetStageDone  MABoarCaller 20 == 1   		GhostBoarRef.Moveto  BoarStorageRef   		GhostBoarRef.Disable	EndifEnd


Any help is welcome at this point
User avatar
Paul Rice
 
Posts: 3430
Joined: Thu Jun 14, 2007 11:51 am

Post » Tue Jul 19, 2011 7:33 am

1. OnAdd only runs one time and one time only. And it will only run when the dagger is 'added' to the players inventory.

2. You need to add a space after your condition checks.
If Gamehour >0

should be:
If Gamehour > 0


3. An 'ElseIf' in your "if gamehour > 0" condition is not an extra "if" check. So, you also have an extra "endif" on this block of code.
What you are doing is this:
if gamehour is greater than zero, then do nothing. Why? Because its the first true statement in the IF/ELSEIF/ELSE/ENDIF block of code. Your "elseif gamehour < 5" will never execute.
This would be a better solution since there is no reason to see if the gamehour is greater than zero:
   if Gamehour < 5      GhostBoarRef.Moveto BoarStartRef      GhostBoarRef.Enable   Endif

And you should probably put a resetable 'doOnce' check in there or you will constantly move the boar the the ref.
User avatar
Damien Mulvenna
 
Posts: 3498
Joined: Wed Jun 27, 2007 3:33 pm


Return to IV - Oblivion