Okay, so I can't for the life of me figure out why it wont work. Heres the code:
Its picking up the player name correctly, but the find function wont work. It refuses to find anything =/Code:@name Text Parse Test @inputs @outputs Player:string Tpos:vector Target:entity @persist Target:entity PlayerTest:string interval(10) if((lastSaid():find("Give Cube"))){ Player = lastSaid():sub(10, 20) } if(!Target){ findPlayerByName(Player) Target = find()} Tpos = Target:pos()
Any ideas?
You can't use $Target, it's an entity, it should be "~".
And $Target wouldn't work either way, input deltas are always non-zero.
Anyway, same as always, add some outputs to make sure you properly got an entity, output when it finds something, etc, etc, etc.
(Which find()-function doesn't work?)
Well if Target is picked up as a proper enter, the vector Tpos will output its coords, which it doesn't. Stays stuck at the origin.
I've tried trigger the if by an input instead to no avail, and using a constant string instead of a variable.
Is there something wrong with me find lines?
Is that enough to get the entity of a player?Code:findPlayerByName(Player) Target = find()
Ahh, apperently
findPlayerByName(S)
doesn' work. Used different terms and it worked.
Thanks for the replies guys.
im trying to do the same thing you are, and i am also frustrated by failure.
Can anyone help?Code:@name Companion cube v1 @inputs @outputs @persist Ep:vector Commandpos:string @trigger all interval(10) E=entity() Commandb=owner():lastSaid() Command=owner():lastSaid():sub(1,7) Commandpos=owner():lastSaid():sub(8,Commandb:length()) Et=findPlayerByName(Commandpos) if (Command=="Follow "){ E:applyForce(Et:pos()+vec(0,0,140)-entity():pos()-E:vel()*0.1) }
What's happening?
As always, output debug stuff and try to figure out what's (not) happening.
Bookmarks