Jump to content

Enslave Scripted Spell


darkneon

Recommended Posts

The spell basicly moves the actor to a cell leaving a rat marker in it's place

Using modded wrist irons (called aaSlaveToken) it reads if the actor is already a slave

(-Fixed-)

if the actor is wearing the wrist irons, the rat returns to its cage and the actor to it's former place.

(still going wrong)

The player can only hold one slave at the time so when he casts the spell on someone else, his former slave returns, the rat takes the place of the new slave and the new slave takes the place of the former slave.

 

The new problem is that when the player casts the spell on a actor, while having a slave, the former slave doesn't return to it's place, and the spell only affects one of the enslaved actors

 

New code!

scn aaEnslaveScript

short Slaves
ref SlaveRef

begin ScriptEffectStart
if (getItemCount aaSlaveToken != 1)
	if (Slaves == 0)
		set Slaves to 1
		set SlaveRef to GetSelf
		RemoveAllItems aaLoveChestRef
		AddItem aaSlaveToken 1
		EquipItem aaSlaveToken
		TPRatRef.MoveTo SlaveRef
		MoveTo BottleExit
		SetRestrained 1
	Else
		SlaveRef.SetRestrained 0
		aaLoveChestRef.RemoveAllItems SlaveRef
		SlaveRef.RemoveItem aaSlaveToken 1
		SlaveRef.MoveTo TPRatRef
		SlaveRef.EvaluatePackage
		set SlaveRef to GetSelf
		RemoveAllItems aaLoveChestRef
		AddItem aaSlaveToken 1
		EquipItem aaSlaveToken
		TPRatRef.MoveTo SlaveRef
		MoveTo BottleExit
		SetRestrained 1
	EndIf
Else
	SlaveRef.SetRestrained 0
	aaLoveChestRef.RemoveAllItems SlaveRef
	SlaveRef.RemoveItem aaSlaveToken 1
	SlaveRef.MoveTo TPRatRef
	SlaveRef.EvaluatePackage
	TPRatRef.MoveTo aaRatCageRef 0 0 10
EndIf
End

Link to comment
Share on other sites

if (Slaves == 0)

set Slaves to 1

 

where's the command to set Slaves back to 0?

After the first cast it will remain at 1

 

oops, my bad, fixed that.

but i think the problem should be here somewhere:

	Else
		SlaveRef.SetRestrained 0
		aaLoveChestRef.RemoveAllItems SlaveRef
		SlaveRef.RemoveItem aaSlaveToken 1
		SlaveRef.MoveTo TPRatRef
		SlaveRef.EvaluatePackage
		set SlaveRef to GetSelf
		RemoveAllItems aaLoveChestRef
		AddItem aaSlaveToken 1
		EquipItem aaSlaveToken
		TPRatRef.MoveTo SlaveRef
		MoveTo BottleExit
		SetRestrained 1

Link to comment
Share on other sites

Before moving anything it is always best to disable it first.

 

You also need to add references to some of your other commands.

 

 

SlaveRef.RemoveAllItems aaLoveChestRef

SlaveRef.AddItem aaSlaveToken 1

SlaveRef.EquipItem aaSlaveToken

 

TPRatRef.Disable

TPRatRef.MoveTo SlaveRef

; TPRatRef.Enable ;------------- DO not Enable the Marker RAT!!!!!!! (I always leave this remarked out line there as a reminder)

 

SlaveRef.Disable

SlaveRef.MoveTo BottleExit

SlaveRef.Enable

Link to comment
Share on other sites

The problem is probably that MoveTo acts as a return call, causing script processing to jump back to the top of the script. To illustrate:

If SomeCondition == 1
  Set Ref to GetSelf
  Self.MoveTo MarkerRef
  Set SomeCondition to 1   ;<- This line would never run, causing the if statement to never become false, the ref being move over and over etc.
EndIf

Link to comment
Share on other sites

  • Recently Browsing   0 members

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