View unanswered posts | View active topics It is currently Wed Dec 25, 2024 5:12 pm



Reply to topic  [ 5 posts ] 
 Custom Activities help 
Author Message

Joined: Mon Mar 12, 2012 11:58 pm
Posts: 5
Reply with quote
Post Custom Activities help
I want to add fog of war to some activities like Brain Vs. Brain. I have a copied version of B v B and I don't know where to put it. I found the code from the Endless Skirmish Fog, but I don't know where to put the code in my new one. In CC it says end expected near <aoc> (not that, just a rough memory of what it was). How do I add fog of war the the activity?


Sat Dec 15, 2012 7:26 pm
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Custom Activities help
There is probably an 'end' missing somewhere. Try copying this code (from endless skirmish):
Code:
         -- Add fog
         if not self.Fog then
            self.Fog = true   -- only run once
            
            for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
               if self:PlayerActive(player) and self:PlayerHuman(player) then
                  SceneMan:MakeAllUnseen(Vector(25, 25), self:GetTeamOfPlayer(player))
               end
            end
            
            if self.CPUTeam ~= Activity.NOTEAM then
               SceneMan:MakeAllUnseen(Vector(65, 65), self.CPUTeam)
            end
            
            for Act in MovableMan.AddedActors do
               if Act.ClassName ~= "ADoor" then
                  for ang = 0, math.pi*2, 0.15 do
                     SceneMan:CastSeeRay(Act.Team, Act.EyePos, Vector(30+FrameMan.PlayerScreenWidth*0.5, 0):RadRotate(ang), Vector(), 1, 5)
                  end
               end
            end
            
            for Act in MovableMan.Actors do
               if Act.ClassName ~= "ADoor" then
                  for ang = 0, math.pi*2, 0.15 do
                     SceneMan:CastSeeRay(Act.Team, Act.EyePos, Vector(30+FrameMan.PlayerScreenWidth*0.5, 0):RadRotate(ang), Vector(), 1, 5)
                  end
               end
            end
         end


And add it below this line in BvsB:
Code:
if self.ActivityState ~= Activity.OVER and self.ActivityState ~= Activity.EDITING then


Sun Dec 16, 2012 10:57 am
Profile
User avatar

Joined: Thu Dec 27, 2012 10:43 am
Posts: 3
Reply with quote
Post Re: Custom Activities help
I recently did something similar but wanted to also add fog of war during the build mode before you start by also calling a surface scan, but I still have yet found out how to call that. Any help?


Thu Dec 27, 2012 11:41 am
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Custom Activities help
You can just move the "Add fog" part from UpdateActivity to StartActivity and add this code:
Code:
  for x = 0, SceneMan.SceneWidth, 25 do
    for team = 0, 4 do
      SceneMan:CastSeeRay(team, Vector(x, 0), Vector(0, SceneMan.SceneHeight), Vector(), 1, 5)
   end
  end

It will do a scan similar to the meta-game, but instantaneously instead of a slow sweep.


Tue Jan 01, 2013 12:56 pm
Profile
User avatar

Joined: Thu Dec 27, 2012 10:43 am
Posts: 3
Reply with quote
Post Re: Custom Activities help
Thank you so much, this has worked very well, even better then it taking time like a scan.


Wed Jan 02, 2013 12:47 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.037s | 13 Queries | GZIP : Off ]