kraigor Posted September 29, 2008 Share Posted September 29, 2008 so you fixed it then?what exactly does this do? spawn an npc every 1 minute or something if it died ? Link to comment Share on other sites More sharing options...
Darkfirebird Posted September 30, 2008 Author Share Posted September 30, 2008 Now I cant get the Timer to work again -.- I tried a few different things but still got nada. Current Script with Debug. scn CMFSpawnerScript ref MySpawnref MySpawnerfloat Timerfloat Timer2short FadeAwayshort Respawnshort BeingRespawnedshort Deadshort DoOnce Begin GameMode set MySpawn to GetParentRef set MySpawner to GetSelf if MySpawn.GetDead == 1 && DoOnce == 0 ; This Creature or NPC has been killed. set Dead to 1 set DoOnce to 1 if CMFDebug == 1 Message "Dead: %.0f - DoOnce: %.0f" Dead DoOnce endif endif IF Respawn == 0 && Dead == 1 if Timer < 1 ;This Creature or NPC is still dead. set Timer to ( Timer + GetSecondsPassed ) if CMFDebug == 1 Message "Timer: %.0f" Timer endif endif if Timer >= 5 set FadeAway to 1 if CMFDebug == 1 Message "Timer: %.0f - FadeAway: %.0f" Timer FadeAway endif endif if Timer >= 5 && FadeAway == 1 MySpawn.disable MySpawn.MoveTo MySpawner 0 0 +10 set Timer2 to 5 set Respawn to 1 set FadeAway to 0 if CMFDebug == 1 Message "Timer: %.0f Timer2: %.0f Respawn: %.0f FadeAway: %.0f" Timer Timer2 Respawn FadeAway endif endif ENDIF IF Respawn == 1 if Timer2 > 0 set Timer2 to ( Timer2 - GetSecondsPassed ) if CMFDebug == 1 Message "Timer2: %.0f" Timer2 endif endif if Timer2 < 1 && BeingRespawned == 0 set BeingRespawned to 1 if CMFDebug == 1 Message "Timer2: %.0f BeingRespawned: %.0f" Timer2 BeingRespawned endif endif if Timer2 < 1 && BeingRespawned == 1 ;This Creature or NPC is being respawned MySpawn.resurrect MySpawn.enable set Dead to 0 set DoOnce to 0 set Timer to 0 set TImer2 to 0 set BeingRespawned to 0 if CMFDebug == 1 Message "Dead: %.0f DoOnce: %.0f Timer: %.0f Timer2: %.0f BeingRespawned: %.0f" Dead DoOnce Timer Timer2 BeingRespawned endif endif ENDIF End Link to comment Share on other sites More sharing options...
Darkfirebird Posted September 30, 2008 Author Share Posted September 30, 2008 so you fixed it then?what exactly does this do? spawn an npc every 1 minute or something if it died ? No not yet. Still bugging out on me. Its suppose to make the Spawned Creature / NPC spawn after 6 minutes or w/e I set the Timer to be. Its for a Mod I am working one. Such as Bosses wont spawn til after 30m etc Link to comment Share on other sites More sharing options...
kraigor Posted September 30, 2008 Share Posted September 30, 2008 i c cool tell me if you get it going i liek the idea ;) Link to comment Share on other sites More sharing options...
Darkfirebird Posted September 30, 2008 Author Share Posted September 30, 2008 i c cool tell me if you get it going i liek the idea ;)Will do. Currently rewriting the whole thing in a different way. MAYBE this way will make it run little more smoothly. Last one when I used a different debug redid the beginning soo many times... I actually saw the timer reach 1 >.> and thats it lol and a lot of fades going 0 1 0 1 0 1 Link to comment Share on other sites More sharing options...
Vagrant0 Posted September 30, 2008 Share Posted September 30, 2008 i c cool tell me if you get it going i liek the idea ;)Will do. Currently rewriting the whole thing in a different way. MAYBE this way will make it run little more smoothly. Last one when I used a different debug redid the beginning soo many times... I actually saw the timer reach 1 >.> and thats it lol and a lot of fades going 0 1 0 1 0 1Try using the altered script I posted on the last page as is. You keep switching around what you are setting things to, and keep changing the logic functions within the script, so naturally you will have a problem getting it to work right. Link to comment Share on other sites More sharing options...
Darkfirebird Posted September 30, 2008 Author Share Posted September 30, 2008 Made a new version and it works perfectly for my tests.Heres the script: scn CMFSpawnerScript2 ; Originally Created by Darkfirebird ( CMF ); Keep this intact, DO NOT USE WITHOUT PERMISSION!; Although I am sure I would say yes to anyone but still.; Description:; This script allows a TrigZone ( Which I used or a different Activator ) to respawn; A dead NPC or Creature it is linked to. ( ParentREF ) Timer1 is set to make the ; dead NPC / Creature 'disappear'. TimeCount1 allows the Timer1 to run properly; without being disturbed. Same goes for Timer2 and Timecount2, but Timer2 is set; to make the NPC resurrect and appear to respawn. ref MySpawnref MySpawnerfloat Timer1float Timer2short TimeCount1short TimeCount2short DoOnceshort Respawn Begin GameMode set MySpawn to GetParentRef ; The Creature / NPC set MySpawner to GetSelf ; The Spawn area, I used a TrigZone if MySpawn.GetDead == 1 && DoOnce == 0 ;The Creature / NPC Died set Timer1 to 5 ; Sets the time before the corpse disappears. set DoOnce to 1 ; Do not repeat this stependif if Timer1 >= 5 && DoOnce == 1 ;Timer1 Set Countdown set TimeCount1 to 1 ; Set TimeCount1 to start up the Countdown set DoOnce to 2 ; Do not repeat this stependif if TimeCount1 == 1 && DoOnce == 2 ;Start Countdown set Timer1 to ( Timer1 - GetSecondsPassed ) ; Timer1 Countdown; Does not need DoOnce as it cancels the Timer1 Countdownendif if TimeCount1 == 1 && Timer1 <= 0 && DoOnce == 2 ; The Creature / NPC has now disappeared MySpawn.disable ; Disables the NPC / Creature from sight. May need to change this up if Problems occur MySpawn.MoveTo MySpawner 0 0 +10 ; Move the corpse to the Original Spawn area set TimeCount1 to 0 ; No need for the Countdown anymore set Respawn to 1 ; Set Respawn script set DoOnce to 3 ; Do not repeatendif if Respawn == 1 && DoOnce == 3 ; Setup the Timer set Timer2 to 5 ; Duration before the Creature or NPC respawns set DoOnce to 4 ; Do not repeat this stependif if Timer2 >= 5 && DoOnce == 4 ; Setup the Countdown set TimeCount2 to 1 ; Starts up the Countdown set DoOnce to 5 ; Do not repeat this stependif if TimeCount2 == 1 && DoOnce == 5 ; Timer2 Countdown set Timer2 to ( Timer2 - GetSecondsPassed ) ; Timer2 Countdown; Does not need DoOnce as it cancels the Timer2 Countdownendif if TimeCount2 == 1 && Timer2 <= 0 && DoOnce == 5 ; Respawning the NPC / Creature MySpawn.resurrect ; Revive the dead NPC / Creature MySpawn.enable ; Enable the now alive NPC / Creature set TimeCount2 to 0 ; No need to keep this on still set Respawn to 0 ; Creature / NPC is now alive so reset to 0 set DoOnce to 0 ; Reset so if the Creature / NPC dies, repeats this processendif End Link to comment Share on other sites More sharing options...
Darkfirebird Posted September 30, 2008 Author Share Posted September 30, 2008 i c cool tell me if you get it going i liek the idea ;)Will do. Currently rewriting the whole thing in a different way. MAYBE this way will make it run little more smoothly. Last one when I used a different debug redid the beginning soo many times... I actually saw the timer reach 1 >.> and thats it lol and a lot of fades going 0 1 0 1 0 1Try using the altered script I posted on the last page as is. You keep switching around what you are setting things to, and keep changing the logic functions within the script, so naturally you will have a problem getting it to work right. I tried the altered script. It worked the 1st time but not the 2nd. The above post contains the newly rewritten script. I have tested it extensively with debugs ( didnt add them here ) and so far works perfectly. Although you did try helping me with the original script. I do give great thanks for all the assistance. It helped me understand Timers A LOT better. Hence I rewrote to whats above. Link to comment Share on other sites More sharing options...
Darkfirebird Posted September 30, 2008 Author Share Posted September 30, 2008 The 1st Script didnt have all the comments seeing i removed them by accident thinking they interfered at some points. This one has my Comments so I remember what most of it does :) :thanks: to all the help i received! Really helped me with timers a lot. I'll do some more testing to see how well it does in a large scale type of thing. Link to comment Share on other sites More sharing options...
Darkfirebird Posted September 30, 2008 Author Share Posted September 30, 2008 If you use Leveled Creature / NPC spawns. It wont work. The below script should be placed on the NPCs / Creatures. Change timers to what you need them to be: SCN CMFGeneralSpawnScript ; Originally Created by Darkfirebird ( CMF ); Keep this intact, DO NOT USE WITHOUT PERMISSION!; Although I am sure I would say yes to anyone but still.; Description:; This script allows a NPC or Creature to respawn where the NPC or Creature; it is linked to. ( ParentREF ) Timer1 is set to make the dead NPC / Creature ; 'disappear'. TimeCount1 allows the Timer1 to run properly without being; disturbed. Same goes for Timer2 and Timecount2, but Timer2 is set to; make the NPC resurrect and appear to respawn. ref MySpawnref MySpawnerfloat Timer1float Timer2short TimeCount1short TimeCount2short DoOnceshort Respawn Begin GameMode set MySpawn to GetSelf ; The Creature / NPC set MySpawner to GetParentRef ; The Spawn area, I used a TrigZone if MySpawn.GetDead == 1 && DoOnce == 0 ; The Creature / NPC Died set Timer1 to 5 ; Sets the time before the corpse disappears. set DoOnce to 1 ; Do not repeat this stependif if Timer1 >= 5 && DoOnce == 1 ; Timer1 Set Countdown set TimeCount1 to 1 ; Set TimeCount1 to start up the Countdown set DoOnce to 2 ; Do not repeat this stependif if TimeCount1 == 1 && DoOnce == 2 ; Start Countdown set Timer1 to ( Timer1 - GetSecondsPassed ) ; Timer1 Countdown; Does not need DoOnce as it cancels the Timer1 Countdownendif if TimeCount1 == 1 && Timer1 <= 0 && DoOnce == 2 ; The Creature / NPC has now disappeared MySpawn.disable ; Disables to dead corpse after set Timer1 MySpawn.MoveTo MySpawner 0 0 +10 ; Move the corpse to the spawner set TimeCount1 to 0 ; No need for the Countdown anymore set Respawn to 1 ; Set Respawn script set DoOnce to 3 ; Do not repeatendif if Respawn == 1 && DoOnce == 3 ; Setup the Timer set Timer2 to 5 ; Duration before the Creature or NPC respawns set DoOnce to 4 ; Do not repeat this stependif if Timer2 >= 5 && DoOnce == 4 ; Setup the Countdown set TimeCount2 to 1 ; Starts up the Countdown set DoOnce to 5 ; Do not repeat this stependif if TimeCount2 == 1 && DoOnce == 5 ; Timer2 Countdown set Timer2 to ( Timer2 - GetSecondsPassed ) ; Timer2 Countdown; Does not need DoOnce as it cancels the Timer2 Countdownendif if TimeCount2 == 1 && Timer2 <= 0 && DoOnce == 5 ; Respawning the NPC / Creature MySpawn.resurrect ; Revive the dead NPC / Creature MySpawn.enable ; enable the now alive body set TimeCount2 to 0 ; No need to keep this on still set Respawn to 0 ; Creature / NPC is now alive so reset to 0 set DoOnce to 0 ; Reset so if the Creature / NPC dies, repeats this processendif End If theres a problem contact me :) :thumbsup: EDIT: Fixxed script up a bit for GeneralSpawns. Be sure to change the timers :) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.