View unanswered posts | View active topics It is currently Wed Aug 15, 2018 12:14 am



Reply to topic  [ 3 posts ] 
 Need help with the medic lua script. 
Author Message
User avatar

Joined: Thu Dec 21, 2017 4:42 pm
Posts: 4
Location: My perfect sanctuary (the dirty hellhole i call a "desk")
Reply with quote
Post 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?


Fri Apr 27, 2018 6:50 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 649
Location: Halifax, Canada
Reply with quote
Post 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.


Fri Apr 27, 2018 10:30 pm
Profile
User avatar

Joined: Thu Dec 21, 2017 4:42 pm
Posts: 4
Location: My perfect sanctuary (the dirty hellhole i call a "desk")
Reply with quote
Post Re: Need help with the medic lua script.
Thanks! gonna try it out now and say if it works.


Sat Apr 28, 2018 9:15 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.015s | 17 Queries | GZIP : Off ]