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



Reply to topic  [ 7 posts ] 
 A camo script. 
Author Message

Joined: Sat Oct 17, 2009 10:18 am
Posts: 10
Location: Right behind you...
Reply with quote
Post 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.


Thu Oct 22, 2009 5:36 pm
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post 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.


Thu Oct 22, 2009 5:53 pm
Profile

Joined: Sat Oct 17, 2009 10:18 am
Posts: 10
Location: Right behind you...
Reply with quote
Post Re: A camo script.
Hmm, Is it possible to make an actor transparent?


Thu Oct 22, 2009 7:26 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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.


Thu Oct 22, 2009 7:36 pm
Profile WWW

Joined: Sat Oct 17, 2009 10:18 am
Posts: 10
Location: Right behind you...
Reply with quote
Post Re: A camo script.
That helps a lot. But what about if I want the guy to be normal sized again?


Thu Oct 22, 2009 8:22 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: A camo script.
You put the above into an if statement and use that to switch it on and off.


Thu Oct 22, 2009 8:27 pm
Profile

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post 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.


Fri Oct 23, 2009 4:06 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 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.050s | 13 Queries | GZIP : Off ]