Jump to content

Photo

Scripting Assistance

summoning item array target help multiple

  • Please log in to reply
12 replies to this topic

#11
Someone1

Someone1

    Journeyman

  • Members
  • Pip
  • 31 posts

Sinus and cosinus are my old archnemeses from math class, so I cannot help you with that.

 

It depends on what you want to do, obviously, but personally once I have more than 2-3 objects that need to be placed in a specific relative position, I'd rather combine them all into one nif. Makes positioning easier.

 

Well atleast you're honest lol. I do understand what you're saying about the nif though, but it won't work in my situation unfortuanetly

 

OnLoad on the explosion placed marker would be best. It will place the marker as an explosion invisibly where the spell lands, and as soon as it is placed/enabled/loaded, you can just move the object to it quite easily. As for the circle, you can just look up coding a circle around an object. Should be easily convertible to Papyrus.

I'll try the OnLoad and see how it goes. I already looked up a circle around object and what I have is the closest thing I can convert it to. I'm not sure if I have the math messed up or if the coding is messed up, if that makes sense. If you can find a sample code that's better than mine, let me know.

 

 

Edit 1:

Just an update if any future onlooker takes interest, the code that I was able to get working is posted below. Granted, with the radius of 600, you only get a semi circle with 32 instances of doors. Space between doors can be changed if needed, or more doors can be added too.

Scriptname _TeleportDoorMarkerScript extends ObjectReference

Door Property TeleportDoor Auto
Activator[] Property EffectSummonBanishFX Auto
ObjectReference[] Doors	

Event OnInit()
int i = 0
float orbitangle = 0;
float orbitradius = 600;
float cX =self.GetPositionX()
float cY =self.GetPositionY()
float cZ = self.GetPositionZ()
Doors = new ObjectReference[32]
While i <32
    ;Self.SetAngle(0.0,0.0, Game.GetPlayer().GetAngleZ() + 90)
    ;Self.PlaceAtMe(EffectSummonBanishFX[i])
	Doors[i]=Self.PlaceAtMe(TeleportDoor)
	;Doors[i].PlaceAtMe(TeleportDoor)
	Doors[i].Enable()	
	orbitangle += 360
	;Debug.MessageBox("The" + i +"X" + self.GetPositionX())
	;Debug.MessageBox("The" + i +"Y" + self.GetPositionY())
	float newX =orbitradius*math.cos(math.degreestoradians(orbitangle))
	float newY =orbitradius*math.sin(math.degreestoradians(orbitangle))
	;Debug.MessageBox("The X " + self.GetPositionX())
	;Debug.MessageBox("The " + i + " test " + test)
	;float x = cX + (orbitradius*math.cos(math.degreestoradians(orbitangle)));
	;float y = cY + (orbitradius*math.sin(math.degreestoradians(orbitangle)));
	;Debug.MessageBox("The new " + i +" x " + xtest)
	Doors[i].MoveTo(self,newX,newY,5,false)
	i+=1
EndWhile
 ;Self.DeleteWhenAble()
EndEvent

Disregard all of the semi colons, they were testing sections.

.


Edited by Someone1, 28 December 2015 - 08:15 AM.


#12
Someone1

Someone1

    Journeyman

  • Members
  • Pip
  • 31 posts

Quick easy question, hopefully.

 

Is there a good way when spawning multiple objects to have each of them face at a certain point.

For example I place a xmarker down in the center, then all the objects spawn around that center point, and then all of the objects will face that center point.

 

I thought I could just do it by using the GetAngleZ approach, but that quickly failed.

 

Any suggestions?

 

 

 

Edit 1: got it to work a lot easier than I imagined. Oddly enough, papyrus doesn't have a atan2 function but no worries, it has something better. The code below got all my objects to face the target regardless of where they were in the circle.

	NewAngle = Doors[i].GetHeadingAngle(self)
	Doors[i].SetAngle(0.0,0.0,NewAngle)	

.


Edited by Someone1, 29 December 2015 - 04:32 AM.


#13
Someone1

Someone1

    Journeyman

  • Members
  • Pip
  • 31 posts

Is there a (good/easy) was to make a object point at a reference point (via set angle maybe)? Say I have a door that I summon and I put it 100 meters away from me both in the X and Y plane but it also goes 100 meter up (z direction). I there a good way to have the door (any object for that mater)  face the reference point via setAngle or other command? (trying to avoid atan2 if possible)

 

for future onlookers, I found a decent way out to achieve what I wanted. The code is below, comment or message if there are any questions, but the code below is obviously not cleaned up so disregard that

Weapon Property CircleWeapon Auto
Activator[] Property EffectSummonBanishFX Auto
ObjectReference[] Doors
ObjectReference[] Doors2		

Event OnInit()
int i = 1
int f = 1
int orbitangle = 0;
int orbitradius = 1000;
float cX =self.GetPositionX()
float cY =self.GetPositionY()
float cZ = self.GetPositionZ()
Doors = new ObjectReference[125]
Doors2 = new ObjectReference[125]
float NewAngle = 0
int highth = 10
float RollAngleX
float RollAngleY


While f < 20
	if f < 20
	orbitradius=orbitradius - 50
	highth = highth + 50
	else
	orbitradius=orbitradius
	highth = highth
	endif
While i < 64
    ;Self.SetAngle(0.0,0.0, self.GetAngleZ())
    ;Self.PlaceAtMe(EffectSummonBanishFX[i])
	Doors[i]=Self.PlaceAtMe(CircleWeapon)
	;Doors[i].PlaceAtMe(CircleWeapon)
	Doors[i].Enable()	
	orbitangle += 360
	float newX =orbitradius*math.cos(math.degreestoradians(orbitangle))
	float newY =orbitradius*math.sin(math.degreestoradians(orbitangle))
	
	
	Doors[i].MoveTo(self,newX,newY,highth,false)
	NewAngle = Doors[i].GetHeadingAngle(self)

	float PosDifferenceZ = ((self.GetPositionZ()) - (Doors[i].GetPositionZ()))
	float PosDifferenceY = ((self.GetPositionY()) - (Doors[i].GetPositionY()))
	float PosDifferenceX = ((self.GetPositionX()) - (Doors[i].GetPositionX()))
	
	float xandy = math.sqrt(math.pow(math.abs(PosDifferenceX),2.0) + math.pow(math.abs(PosDifferenceY),2.0))
	float angleneeded = math.atan(math.abs(PosDifferenceZ)/xandy)
	float LocalX =angleneeded
	float LocalY =0
	float LocalZ =NewAngle
	float AngleX = LocalX * Math.Cos(LocalZ) + LocalY * Math.Sin(LocalZ)
	float AngleY = LocalY * Math.Cos(LocalZ) - LocalX * Math.Sin(LocalZ
	Doors[i].SetAngle(AngleX,AngleY,NewAngle)
	
	i+=1
EndWhile
	f+=1
	i = 0
EndWhile
 ;Self.DeleteWhenAble()
EndEvent





Edited by Someone1, 06 January 2016 - 09:22 AM.






Also tagged with one or more of these keywords: summoning, item, array, target, help, multiple

IPB skins by Skinbox
Page loaded in: 1.254 seconds