Author |
Message |
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Lua help.
Hey guys I need some help. I want to either make one of the brain files load more than one lua, which doesnt seem to work. Or combine the Cash for kills lua, and smartbrain lua. I cant seem to figure out how to do the comments, to merge the files. Here are the two seperate luas I want to combine. Thanks in advance Code: function Update(self) for actor in MovableMan.Actors do if actor.Team ~= self.Team then self.CurrentDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); if self.LastDC == nil then self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end if actor:IsDead() == true then local Money = CreateMOSParticle("Gold"); Money.Pos = actor.AboveHUDPos + Vector(0,4); end self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF + (self.CurrentDC - self.LastDC) * (60 + actor.GoldValue / 1.5), self.Team); self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end end end Code: function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.ClassName == "AHuman" then if actor:IsPlayerControlled() == false and actor.AIMode == 1 then actor:GetController():SetState(Controller.BODY_CROUCH, false); actor:GetController():SetState(Controller.MOVE_RIGHT, false); actor:GetController():SetState(Controller.MOVE_LEFT, false); end end end end
|
Sun Oct 24, 2010 5:23 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Lua help.
Take one thing from and update function and stick it into the other update function. Like: Code: function Update(self) (stuff) end
+ Code: function Update(self) (stuff2) end
= Code: function Update(self) (stuff) (stuff2) end
And there's also a Lua Scripting forum for this.
|
Sun Oct 24, 2010 6:15 am |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
Ooops sorry I put in the wrong forum. But I still cant get it to work
|
Sun Oct 24, 2010 7:17 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Lua help.
Show me what you got so far.
|
Sun Oct 24, 2010 5:27 pm |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
Hey I appreciate the tips. Here is the code that doesnt work. Keep in mind I barely have ini files figured out, and the lua ones look like a alien language to me Code: function Update(self) (stuff) end for actor in MovableMan.Actors do if actor.Team == self.Team and actor.ClassName == "AHuman" then if actor:IsPlayerControlled() == false and actor.AIMode == 1 then actor:GetController():SetState(Controller.BODY_CROUCH, false); actor:GetController():SetState(Controller.MOVE_RIGHT, false); actor:GetController():SetState(Controller.MOVE_LEFT, false); end end end end
function Update(self) (stuff2) end for actor in MovableMan.Actors do if actor.Team ~= self.Team then self.CurrentDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); if self.LastDC == nil then self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end if actor:IsDead() == true then local Money = CreateMOSParticle("Gold"); Money.Pos = actor.AboveHUDPos + Vector(0,4); end self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF + (self.CurrentDC - self.LastDC) * (60 + actor.GoldValue / 1.5), self.Team); self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end end end
|
Sun Oct 24, 2010 6:25 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Lua help.
^That is correct.
|
Sun Oct 24, 2010 6:53 pm |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
I changed it and retabbed everything and it still doesnt work. Code: function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.ClassName == "AHuman" then if actor:IsPlayerControlled() == false and actor.AIMode == 1 then actor:GetController():SetState(Controller.BODY_CROUCH, false); actor:GetController():SetState(Controller.MOVE_RIGHT, false); actor:GetController():SetState(Controller.MOVE_LEFT, false); end end end end for actor in MovableMan.Actors do if actor.Team ~= self.Team then self.CurrentDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); if self.LastDC == nil then self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end if actor:IsDead() == true then local Money = CreateMOSParticle("Gold"); Money.Pos = actor.AboveHUDPos + Vector(0,4); end self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF + (self.CurrentDC - self.LastDC) * (60 + actor.GoldValue / 1.5), self.Team); self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end end end
|
Sun Oct 24, 2010 6:58 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Lua help.
Tabbing has no effect. Do you have any Lua console errors?
|
Sun Oct 24, 2010 7:02 pm |
|
|
findude
Joined: Tue Dec 12, 2006 3:10 pm Posts: 495 Location: Uncertain quantum state
|
Re: Lua help.
You are beynond help. Code: function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team and actor.ClassName == "AHuman" then if actor:IsPlayerControlled() == false and actor.AIMode == 1 then actor:GetController():SetState(Controller.BODY_CROUCH, false); actor:GetController():SetState(Controller.MOVE_RIGHT, false); actor:GetController():SetState(Controller.MOVE_LEFT, false); end elseif actor.Team ~= self.Team then self.CurrentDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); if self.LastDC == nil then self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end if actor:IsDead() == true then local Money = CreateMOSParticle("Gold"); Money.Pos = actor.AboveHUDPos + Vector(0,4); end self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF + (self.CurrentDC - self.LastDC) * (60 + actor.GoldValue / 1.5), self.Team); self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end end end
|
Sun Oct 24, 2010 7:03 pm |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
Lua console, how do I use that? When I run the game it acts like the lua doesnt exist.
|
Sun Oct 24, 2010 7:04 pm |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
Quote: You are beynond help. Ouch man. but when I use your code I start the game with like 100 billion dollars
|
Sun Oct 24, 2010 7:07 pm |
|
|
findude
Joined: Tue Dec 12, 2006 3:10 pm Posts: 495 Location: Uncertain quantum state
|
Re: Lua help.
Code: function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team then if actor.ClassName == "AHuman" then if actor:IsPlayerControlled() == false and actor.AIMode == 1 then actor:GetController():SetState(Controller.BODY_CROUCH, false); actor:GetController():SetState(Controller.MOVE_RIGHT, false); actor:GetController():SetState(Controller.MOVE_LEFT, false); end end elseif actor.Team ~= self.Team then self.CurrentDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); if self.LastDC == nil then self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end if actor:IsDead() == true then local Money = CreateMOSParticle("Gold"); Money.Pos = actor.AboveHUDPos + Vector(0,4); end self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF + (self.CurrentDC - self.LastDC) * (60 + actor.GoldValue / 1.5), self.Team); self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end end end
|
Sun Oct 24, 2010 7:15 pm |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
Code: function Update(self) for actor in MovableMan.Actors do if actor.Team == self.Team then if actor.ClassName == "AHuman" then if actor:IsPlayerControlled() == false and actor.AIMode == 1 then actor:GetController():SetState(Controller.BODY_CROUCH, false); actor:GetController():SetState(Controller.MOVE_RIGHT, false); actor:GetController():SetState(Controller.MOVE_LEFT, false); end end elseif actor.Team ~= self.Team then self.CurrentDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); if self.LastDC == nil then self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end if actor:IsDead() == true then local Money = CreateMOSParticle("Gold"); Money.Pos = actor.AboveHUDPos + Vector(0,4); end self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF + (self.CurrentDC - self.LastDC) * (60 + actor.GoldValue / 1.5), self.Team); self.LastDC = ActivityMan:GetActivity():GetTeamDeathCount(actor.Team); end end end When I use that the code it works, in skirmish and all the campaign missions except tutorial. When I play that one I start with a ton of money and when I go to buy something the game locks, with no error message and has to be killed via task manager
|
Sun Oct 24, 2010 7:27 pm |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
Also no errors show in the console. And there are some other missions that have the same problem
|
Sun Oct 24, 2010 7:40 pm |
|
|
MesoTroniK
Joined: Mon Dec 07, 2009 12:56 am Posts: 36
|
Re: Lua help.
This is so hopelessly above my skill level Ill never figure it out. Guess I'll ony have anti retardness and cash for kills in skirmish only
|
Sun Oct 24, 2010 7:46 pm |
|
|
|