Data Realms Fan Forums
http://45.55.195.193/

AI enemy control
http://45.55.195.193/viewtopic.php?f=4&t=45089
Page 1 of 1

Author:  Pumone [ Sat Jan 26, 2013 12:37 am ]
Post subject:  AI enemy control

my big question is:

is it possible to create a simple code that allows you to switch by team A to team B by clicking a button (for example button "1") and vice-versa?

Author:  Pumone [ Sat Feb 02, 2013 12:04 pm ]
Post subject:  Re: AI enemy control

I suppose there is no way to make it real :(

Author:  Bad Boy [ Sat Feb 02, 2013 5:06 pm ]
Post subject:  Re: AI enemy control

Add this to their individual script or straight to HumanAI (or any other AI) in base.rte/Actors/AI:
Code:
   if self:IsPlayerControlled() and MovableMan:IsActor(self) and UInputMan:KeyPressed(28) then
      if self.Team == 0 then
         self.Team = 1;
      elseif self.Team == 1 then
         self.Team = 0;
      end
   end

As requested this uses 1 as the key to change team. You can change it by changing the number inside the brackets of UInputMan:KeyPressed(28). For the rest of the keys, look here: http://wiki.datarealms.com/Keylist

Keep in mind that though I haven't had any crashes, I can't guarantee that they won't happen; switching teams for actors once they're spawned can be an odd business.

Author:  Pumone [ Sat Feb 02, 2013 9:45 pm ]
Post subject:  Re: AI enemy control

thanks bad boy,

i tried to add your code to their individual script or straight to HumanAI bu with no result, sometimes the game crashes, sometimes starts but without the code's function.

so what i wish to do isn't to transform 1 unit of team A in 1 unit of team B;

i would make a thing that allows me to switch team, so all AI units in the battlefield become my units and vice-versa.

Author:  Pumone [ Sun Feb 03, 2013 2:13 pm ]
Post subject:  Re: AI enemy control

maybe i'm wrong to enter the code

where to put it? at the top of lua file? or at the bottom?

sorry for multiple questions, but this is my final project to this wonderful game

Author:  Bad Boy [ Sun Feb 03, 2013 8:14 pm ]
Post subject:  Re: AI enemy control

Assuming it doesn't turn out to be a very lenghty process I'll be giving you an updated version that'll do what you want sometime soonish.
For this, put it at the bottom of AIHuman.lua in base.rte/Actors/AI. You don't have to paste over anything, just add it directly below what's already there.

Edit: Scratch that, I'm not sure how doable what you want actually is. For what it's worth here's a glitchy version that sort of does it. While it doesn't really work it's still pretty fun. Replace your HumanAI with this one:
Attachment:
HumanAI.lua [838 Bytes]
Downloaded 337 times

Author:  Pumone [ Sun Feb 03, 2013 9:33 pm ]
Post subject:  Re: AI enemy control

first of all, thank you so much,

this is what I wanted to do

but has a problem

when I press "1" all actors change in opposite team

but it seems that AI die so I can control only one actor and all other soldiers in my team moves concurrently all together

example: if I press jetpack "w" not only my actors will fly, but all actors in my team do this

so you made a great mod but still correctable

Author:  Bad Boy [ Sun Feb 03, 2013 9:42 pm ]
Post subject:  Re: AI enemy control

Yeah, I know, it's glitchy (it work properly sometimes) and seems to crash a good deal of the time. I'll see if I can make a decent version of it sometime but I'm not sure how doable it actually is.
If I can make it work properly I will but don't hold your breath.

Author:  Pumone [ Mon Feb 04, 2013 10:07 am ]
Post subject:  Re: AI enemy control

ok thanks for your kindness :grin:

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/