View unanswered posts | View active topics It is currently Wed Jul 03, 2024 8:03 am



Reply to topic  [ 11 posts ] 
 Small Script Requests 
Author Message
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Small Script Requests
I decided to make a small script request thread , because it will clutter up the requests if we make a new topic every time we need a small script
so here it goes


#1 - A script that I can attach to a turret that will make the turret search for a actor in it's team within 100 pixels and aim in that direction
at 45' and wait 3 seconds and then fire , should loop so that if the actor stays there it should fire every 3 seconds , should not run the script if the turret is controlled by a human player
Why I need it - I am planning to make a turret that fires small clay discs that you can shoot , for practicing you aim and testing new weapons

Ideas mentioned in this thread are not to be copied and distributed as your own , if you really want to use the ideas please give credit

Thanks in advance


Last edited by BrainChild on Sun Jul 18, 2010 1:23 pm, edited 2 times in total.



Sun Jul 18, 2010 10:44 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Small Script Requests
This is fine. A more general thread could be a good idea, unless that's the idea of this (ie a place everyone can ask for quick script help).

Code:
function Update(self)
   --search through the list of actors
   for actor in MovableMan.Actors do
      --if they're on our team then...
      if actor.Team == self.Team then
         --check how close they are, if it's under 100px...
         if SceneMan:ShortestDistance(self.Pos,actor.Pos,true).Magnitude < 100 then
            --aim at them
            self.SetAimAngle(math.atan2(self.Pos.X-actor.Pos.X,self.Pos.Y-actor.Pos.Y);
            break; --DONT DO IT MORE THAN ONCE
         end
      end
   end
end
Not sure how the atan2 stuff will work out, if someone knows it needs adjusting please correct me. Should be fine though.


Sun Jul 18, 2010 12:11 pm
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Small Script Requests
Problem is, that the result would prioritise based on the order of appearance of the actor on the scene, which is fairly arbitrary.


Sun Jul 18, 2010 12:18 pm
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Small Script Requests
indeed it would. you can do the whole curdist thing, but really, 100px is pretty small as far as distance checks go on a normal CC map.


Sun Jul 18, 2010 12:21 pm
Profile WWW
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Small Script Requests
Geti wrote:
This is fine. A more general thread could be a good idea, unless that's the idea of this (ie a place everyone can ask for quick script help).


A general thread it is
will edit OP

also where do I attach it


Sun Jul 18, 2010 1:20 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Small Script Requests
To your ACrab turret?


Sun Jul 18, 2010 9:50 pm
Profile WWW
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Small Script Requests
A based my turret of the dummy one
there is a acrab but it does nothing , the turret is still stationary


Mon Jul 19, 2010 2:14 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Small Script Requests
Bump and double post


Sun Jul 25, 2010 1:57 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Small Script Requests
The turret should be stationary, and I don't think the script will work when you're controlling it. hit ~ for any errors. I can't debug it without some feedback


Mon Jul 26, 2010 1:35 am
Profile WWW
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Small Script Requests
NO errors , tried attaching it to the acrab and the turret did nothing
I was not controling the turret when I was testing


Mon Jul 26, 2010 2:52 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Small Script Requests
#1 - a script that I can use to spawn a TDexplosive after a set amount off time
if possible could it be attached to a MOSR/MOSP that is a child object of a bunker module - if the MOSR/MOSP is destroyed the spawning should stop
#2 - a script that spawns MOSParticles and them moves it (if the MOSP has a life time it should still apply )
attached to a ACrab or MOSP - if the main MOSP is destroyed it should stop spawning


Sun Aug 08, 2010 3:50 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

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.030s | 13 Queries | GZIP : Off ]