ichigo5959 Posted September 25, 2010 Share Posted September 25, 2010 I'm trying to create a weapon that changes depending on the time of day like Dawn/Duskfang but I seem to be having scripting troubles, even though my script is simpler than the one for Dawn/Duskfang because it doesn't have leveled versions I want to know how to fix the script.Here's the main script [My Version] scn MMTsaesciBladeScript ;DawnfangScript related;DuskfangScript related short Ruinblade ;This is the trigger variable to make the change (sets off the gamemode block) to Dawnfangshort Unruinblade ;This is the trigger variable to make the change (sets off the gamemode block) to Duskfangshort Exchange ;This is a DoOnce variable that is set after the change then reset in the timing blocksshort Daytime ;This is a DoOnce variable for the timing block in the daytime modeshort Dusktime ;This is a DoOnce variable for the timing block in the evening modeshort Test ;This is a DoOnce variable for the original rewarding of the weapon float fQuestDelayTime begin gamemode ;These blocks determine when the blades will "change form" if ( Daytime == 0 ) if ( Gamehour >= 6 ) && ( Gamehour < 18 ) Set Dusktime to 0 Set Exchange to 0 Set Unruinblade to 0 Set Ruinblade to 1 Set Daytime to 1 endif endif if ( Dusktime == 0 ) if ( Gamehour >= 18 ) || ( Gamehour < 6 ) Set Daytime to 0 Set Exchange to 0 Set Ruinblade to 0 Set Unruinblade to 1 Set Dusktime to 1 endif endif ;These blocks handle the actual exchange. Because we don't know what type of blade (level) the player will have, we test for all of them. if ( Ruinblade == 1 ) if ( Player.IsInCombat == 0 ) && Player.IsRidingHorse == 0 if ( Exchange == 0 ) if ( Player.GetItemCount MMRuindbladesun == 1 ) if ( MMRuinedswordunkills < 12 ) Player.Additem MMRuindblades 1 Player.Removeitem MMRuindbladesun 1 Set Exchange to 1 endif endif endif endif endif if ( Unruinblade == 1 ) if ( Player.IsInCombat == 0 ) && Player.IsRidingHorse == 0 if ( Exchange == 0 ) if ( Player.GetItemCount MMRuindblades == 1 ) if ( MMRuinedswordKills < 12 ) Player.Additem MMRuindbladesun 1 Player.Removeitem MMRuindblades 1 Set Exchange to 1 endif endif endif endif endif end and here's the origional: scn SE03TsaesciBladeScript ;DawnfangScript related;DuskfangScript related short Dawnblade ;This is the trigger variable to make the change (sets off the gamemode block) to Dawnfangshort Duskblade ;This is the trigger variable to make the change (sets off the gamemode block) to Duskfangshort Exchange ;This is a DoOnce variable that is set after the change then reset in the timing blocksshort Daytime ;This is a DoOnce variable for the timing block in the daytime modeshort Dusktime ;This is a DoOnce variable for the timing block in the evening modeshort Test ;This is a DoOnce variable for the original rewarding of the weaponshort Reward ;This is a trigger variable for the original rewarding of the weapon from Kiliban in SE03 float fQuestDelayTime begin gamemode ;These blocks determine when the blades will "change form" if ( Daytime == 0 ) if ( Gamehour >= 6 ) && ( Gamehour < 18 ) Set Dusktime to 0 Set Exchange to 0 Set Duskblade to 0 Set Dawnblade to 1 Set Daytime to 1 endif endif if ( Dusktime == 0 ) if ( Gamehour >= 18 ) || ( Gamehour < 6 ) Set Daytime to 0 Set Exchange to 0 Set Dawnblade to 0 Set Duskblade to 1 Set Dusktime to 1 endif endif ;These blocks handle the actual exchange. Because we don't know what type of blade (level) the player will have, we test for all of them. if ( Dawnblade == 1 ) if ( Player.IsInCombat == 0 ) && Player.IsRidingHorse == 0 if ( Exchange == 0 ) if ( Player.GetItemCount SE03Duskfang01 == 1 ) || ( Player.GetItemCount SE03DuskFang01A == 1 ) if ( SESwordDuskfangKills < 12 ) Player.Additem SE03Dawnfang01 1 Player.Removeitem SE03Duskfang01 1 Player.Removeitem SE03Duskfang01A 1 Set Exchange to 1 else Player.Additem SE03Dawnfang01A 1 Player.Removeitem SE03Duskfang01 1 Player.Removeitem SE03Duskfang01A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Duskfang05 == 1 ) || ( Player.GetItemCount SE03DuskFang05A == 1 ) if ( SESwordDuskfangKills < 12 ) Player.Additem SE03Dawnfang05 1 Player.Removeitem SE03Duskfang05 1 Player.Removeitem SE03Duskfang05A 1 Set Exchange to 1 else Player.Additem SE03Dawnfang05A 1 Player.Removeitem SE03Duskfang05 1 Player.Removeitem SE03Duskfang05A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Duskfang10 == 1 ) || ( Player.GetItemCount SE03DuskFang10A == 1 ) if ( SESwordDuskfangKills < 12 ) Player.Additem SE03Dawnfang10 1 Player.Removeitem SE03Duskfang10 1 Player.Removeitem SE03Duskfang10A 1 Set Exchange to 1 else Player.Additem SE03Dawnfang10A 1 Player.Removeitem SE03Duskfang10 1 Player.Removeitem SE03Duskfang10A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Duskfang15 == 1 ) || ( Player.GetItemCount SE03DuskFang15A == 1 ) if ( SESwordDuskfangKills < 12 ) Player.Additem SE03Dawnfang15 1 Player.Removeitem SE03Duskfang15 1 Player.Removeitem SE03Duskfang15A 1 Set Exchange to 1 else Player.Additem SE03Dawnfang15A 1 Player.Removeitem SE03Duskfang15 1 Player.Removeitem SE03Duskfang15A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Duskfang20 == 1 ) || ( Player.GetItemCount SE03DuskFang20A == 1 ) if ( SESwordDuskfangKills < 12 ) Player.Additem SE03Dawnfang20 1 Player.Removeitem SE03Duskfang20 1 Player.Removeitem SE03Duskfang20A 1 Set Exchange to 1 else Player.Additem SE03Dawnfang20A 1 Player.Removeitem SE03Duskfang20 1 Player.Removeitem SE03Duskfang20A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Duskfang25 == 1 ) || ( Player.GetItemCount SE03DuskFang25A == 1 ) if ( SESwordDuskfangKills < 12 ) Player.Additem SE03Dawnfang25 1 Player.Removeitem SE03Duskfang25 1 Player.Removeitem SE03Duskfang25A 1 Set Exchange to 1 else Player.Additem SE03Dawnfang25A 1 Player.Removeitem SE03Duskfang25 1 Player.Removeitem SE03Duskfang25A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Duskfang30 == 1 ) || ( Player.GetItemCount SE03DuskFang30A == 1 ) if ( SESwordDuskfangKills < 12 ) Player.Additem SE03Dawnfang30 1 Player.Removeitem SE03Duskfang30 1 Player.Removeitem SE03Duskfang30A 1 Set Exchange to 1 else Player.Additem SE03Dawnfang30A 1 Player.Removeitem SE03Duskfang30 1 Player.Removeitem SE03Duskfang30A 1 Set Exchange to 1 endif endif endif endif endif if ( Duskblade == 1 ) if ( Player.IsInCombat == 0 ) && Player.IsRidingHorse == 0 if ( Exchange == 0 ) if ( Player.GetItemCount SE03Dawnfang01 == 1 ) || ( Player.GetItemCount SE03Dawnfang01A == 1 ) if ( SESwordDawnfangKills < 12 ) Player.Additem SE03Duskfang01 1 Player.Removeitem SE03Dawnfang01 1 Player.Removeitem SE03Dawnfang01A 1 Set Exchange to 1 else Player.Additem SE03Duskfang01A 1 Player.Removeitem SE03Dawnfang01 1 Player.Removeitem SE03Dawnfang01A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Dawnfang05 == 1 ) || ( Player.GetItemCount SE03Dawnfang05A == 1 ) if ( SESwordDawnfangKills < 12 ) Player.Additem SE03Duskfang05 1 Player.Removeitem SE03Dawnfang05 1 Player.Removeitem SE03Dawnfang05A 1 Set Exchange to 1 else Player.Additem SE03Duskfang05A 1 Player.Removeitem SE03Dawnfang05 1 Player.Removeitem SE03Dawnfang05A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Dawnfang10 == 1 ) || ( Player.GetItemCount SE03Dawnfang10A == 1 ) if ( SESwordDawnfangKills < 12 ) Player.Additem SE03Duskfang10 1 Player.Removeitem SE03Dawnfang10 1 Player.Removeitem SE03Dawnfang10A 1 Set Exchange to 1 else Player.Additem SE03Duskfang10A 1 Player.Removeitem SE03Dawnfang10 1 Player.Removeitem SE03Dawnfang10A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Dawnfang15 == 1 ) || ( Player.GetItemCount SE03Dawnfang15A == 1 ) if ( SESwordDawnfangKills < 12 ) Player.Additem SE03Duskfang15 1 Player.Removeitem SE03Dawnfang15 1 Player.Removeitem SE03Dawnfang15A 1 Set Exchange to 1 else Player.Additem SE03Duskfang15A 1 Player.Removeitem SE03Dawnfang15 1 Player.Removeitem SE03Dawnfang15A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Dawnfang20 == 1 ) || ( Player.GetItemCount SE03Dawnfang20A == 1 ) if ( SESwordDawnfangKills < 12 ) Player.Additem SE03Duskfang20 1 Player.Removeitem SE03Dawnfang20 1 Player.Removeitem SE03Dawnfang20A 1 Set Exchange to 1 else Player.Additem SE03Duskfang20A 1 Player.Removeitem SE03Dawnfang20 1 Player.Removeitem SE03Dawnfang20A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Dawnfang25 == 1 ) || ( Player.GetItemCount SE03Dawnfang25A == 1 ) if ( SESwordDawnfangKills < 12 ) Player.Additem SE03Duskfang25 1 Player.Removeitem SE03Dawnfang25 1 Player.Removeitem SE03Dawnfang25A 1 Set Exchange to 1 else Player.Additem SE03Duskfang25A 1 Player.Removeitem SE03Dawnfang25 1 Player.Removeitem SE03Dawnfang25A 1 Set Exchange to 1 endif elseif ( Player.GetItemCount SE03Dawnfang30 == 1 ) || ( Player.GetItemCount SE03Dawnfang30A == 1 ) if ( SESwordDawnfangKills < 12 ) Player.Additem SE03Duskfang30 1 Player.Removeitem SE03Dawnfang30 1 Player.Removeitem SE03Dawnfang30A 1 Set Exchange to 1 else Player.Additem SE03Duskfang30A 1 Player.Removeitem SE03Dawnfang30 1 Player.Removeitem SE03Dawnfang30A 1 Set Exchange to 1 endif endif endif endif endif end I also created my own version of the Generic Dawn/Duskfang scripts:My version:(Previously Duskfang) scn MMRuindbladesunScript ;related to MMRuinedbladesScript short ShouldEquip ;This variable is a flag if the weapon was previously equipped for use when the weapons swap ;This block resets the global variable SESwordDawnfangKills(MMRuinedbladesun) and sets the should equip flag if the previous weapon was equipped begin OnAdd Player Set MMRuinedswordunKills to 0 if ( MMRuinedbladesEquip == 1 ) Set ShouldEquip to 1 Set MMRuinedbladesEquip to 0 endif end ;This block sets the equip flag upon equip of this weapon, the second block does the opposite begin OnEquip Player if ( MMRuinedbladesunEquip < 1 ) Set MMRuinedbladesunEquip to 1 endif end begin OnUnEquip Player if ( MMRuinedbladesunEquip > 0 ) Set MMRuinedbladesunEquip to 0 endif end ;This block auto-equips the weapon if the should equip flag was set to 1.. it equips the entire list, as we don't know which one the player has begin gamemode if ( ShouldEquip == 1 ) Player.EquipItem MMRuindbladesun Set MMRuinedbladesunEquip to 1 Set ShouldEquip to 0 endif end Previously Dawnfangscn MMRuinedbladesScript ;related to MMRuinedbladesunScript short ShouldEquip ;This variable is a flag if the weapon was previously equipped for use when the weapons swap ;This block resets the global variable SESwordDawnfangKills(MMRuinedblades) and sets the should equip flag if the previous weapon was equipped begin OnAdd Player Set MMRuinedswordKills to 0 if ( MMRuinedbladesunEquip == 1 ) Set ShouldEquip to 1 Set MMRuinedbladesunEquip to 0 endif end ;This block sets the equip flag upon equip of this weapon, the second block does the opposite begin OnEquip Player if ( MMRuinedbladesEquip < 1 ) Set MMRuinedbladesEquip to 1 endif end begin OnUnEquip Player if ( MMRuinedbladesEquip > 0 ) Set MMRuinedbladesEquip to 0 endif end ;This block auto-equips the weapon if the should equip flag was set to 1.. it equips the entire list, as we don't know which one the player has begin gamemode if ( ShouldEquip == 1 ) Player.EquipItem MMRuindblades Set MMRuinedbladesEquip to 1 Set ShouldEquip to 0 endif end Origional Duskfang: scn DuskfangScript ;related to DawnfangScript short ShouldEquip ;This variable is a flag if the weapon was previously equipped for use when the weapons swap ;This block resets the global variable SESwordDawnfangKills and sets the should equip flag if the previous weapon was equipped begin OnAdd Player Set SESwordDuskfangKills to 0 if ( SESwordDawnfangEquip == 1 ) Set ShouldEquip to 1 Set SESwordDawnfangEquip to 0 endif end ;This block sets the equip flag upon equip of this weapon, the second block does the opposite begin OnEquip Player if ( SESwordDuskfangEquip < 1 ) Set SESwordDuskfangEquip to 1 endif end begin OnUnEquip Player if ( SESwordDuskfangEquip > 0 ) Set SESwordDuskfangEquip to 0 endif end ;This block auto-equips the weapon if the should equip flag was set to 1.. it equips the entire list, as we don't know which one the player has begin gamemode if ( ShouldEquip == 1 ) Player.EquipItem SE03Duskfang01 Player.EquipItem SE03Duskfang05 Player.EquipItem SE03Duskfang10 Player.EquipItem SE03Duskfang15 Player.EquipItem SE03Duskfang20 Player.EquipItem SE03Duskfang25 Player.EquipItem SE03Duskfang30 Player.EquipItem SE03Duskfang01A Player.EquipItem SE03Duskfang05A Player.EquipItem SE03Duskfang10A Player.EquipItem SE03Duskfang15A Player.EquipItem SE03Duskfang20A Player.EquipItem SE03Duskfang25A Player.EquipItem SE03Duskfang30A Set SESwordDuskfangEquip to 1 Set ShouldEquip to 0 endif end Dawnfang: scn DawnfangScript ;related to DuskfangScript short ShouldEquip ;This variable is a flag if the weapon was previously equipped for use when the weapons swap ;This block resets the global variable SESwordDawnfangKills and sets the should equip flag if the previous weapon was equipped begin OnAdd Player Set SESwordDawnfangKills to 0 if ( SESwordDuskfangEquip == 1 ) Set ShouldEquip to 1 Set SESwordDuskfangEquip to 0 endif end ;This block sets the equip flag upon equip of this weapon, the second block does the opposite begin OnEquip Player if ( SESwordDawnfangEquip < 1 ) Set SESwordDawnfangEquip to 1 endif end begin OnUnEquip Player if ( SESwordDawnfangEquip > 0 ) Set SESwordDawnfangEquip to 0 endif end ;This block auto-equips the weapon if the should equip flag was set to 1.. it equips the entire list, as we don't know which one the player has begin gamemode if ( ShouldEquip == 1 ) Player.EquipItem SE03Dawnfang01 Player.EquipItem SE03Dawnfang05 Player.EquipItem SE03Dawnfang10 Player.EquipItem SE03Dawnfang15 Player.EquipItem SE03Dawnfang20 Player.EquipItem SE03Dawnfang25 Player.EquipItem SE03Dawnfang30 Player.EquipItem SE03Dawnfang01A Player.EquipItem SE03Dawnfang05A Player.EquipItem SE03Dawnfang10A Player.EquipItem SE03Dawnfang15A Player.EquipItem SE03Dawnfang20A Player.EquipItem SE03Dawnfang25A Player.EquipItem SE03Dawnfang30A Set SESwordDawnfangEquip to 1 Set ShouldEquip to 0 endif end For the variables I copied the ones they had and re-named them to fit my weapons. Link to comment Share on other sites More sharing options...
Recommended Posts