View unanswered posts | View active topics It is currently Sun Apr 28, 2024 11:53 am



Reply to topic  [ 1 post ] 
 Crude scripting through attachables 
Author Message
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post Crude scripting through attachables
So while fiddling around with the idea of making a proper laser sight for a gun, I came upon the following solutions:

1 - Make an emitter that's attached to the gun, and make sure its inside the gun
2 - Have the emitter emit short-lived particles with a low velocity or even no velocity
3 - These particles each run a script that casts an MO ray. They should typically return the gun's MOID, since the emitter is buried in the gun and it's always the first thing the MO ray will encounter
4 - Use the gun's MOID to find its root MOID. If an actor is holding it, it'll be the ID of the actor. If nobody is holding it, it'll be the ID of the gun
5 - You still can't run scripts on the gun if an actor is holding it, but you can at least then do a variety of interesting things based off of the actor itself. And you can ALWAYS be pretty damn sure that you're getting the actor and not anything else

Like I said, I used this to make a laser sight. After getting the actor's ID, I just got the actor's AimAngle and used that to cast an obstacle ray from the same particle at the angle that the actor is facing and spawn a small glow wherever it strikes something. It always works.

Something else I could use this for is to make my "only Shoguns can use certain weapons" deal work a whole lot better. I can just set it up so when somebody is holding it, once it finds an actor ID it just forces them to drop their current weapon, or maybe disables their WEAPON_FIRE state.

I'm sure there's more clever things you could do with this method. Plus, it would probably work on things besides guns. Basically, it should work on any attachable.


Sat Nov 07, 2009 4:13 pm
Profile YIM
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.152s | 15 Queries | GZIP : Off ]