Data Realms Fan Forums
http://45.55.195.193/

A camo script.
http://45.55.195.193/viewtopic.php?f=73&t=16916
Page 1 of 1

Author:  oliver255 [ Thu Oct 22, 2009 5:36 pm ]
Post subject:  A camo script.

I am trying to make a mod that if you press crouch, you turn the color of the back round. I don't know how to do this if this is possible.

Author:  Kyred [ Thu Oct 22, 2009 5:53 pm ]
Post subject:  Re: A camo script.

Not easily, unless your on snow terrain (Actor:FlashWhite()). Other than that, you can't change the color actors without resprites.

You could make a specific camouflage unit that changes to a color when he crouches. However, you would have to make colors for each body part and each type of terrain (each one would be a separate frame. Like all the frame 0's would be normal color, frame 1's would be dirt camo, frame 2's would be grass camo, frame 3's would be in-door camo and so on).

Then, you can check to see what the general terrain material is under the actor (SceneMan:GetTerrMatter() or something like that) and then apply the correct color frame.

So in short, yes it is possible, but it would require a bit of work.

EDIT:
Oh, you mean background. No, there isn't an easy way to do this.

Author:  oliver255 [ Thu Oct 22, 2009 7:26 pm ]
Post subject:  Re: A camo script.

Hmm, Is it possible to make an actor transparent?

Author:  CrazyMLC [ Thu Oct 22, 2009 7:36 pm ]
Post subject:  Re: A camo script.

Yes, it is.
It has been done.
But here is the code to do it:
Code:
i = 1; while i < MovableMan:GetMOIDCount() do if MovableMan:GetMOFromID(i).RootID == ActivityMan:GetActivity():GetControlledActor(0).ID then MovableMan:GetMOFromID(i).Scale = 0 end i = i + 1 end

This makes the sprites size 0, really just shrinking it, but it looks transparent.

Author:  oliver255 [ Thu Oct 22, 2009 8:22 pm ]
Post subject:  Re: A camo script.

That helps a lot. But what about if I want the guy to be normal sized again?

Author:  Duh102 [ Thu Oct 22, 2009 8:27 pm ]
Post subject:  Re: A camo script.

You put the above into an if statement and use that to switch it on and off.

Author:  zalo [ Fri Oct 23, 2009 4:06 am ]
Post subject:  Re: A camo script.

Or you could teleport and pin him under ground, and then set his viewpoint to his previous position.

'course then he would actually BE there, so bullets and stuff wouldn't collide.

The scale script is your best bet, as that doesn't mess with collision.

Code:
function Update(self)
i = 1;
while i < MovableMan:GetMOIDCount() do
if MovableMan:GetMOFromID(i).RootID == ActivityMan:GetActivity():GetControlledActor(0).ID and ActivityMan:GetActivity():GetControlledActor(0):GetController():IsState(Controller.BODY_CROUCH) then
MovableMan:GetMOFromID(i).Scale = 0;
elseif MovableMan:GetMOFromID(i).RootID == ActivityMan:GetActivity():GetControlledActor(0).ID and not ActivityMan:GetActivity():GetControlledActor(0):GetController():IsState(Controller.BODY_CROUCH)
MovableMan:GetMOFromID(i).Scale = 1;
end
i = i + 1
end
end

This is the basic actor code for camo. Crouch makes it camo. It might not work (probably doesn't work) so you'll have to fix it yourself.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/