Jump to content

My script seems to cause CTDs...


ArcticZero

Recommended Posts

ScriptName aaAutoEquipGear

short DoOnce
short equipDelay

Begin GameMode

if (Player.GetEquipped AaaHSSaintWhGold == 1)
if(DoOnce != 1)
	if(Player.GetItemCount asgothtrenchtop01weap <= 0)
		message " "
		message " "
		Player.AddItem asgothtrenchtop01weap 1
	endif
	
	message " "
	message " "
	Player.EquipItem asgothtrenchskirt01
	Player.EquipItem asgothtrenchtop01weap
	
	if(Player.GetItemCount asgothtrenchskirt01weap > 0)
		message " "
		message " "
		Player.RemoveItem asgothtrenchskirt01weap 1
	endif

	set DoOnce to 1
endif
endif

if (Player.GetEquipped Realmasamune == 1)
if(DoOnce !=2)
	if(Player.GetItemCount asgothtrenchskirt01weap <= 0)
		message " "
		message " "
		Player.AddItem asgothtrenchskirt01weap 1
	endif

	message " "
	message " "
	Player.EquipItem asgothtrenchtop01
	Player.EquipItem asgothtrenchskirt01weap

	if(Player.GetItemCount asgothtrenchtop01weap > 0)
		message " "
		message " "
		Player.RemoveItem asgothtrenchtop01weap 1
	endif

	set DoOnce to 2
endif
endif

if (Player.GetEquipped AaaHSSaintWhGold != 1)
if(Player.GetEquipped Realmasamune != 1)
	if(DoOnce != 3)
		if(Player.GetItemCount asgothtrenchtop01weap <= 0)
			message " "
			message " "
			Player.AddItem asgothtrenchtop01weap 1
		endif

		if(Player.GetItemCount asgothtrenchskirt01weap <= 0)
			message " "
			message " "
			Player.AddItem asgothtrenchskirt01weap 1
		endif

		message " "
		message " "
		Player.EquipItem asgothtrenchskirt01weap
		Player.EquipItem asgothtrenchtop01weap

		set DoOnce to 3
	endif
endif
endif
End

 

All of the items referenced are in place. The script basically equips the right set of clothes (one set containing weapon scabbard meshes built into them) depending on which weapon my character has equipped. And when unarmed, it equips both pieces of clothing to make it appear as if both weapons are still out.

 

Something here is causing Oblivion to CTD, and I know how to trigger it. Basically I have to make a save game where I'm unarmed. Both of my character's weapons (Realmasamune and AaaHSSaintWhGold) are hotkeyed to 1 and 2 respectively. Once the save game loads, I hit 1 then 2, or 2 then 1. This basically equips one weapon from being unarmed, triggering the clothing change script. After that, it swaps that weapon out for the other one, triggering the script again. That causes a CTD. To avoid that while using an unarmed save game, I have to press 1, 1, 2...or 2, 2, 1. This equips one weapon, then de-equips it, and equips the other weapon instead. From there on I can hit the hotkey of the other weapon with no issues. I'm a newbie scripter, and pretty much everything up there is the fruit of reading various tutorials on Oblivion scripting... :P

 

I hope you guys can help me out again... I do apologize for having so many questions, but don't worry, I can learn fast if I have to.. Thanks a lot! :)

 

Btw, concerning the nested "if" statements instead of one complex one...that was just me trying out a tip concerning "and" clauses and crashes from here:

 

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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