View unanswered posts | View active topics It is currently Wed Jan 08, 2025 10:37 pm



Reply to topic  [ 48 posts ]  Go to page Previous  1, 2, 3, 4  Next
 Interesting and Useful Coding stuff - Tell us yours! 
Author Message
Banned

Joined: Tue Aug 26, 2008 6:09 pm
Posts: 432
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Adding funds to a team using lua:

Code:
ActivityMan:GetActivity():SetTeamFunds([amount of money],[put team number here (0 for red, 1 for green])


Fri Dec 12, 2008 2:14 pm
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Geti wrote:
have you any idea how much lag that creates?

You can reduce lag by having the explosive hop around by increasing MaxVelocity. Also, if you use emitters, you can use something like StartTimeMS = 500, so a new one is spawned every 0.5 seconds. Also setting LifeTime to 500 is a good idea, unless you want a growing amount of emitters on your map.


Fri Dec 12, 2008 2:59 pm
Profile
User avatar

Joined: Fri Mar 02, 2007 6:59 am
Posts: 1726
Location: NSW, Australia
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Come on guys, don't let this die.

Explosives are infinetly LESS laggy if you make them literally implode: particles spawn from the maximum blast radius and come inwards, but I'm not sure how you code that.


Mon Dec 29, 2008 2:12 am
Profile
User avatar

Joined: Sun May 18, 2008 8:30 am
Posts: 732
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
I think you can use doors to get terrain to settle without touching the ground. Someone wanted to make a pencil that draws terrain but couldn't get terrain to settle in the air. Does any body know who that was?


Tue Dec 30, 2008 4:46 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Recursive gibbing is a far underused classic.

Define object A with normal properties.

Define object B with normal properties, and have it gib object A.

Redefine object A but gibbing object B.

All credit to p3lb0x.


Tue Dec 30, 2008 5:46 am
Profile
User avatar

Joined: Fri Mar 02, 2007 6:59 am
Posts: 1726
Location: NSW, Australia
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Grif wrote:
Recursive gibbing is a far underused classic.

Define object A with normal properties.

Define object B with normal properties, and have it gib object A.

Redefine object A but gibbing object B.

All credit to p3lb0x.


And what's it do?


Tue Dec 30, 2008 7:14 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
It causes things to gib into it self forever until CC crashes or it disapears.
And using the "ABomb" controllable actor technique(actor loaded craft), you can get Phoenix Robots/Clones/Troops/Whatever.

I think it also works with other spawners like emitters.


Tue Dec 30, 2008 7:23 am
Profile
User avatar

Joined: Sun May 18, 2008 8:30 am
Posts: 732
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
That's probably why so few people use it.


Tue Dec 30, 2008 7:43 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Except it doesn't have to be an automatic recursion.

You can have something that gibs into itself when you TELL it to.

That's the real secret, and as much as I'm gonna give away.


Tue Dec 30, 2008 8:34 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
whoa, you mean with a custom weapon? :-o
maybe not, but it would work.
in any case: viewtopic.php?f=61&p=249087#p249087


Fri Jan 02, 2009 1:31 pm
Profile WWW
User avatar

Joined: Mon Feb 11, 2008 3:42 pm
Posts: 259
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Grif wrote:
You can have something that gibs into itself when you TELL it to.

:grin: I think I can see where this is going...


Fri Jan 02, 2009 11:41 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
EntryWound = Null
ExitWound = Null
BreakWound = Null

This doesn't mean it won't emit anything when it wounds.

It means it is UNWOUNDABLE. Regardless of what material it is made out of.

An actor with this + high GIL is nigh on invincible.

An actor with this + no defined GIL is yeah, pretty much invincible.

Fun fact: The word Null can be replaced with anything for the same effect.

EntryWound = DOESN'T HAVE ANY will work equally well.


Mon Jan 05, 2009 4:15 am
Profile
User avatar

Joined: Sun Jun 10, 2007 2:05 am
Posts: 426
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Grif wrote:
Fun fact: The word Null can be replaced with anything for the same effect.

Code:
EntryWound = Can't touch this
ExitWound = Na, na na na
BreakWound = Can't touch this

Code:
EntryWound = I
ExitWound = am
BreakWound = IRONMAN

On a more productive note, I've heard of (and will soon try) using gibimpulselimit and min/maxvelocity to give something a probability of gibbing into something else. This could be used to make something that emits things randomly or fire rounds randomly (tracers are pretty regular).


Mon Jan 05, 2009 4:41 am
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
Oh yes, that's the trick i used to make my Lightning Gun's shots branch out randomly. At every frame, the bolt shot out an emitter with a rather low gib impulse limit (0.01), and this emitter shot out a particle with a mass of 0.001 at velocities between 1 and 11. If the velocity was above 10, the emitter would gib, and send out a secondary bolt. If it was below 10, it would just disappear due to the low lifetime of the emitter. For some reason, CC calculates impulse as mass * velocity. I guess it's easier to work with than the correct formula though. This trick could be adapted for many situations...
Also, code for reference:

Code:
AddEffect = MOPixel
   PresetName = Invisible Pixel
   Mass = 0.001
   LifeTime = 10
   Sharpness = 0
   HitsMOs = 0
   GetsHitByMOs = 0
   Color = Color
      R = 255
      G = 0
      B = 255
   Atom = Atom
      Material = Material
         CopyOf = Bullet Metal
      TrailColor = Color
         R = 150
         G = 255
         B = 255
      TrailLength = 0

AddEffect = AEmitter
   PresetName = Branch Base
   Mass = 0.01
   LifeTime = 100 // Low lifetime makes it disappear quickly, and not lag up the game, if it doesn't gib.
   GlobalAccScalar = 0
   HitsMOs = 1
   GetsHitByMOs = 0
   SpriteFile = ContentFile
      FilePath = LightningGun.rte/HitArea.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = 0
      Y = 0
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Bullet Metal
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Bullet Metal
      Resolution = 3
      Depth = 5
   DeepCheck = 0
   JointStrength = 10000
   JointStiffness = 1
   DrawAfterParent = 1
   AddEmission = Emission
      EmittedParticle = MOPixel
         CopyOf = Invisible Pixel
      Spread = 0
      MaxVelocity = 11 // Max velocity gives an impulse higher than the limit, causing it to gib.
      MinVelocity = 1 // Min velocity below the limit makes sure that it doesn't gib every time.
   EmissionEnabled = 1
   EmissionsIgnoreThis = 1
   ParticlesPerMinute = 0
   BurstScale = 1
   BurstSize = 1
   BurstTriggered = 1
   GibImpulseLimit = 0.01 // Low gib impulse limit, yo.

You might want to delete the comments if you copy directly, though they won't interfere with the code.


Mon Jan 05, 2009 5:33 pm
Profile WWW
User avatar

Joined: Sat Dec 13, 2008 11:56 pm
Posts: 206
Reply with quote
Post Re: Interesting and Useful Coding stuff - Tell us yours!
something ive found very important...


CORTEX COMMAND IS CASE SENSITIVE


Mon Jan 05, 2009 8:33 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 48 posts ]  Go to page Previous  1, 2, 3, 4  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.038s | 14 Queries | GZIP : Off ]