View unanswered posts | View active topics It is currently Thu Mar 28, 2024 6:14 pm



Reply to topic  [ 5 posts ] 
 How to flip placed TDExplosives by placement direction? 
Author Message

Joined: Sun Mar 08, 2015 11:57 pm
Posts: 8
Reply with quote
Post How to flip placed TDExplosives by placement direction?
I made Claymores that are basically like Remote Explosives but with a directional blast. They work great except that when I place them, they always face to the right. I want them to be so that they are facing the same direction that they are thrown and they blast in that direction.

Here's the .ini file for the Claymore:


Here's one of the .lua files (ClaymoreSet.lua):


And here's the other .lua file (ClaymoreDeploy.lua):


I'm not very good at coding, so I would appreciate some help.


Thu Mar 12, 2015 12:42 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: How to flip placed TDExplosives by placement direction?
Try using this for the ClaymoreDeploy script:

Code:
function Create(self)

   self.alliedTeam = -1;

end

function Update(self)

   if self.ID ~= self.RootID then
      local actor = MovableMan:GetMOFromID(self.RootID);
      if MovableMan:IsActor(actor) then
         self.alliedTeam = ToActor(actor).Team;
      end
   end

   if self:IsActivated() and self.ID == self.RootID then

      local explosive = CreateMOSRotating("Particle Active Claymore");
      explosive.Pos = self.Pos;
      explosive.Vel = self.Vel;
      explosive.RotAngle = self.Vel.AbsRadAngle;
      explosive.Sharpness = self.alliedTeam;
      MovableMan:AddParticle(explosive);

      self.ToDelete = true;

   end

end


The line that was changed was

explosive.RotAngle = self.RotAngle;

to

explosive.RotAngle = self.Vel.AbsRadAngle;


Sun Mar 15, 2015 10:58 pm
Profile

Joined: Sun Mar 08, 2015 11:57 pm
Posts: 8
Reply with quote
Post Re: How to flip placed TDExplosives by placement direction?
Thanks, CaveCricket. I'm not currently at my CC computer, but I'll give that a try when I am. I appreciate it.


Mon Mar 16, 2015 3:10 am
Profile

Joined: Sun Mar 08, 2015 11:57 pm
Posts: 8
Reply with quote
Post Re: How to flip placed TDExplosives by placement direction?
Hmm, I tried replacing that line with the one you changed, and now when I throw a claymore to the left, it's upside-down and the blast still goes to the right. How I'd like it is for the image to be flipped horizontally when thrown to the left (and rotated based on up/down direction), and for the blast to go in the direction the claymore is facing. Do you know how to do this? Thanks.


Tue Mar 17, 2015 2:31 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: How to flip placed TDExplosives by placement direction?
After a bit of testing, it seems that the velocity of gibs no longer appear to rotate with the parent object, which is odd.

Here's showing that the mines are rotating properly:

Image

With this modified script (ClaymoreSet.lua) (red lines not included):


Despite this not working, things that use directional blasts like the Ronin RPG-7 still work, so I'm a bit confused. Only thing I can suggest is either using the same explosion style as the RPG-7 (one of the gibs is an emitter that launches the damage particles), or using an emitter for the damage particles and spawning it with Lua when the mine is detonated.


Tue Mar 17, 2015 9:31 pm
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.102s | 16 Queries | GZIP : Off ]