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



Reply to topic  [ 131 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 [WIP] Orion Arm Union 
Author Message
User avatar

Joined: Thu Aug 06, 2009 8:34 pm
Posts: 143
Reply with quote
Post Re: [WIP] Orion Arm Union
@Ealge0600 thank you very much for your advice. You probably have realized by now that I'm no mathematician. :D
But some helpful advice: Lua is not an acronym, I believe it is a word in portuguese.


Last edited by Jon on Thu Jan 07, 2010 1:22 am, edited 1 time in total.



Tue Jan 05, 2010 1:37 pm
Profile
Loose Canon
User avatar

Joined: Sun Mar 29, 2009 11:07 pm
Posts: 2992
Location: --------------->
Reply with quote
Post Re: [WIP] Orion Arm Union
Spelled Lua. It is a proper noun, so you capatalize the first letter.


Tue Jan 05, 2010 5:39 pm
Profile WWW

Joined: Thu Aug 13, 2009 7:25 am
Posts: 7
Reply with quote
Post Re: [WIP] Orion Arm Union
Yeah, I remember someone saying in the Wiremod forums that Lua was a proper noun, but I had forgotten. :P

Also, it seems (after doing a quick tutorial search) that the trigonometry functions work in radians, so 90 degrees will actually be the number pi/2 (there are 2pi radians in a circle).

Also, trigonometry is a very useful skill that it would probably be wise to learn. It has a tendency to come up a lot in programming.

It seems that what I have labelled as "invtan" will actually be "math.atan". Writing up some code now, but as I'm not familiar with Lua, it might not work.

edit:
Okay, this might work. It probably won't be a good idea to use it until you can also change the deflection code.
Code:
                if dist <= self.forceShieldRange then
                    local relvelx = particle.Vel.X - self.Vel.X;
                    local relvely = particle.Vel.Y - self.Vel.Y;
                    local reldir = math.atan(relvelx / relvely);
                    local relpos = math.atan(distx / disty);
                   
                    if math.abs(relpos - reldir) < (math.pi / 2) then
                        AdjustVelocity(self, particle);
                    else
                        if math.abs(relpos - reldir) > (math.pi * 3 / 2)  then
                            AdjustVelocity(self, particle); 
                        end
                    end   
                end


Another question: Do you really want to be deflecting particles that originate inside the shield? For instance, a bomb going off from within the shield.

edit2:
This should work for the deflection code. Again, it might not work properly, so if you're going to use it, make a backup. If you have any questions, feel free to ask.
Code:
--Deflect Projectiles
function AdjustVelocity(self, particle)
    if self.healthLeft >= 1 then
        local distx =  particle.Pos.X - self.Pos.X;
        local disty =  particle.Pos.Y - self.Pos.Y;
        local relvelx = particle.Vel.X - self.Vel.X;
        local relvely = particle.Vel.Y - self.Vel.Y;
        local relvel = math.sqrt(relvelx ^ 2 + relvely ^ 2)
        local reldir = math.atan(relvelx / relvely);
        local relpos = math.atan(distx / disty);
        local absvelx = math.abs(relvelx);
        local absvely = math.abs(relvely);
        local healthLoss = (math.sqrt(absvelx ^ 2 + absvely ^ 2) * particle.Mass) / 12;
        self.healthLeft = self.healthLeft - healthLoss;

        local newdir = 2 * relpos - reldir + math.pi;
        local relvelx = relvel * math.sin(newdir);
        local relvely = relvel * math.cos(newdir);
        particle.Vel.X = relvelx + self.Vel.X;
        particle.Vel.Y = relvely + self.Vel.Y;
        self.impact = CreateAEmitter("Shield Impact Blast");
        self.impact.Pos = particle.Pos;
        MovableMan:AddParticle(self.impact);
        self.shieldImpactTimer = Timer();
    end
end


Wed Jan 06, 2010 5:16 am
Profile
User avatar

Joined: Fri Mar 13, 2009 2:31 am
Posts: 217
Location: Earth... I think
Reply with quote
Post Re: [WIP] Orion Arm Union
Can you make the shield smaller? and add some new content soon :lol:


Thu Jan 07, 2010 11:12 pm
Profile
User avatar

Joined: Thu Aug 06, 2009 8:34 pm
Posts: 143
Reply with quote
Post Re: [WIP] Orion Arm Union
I'll try to get some more done this weekend. The dropship gun is coming along well, but there are few bugs, and I cannot release it until they are fixed. I'd also like to improve the Strike Commando since there have been so many complaints, as well as add some more weapons which are currently under the wraps.


Fri Jan 08, 2010 12:42 am
Profile
User avatar

Joined: Fri Mar 13, 2009 2:31 am
Posts: 217
Location: Earth... I think
Reply with quote
Post Re: [WIP] Orion Arm Union
Oh, good news I hope you get done soon (but don't rush yourself, or the content)

anyway gl any hints as to things in development (besides the dropship/stuff you have already mentioned)


Fri Jan 08, 2010 4:19 am
Profile

Joined: Thu Aug 13, 2009 7:25 am
Posts: 7
Reply with quote
Post Re: [WIP] Orion Arm Union
Something is wrong with the code I posted, please ignore it.


Sat Jan 09, 2010 5:46 am
Profile
User avatar

Joined: Thu Aug 06, 2009 8:34 pm
Posts: 143
Reply with quote
Post Re: [WIP] Orion Arm Union
Hello everyone, there will be an update by the end of the week, though perhaps not with the dropship.


Thu Feb 04, 2010 2:01 pm
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: [WIP] Orion Arm Union
What's gonna be new?


Thu Feb 04, 2010 2:04 pm
Profile
User avatar

Joined: Fri May 11, 2007 4:30 pm
Posts: 1040
Location: England
Reply with quote
Post Re: [WIP] Orion Arm Union
as with what Eagle0600 said, if you don't want particles fired by you to be deflected you could do this:
in in circular dist from your character (if dist<=x) then check if the particle is in one of two bounding boxes (one to the left of the character, one to the right) then do a check to see if the bullet velx is positive or negative, if it's to the left of your character and positive then deflect it, and vice versa, this does have the downfall that if it's to the left but in a trajectory towards you going at a negative x velocity (could only be done from above/blow) then it could hit you but the chances of that are small. or you could check four bounding boxes, the additional two being directly above and below the character that just deflect anything if it's in them to stop the above happening (though personally I think the chances of the above happening are too slim for you to worry about)


Thu Feb 04, 2010 9:39 pm
Profile
User avatar

Joined: Thu Aug 06, 2009 8:34 pm
Posts: 143
Reply with quote
Post Re: [WIP] Orion Arm Union
robolee wrote:
as with what Eagle0600 said, if you don't want particles fired by you to be deflected you could do this:
in in circular dist from your character (if dist<=x) then check if the particle is in one of two bounding boxes (one to the left of the character, one to the right) then do a check to see if the bullet velx is positive or negative, if it's to the left of your character and positive then deflect it, and vice versa, this does have the downfall that if it's to the left but in a trajectory towards you going at a negative x velocity (could only be done from above/blow) then it could hit you but the chances of that are small. or you could check four bounding boxes, the additional two being directly above and below the character that just deflect anything if it's in them to stop the above happening (though personally I think the chances of the above happening are too slim for you to worry about)

I am aware of this, and I could have done Y bounding boxes, but I have tested it and never has anything passed through the shield when health is still left.


Sat Feb 06, 2010 2:35 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: [WIP] Orion Arm Union
If you want a shield deflection logic, you can steal from my Bbl Inc mod, though it seems like you have it done already.


Sat Feb 06, 2010 2:41 am
Profile
User avatar

Joined: Thu Aug 06, 2009 8:34 pm
Posts: 143
Reply with quote
Post Re: [WIP] Orion Arm Union
Duh102 wrote:
If you want a shield deflection logic, you can steal from my Bbl Inc mod, though it seems like you have it done already.

I didn't steal from your mod, okay? My code may look similar, but I can assure you, that is completely accidental.


Sun Feb 07, 2010 12:33 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: [WIP] Orion Arm Union
Oh, no, I didn't mean to seem like I was calling you a pirate. I was offering my code but saw that you already had a shield script so you wouldn't even need mine.

My apologies for the mixup.


Sun Feb 07, 2010 12:42 am
Profile
User avatar

Joined: Thu Aug 06, 2009 8:34 pm
Posts: 143
Reply with quote
Post Re: [WIP] Orion Arm Union
Duh102 wrote:
Oh, no, I didn't mean to seem like I was calling you a pirate. I was offering my code but saw that you already had a shield script so you wouldn't even need mine.

My apologies for the mixup.

Sorry about that. :grin:

Image
Now, THAT was a doozy. ^^
I won't have it finished by the update, but I will have some new guns for the mod.


Sun Feb 07, 2010 7:42 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 131 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next

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