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



Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
 Quick Lua Question 
Author Message
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: Quick Lua Question
Again, pretty sure it's hard-coded. One sec lemme ask paul-

Ok I guess it's not.

Code:
self:SetObservationTarget(self:GetPlayerBrain(player).Pos, player);


This sets the observation, or view, to whatever you want.

SO I guess you can change the view to whatever you want.

Hope this helps.


Sat Aug 22, 2009 3:05 am
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: Quick Lua Question
Code:
   for player = 0, self.PlayerCount - 1 do
        -- Check if we already have a brain assigned
        if not self:GetPlayerBrain(player) then
       self.braindead[player] = false;
            local brain = CreateActor("Brain Case");
            brain.Pos = Vector(3348,1128-player*24);
       brain.RotAngle = math.rad(270);
            -- Let the spawn into the world, passing ownership
            MovableMan:AddActor(brain);
            -- Set the found brain to be the selected actor at start
            self:SetPlayerBrain(brain, player);
            SceneMan:SetScroll(self:GetPlayerBrain(player).Pos, player);
            self:SetLandingZone(self:GetPlayerBrain(player).Pos, player);
            -- Set the observation target to the brain, so that if/when it dies, the view flies to it in observation mode
            self:SetObservationTarget(self:GetPlayerBrain(player).Pos, player);
        end
    end
Look through this code, and you'll find, hopefully, what you need.

Double post so CC can see it and know it's a new post. :3


Sat Aug 22, 2009 3:09 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Quick Lua Question
Doesn't work in "function Update(self)." I'm guessing it's only for "function asdf:Activity." Also, I think Observation mode is only when your brain dies, so that won't work.


Sat Aug 22, 2009 3:17 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Quick Lua Question
Observation target is where your view goes when you die.

You want SetScrollTarget, which is not perfect but mostly good.

Also, Mind, stop copying and pasting my Lua advice esp. when I can't tell what the ♥♥♥♥ you're asking me half the time.


Sat Aug 22, 2009 3:18 am
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: Quick Lua Question
K love you too.


Sat Aug 22, 2009 3:19 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Quick Lua Question
I have "self.target.SetScrollTarget = self.Pos;" but doesn't do anything or give errors. Unless, this only works when the "target" is in control curser mode?


Sat Aug 22, 2009 3:29 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Quick Lua Question
Lua 102:
pointer.name is a property
pointer:name is a function

self.target.SetScrollTarget is just going to make a pointer property of self.target called SetScrollTarget not call the function you need. You're also going to need arguments, you know, like for every function?


Sat Aug 22, 2009 4:37 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 22 posts ]  Go to page Previous  1, 2

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.020s | 14 Queries | GZIP : Off ]