It can only wire to Wire entities, which all have the same inputs. Every Wire Turret has a Fire input, every Wire Prop Spawner has a Spawn and Undo input, for example.
Quick code check folks while I toil away with the body part filter.[highlight=E2]if(BCheck){
E = Props:entity(Check)
if(!E:isFrozen() & !E:hasConstraints()){ #Not constrained/frozen
Box = E:boxSize()
L = Box:x() #Prop length
W = Box:y() #Prop width
H = Box:z() #Prop height
Bod = Body:vector(Pierre)
BX = Bod:x() #Body length
BY = Bod:y() #Body width
BZ = Bod:z() #Body height
#Checking if the prop has lengths in the right ranges
if(L < BX+GT & L > BX-GT){Pos++}
if(W < BY+GT & W > BY-GT){Pos++}
if(H < BZ+GT & H > BZ-GT){Pos++}
#If the entity exists, the prop gets ++ if the ID is different
#If the entity doesn't exist, the prop gets ++ by default
if(Skull){ #Check against Skull ID
if(E:id() !=Skull:id()){Pos += (1/7)}}
else{Pos += (1/7)}
if(Torso){ #Check against Torso ID
if(E:id() !=Torso:id()){Pos += (1/7)}}
else{Pos += (1/7)}
if(Pelvis){ #Check against Pelvis ID
if(E:id() !=Pelvis:id()){Pos += (1/7)}}
else{Pos += (1/7)}
if(Arm1){ #Check against Arm1 ID
if(E:id() !=Arm1:id()){Pos += (1/7)}}
else{Pos += (1/7)}
if(Arm2){ #Check against Arm2 ID
if(E:id() !=Arm2:id()){Pos += (1/7)}}
else{Pos += (1/7)}
if(Leg1){ #Check against Leg1 ID
if(E:id() !=Leg1:id()){Pos += (1/7)}}
else{Pos += (1/7)}
if(Leg2){ #Check against Leg2 ID
if(E:id() !=Leg2:id()){Pos += (1/7)}}
else{Pos += (1/7)}
#If the entity meets criteria, it gets assigned as per Pierre
if(Pos == 4){
if(Pierre == 2){
Skull = E
SiD = E:id()}
Colors:setVector(2,Skull:getColor())
Skull:setMaterial(Skins:string(Pierre))
}
elseif(Pierre == 3){
Torso = E
TiD = E:id()
Colors:setVector(3,Torso:getColor())
Torso:setMaterial(Skins:string(Pierre))
}
elseif(Pierre == 4){
Pelvis = E
PiD = E:id()
Colors:setVector(4,Pelvis:getColor())
Pelvis:setMaterial(Skins:string(Pierre))
}
elseif(Pierre == 5){
Arm1 = E
A1iD = E:id()
Colors:setVector(4,Arm1:getColor())
Arm1:setMaterial(Skins:string(Pierre))
}
elseif(Pierre == 6){
Arm2 = E
A2iD = E:id()
Colors:setVector(5,Arm2:getColor())
Arm2:setMaterial(Skins:string(4))
}
elseif(Pierre == 7){
Leg1 = E
L1iD = E:id()
Colors:setVector(6,Leg1:getColor())
Leg1:setMaterial(Skins:string(Pierre))
}
elseif(Pierre == 8){
Leg2 = E
L2iD = E:id()
Colors:setVector(7,Leg2:getColor())
Leg2:setMaterial(Skins:string(Pierre))
}
Pos = 0
Check = 0
BCheck = 0
}
else{
Pos = 0
if(Check != Props:count()){Check++}
else{Check = 0,BCheck = 0}
}
else{Check++}
}[/highlight]Apparently there's an improperly-placed or missing "}" bracket here, because the validation says that the last else needs to be part of an if statement, but I've been looking over it for a little while now and I can't find it anywhere.
The Feint subroutine will function much like the Stealth subroutine, except it'll turn the Motion controls for the body props off and only stealth the E2 chip.
And something actually useful: The Stealth subroutine.[highlight=E2]if(Stealth)
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial("models/shiny")
Part:setColor(0,0,0,0)
SMark = 1}
else{
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark++
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(Mark))
Part:setColor(Colors:vector(Mark),255)
SMark = 1}[/highlight]I'm thinking of changing the active section to a looping sequence that randomises the actual colour (Not the alpha), so they opponents can't just have an auto-turret look for anything black and invisible. 255x255x255 equates to about 16.5 million possible colours (~4,230.25 million if you include alpha, but that would defeat the stealth aspect).
EDIT: And so I did[highlight=E2]#Stealth subroutine
if(Stealth){
timer("stealth",10)
if(clk("stealth")){
X = round(random(0,255))
Y = round(random(0,255))
Z = round(random(0,255))
Col = vec(X,Y,Z)
Part = Bparts:entity(Mark)
if(Part:getMaterial() != "models/shiny"){Part:setMaterial("models/shiny")}
Part:setColor(Col,0)
if(Smark != Bparts:count()){Smark++}
else{Smark = 1,DSmark = 1}}
else{ #Aka the Destealth subroutine
timer("destealth",10)
if(clk("destealth")){
Part = Bparts:entity(Mark)
Part:setMaterial(Skins:string(DSmark))
Part:setColor(Colors:vector(DSmark),255)
if(DSmark != Bparts:count()){DSmark++}
else{DSmark = 1,Smark = 1,stoptimer("destealth")}}}[/highlight]New variables: Stealth, Smark, DSmark
Last edited by Lyinginbedmon; 06-23-2009 at 03:08 AM.
If the Skull entity is true, then it only gets the +1/7 if it's ID is not the same as the Skull entity's ID. If the Skull entity is false, then by default the ID is not the same as the Skull ID.
Note that the first line of that quoted code chunk ends in a pair of curly brackets, you snipped off the first If statement
That whole segment was rewritten that way so I could be 100% certain it wasn't the part that was messing up the code.
Personally I find[highlight=E2]if(Skull){
if(E:id() != Skull:id()){Pos += (1/7)}}
else{Pos += (1/7)}[/highlight]to be easier to read. Either way I can easily cut that whole chunk back once I'm certain it's not interfering with the filtration process.
Trying to get the animation on the road; still needs some time apparently. My first tests with scaling the drone up/down depending on the props it has look good, though
The arms look a bit weird since the same orientation puts the longest dimension in a different direction, but otherwise it's matching quite well.
I can wire anything directly into anything! I'm the Professor!
-Professor Hubert Farnsworth
I've noticed the orientation of that method is a bit lackadaisical, which is probably due to a low multiplier in the offset code.
I know it exists so does anyone know the formula for finding the right multiplier for a given mass value? Presumably it exists in a god chair or anti-grav field code but I've yet to find one with the code readily available for perusal.
Hmm...as far as Superllama goes in this thread, it's simply E:mass(), but to get rapidly responsive action on a red cargo container I had to use 80,000 and it's mass is only 10,000 so that seems fairly cavalier.
Additionally: Your current base orientation code has all the props at a 90-degree angle and several units away from the orienting chip. Ideally it should orient from the Skull prop (Or it's hypothetical position) so that the chip is free to do what it needs to.
Last edited by Lyinginbedmon; 06-23-2009 at 06:52 AM.
Which would make sense, but it flies counter to the god chair equation of just E:mass()
I've also been doing some work on the standard hurl-body-parts-at-it-until-it-dies code and I've come to the conclusion that we'll definitely need flipswitch variables to disable and enable the standard body positioning as regards each individual body part.
From what I've heard you should always be using inertia and not mass to adjust the force. Not sure about how, though. What I usually do is just play with multiplying my base vector and dividing the velocity.
I'm quite interested in your angle modifying code, Magos. I have looked over it some and I'm wondering if you know of an easy way to force certain angles? I have gotten my own applyOffsetForce code to follow the angles of my view or another prop, but I still haven't found a good way to lock a rotational axis at a set angle or just to stop it from moving around.
Bookmarks