View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:18 am



Reply to topic  [ 5 posts ] 
 Can someone make script for... 
Author Message
User avatar

Joined: Fri Mar 13, 2009 2:31 am
Posts: 217
Location: Earth... I think
Reply with quote
Post Can someone make script for...
gibbing an AEmitter right before it impacts with an actor... I've had issues trying to do this myself so I figured I would ask you people

Yes I used the Search first but didn't find anything


Thu Sep 17, 2009 1:53 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Can someone make script for...
CastMO ray much?

Just cast one, and see if it hits an actor.


Thu Sep 17, 2009 5:06 am
Profile
User avatar

Joined: Fri Mar 13, 2009 2:31 am
Posts: 217
Location: Earth... I think
Reply with quote
Post Re: Can someone make script for...
Ok any examples of this I can peek at... I suck at morays... wait does the UAV cluster bomb use this?... I'm gonna go check


Thu Sep 17, 2009 3:08 pm
Profile

Joined: Thu Sep 03, 2009 6:01 pm
Posts: 56
Reply with quote
Post Re: Can someone make script for...
Code:
   detdist = 500;
   if MovableMan:IsActor(self.target) == false then
       local curdist = 5000;
         for actor in MovableMan.Actors do
         local avgx = actor.Pos.X - self.Pos.X;
         local avgy = actor.Pos.Y - self.Pos.Y;
         local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
            if dist < curdist and actor.Team ~= self.Team then   --THIS LINE
               curdist = dist;
               self.target = actor;
               if dist <= detdist then
                  self:GibThis()
               end
            end
         end

   end


Will make the object gib when it get's closer than 500px to any actor.

If you want your script to only react to a special kind of actor, replace the line with "--THIS LINE" with the following:
Code:
if dist < curdist and actor.Team ~= self.Team and actor.ClassName == "ACRocket"
or
if dist < curdist and actor.Team ~= self.Team and not actor.ClassName == "ACrab" then


The first line will make it blow up only when it's next to a ACRocket, the second line will make it not explode next to ACrabs.


Fri Sep 25, 2009 5:12 pm
Profile
User avatar

Joined: Fri Mar 13, 2009 2:31 am
Posts: 217
Location: Earth... I think
Reply with quote
Post Re: Can someone make script for...
DrLuke I thank you :bow:


Wed Oct 07, 2009 9:01 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.094s | 13 Queries | GZIP : Off ]