Data Realms Fan Forums
http://forums.datarealms.com/

Need help with the medic lua script.
http://forums.datarealms.com/viewtopic.php?f=73&t=46267
Page 1 of 1

Author:  Alejandroibo13 [ Fri Apr 27, 2018 6:50 pm ]
Post subject:  Need help with the medic lua script.

I'm doing a coalition medic troop (for a mod i'm making) and i'm using the medic lua script, from the medic robot. The thing is that i want to change it up a bit, but i don't know how. I want to make it so that A: It heals at a slower rate and B: It can heal itself (preferably at an even slower rate). Anyone can help me with this?

Author:  Bad Boy [ Fri Apr 27, 2018 10:30 pm ]
Post subject:  Re: Need help with the medic lua script.

1. The script makes the bot heal 1 health every 100 milliseconds (1/10th of a second), you can slow this down by lowering the amount healed, though that might not work, or by making the healing happen less often. To do the former change line 27 so it's:
Code:
self.HealTarget.Health = math.min(self.HealTarget.Health+[some_number_less_than_1], 100)

To do the latter (which I recommend) change line 3 to be:
Code:
self.HealTimer:SetSimTimeLimitMS([some_number_greater_than_100])


2. Line 48 is the relevant line here:
Code:
if SceneMan:CastObstacleRay(self.EyePos, Trace, Vector(), Vector(), self.ID, self.IgnoresWhichTeam, 0, 3) < 0 then

This line checks if there's anything in between the actor's eye position and the potential target, but the part that says self.ID makes it ignore itself (see docs [url=http://wiki.datarealms.com/LuaDocs/SceneManager#CastObstacleRay]here[/ur]). There are various ways you could fix it, but an easy one is to make the script first check if the potential target is the actor itself, so and then not do the obstactle check. To do this, you could change line 48 to:
Code:
if Act.UniqueID == self.UniqueID or SceneMan:CastObstacleRay(self.EyePos, Trace, Vector(), Vector(), self.ID, self.IgnoresWhichTeam, 0, 3) < 0 then

If this doesn't work, try replacing UniqueID with ID where I put it in.

Author:  Alejandroibo13 [ Sat Apr 28, 2018 9:15 am ]
Post subject:  Re: Need help with the medic lua script.

Thanks! gonna try it out now and say if it works.

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