Data Realms Fan Forums http://45.55.195.193/ |
|
Custom Activities help http://45.55.195.193/viewtopic.php?f=73&t=37627 |
Page 1 of 1 |
Author: | icebird1942 [ Sat Dec 15, 2012 7:26 pm ] |
Post subject: | 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? |
Author: | Abdul Alhazred [ Sun Dec 16, 2012 10:57 am ] |
Post subject: | 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 |
Author: | Anthonyhorror [ Thu Dec 27, 2012 11:41 am ] |
Post subject: | 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? |
Author: | Abdul Alhazred [ Tue Jan 01, 2013 12:56 pm ] |
Post subject: | 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. |
Author: | Anthonyhorror [ Wed Jan 02, 2013 12:47 pm ] |
Post subject: | Re: Custom Activities help |
Thank you so much, this has worked very well, even better then it taking time like a scan. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |