|
FAQ
• Search • Login
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Lua Scripted Actors and Abilities Topic
Author |
Message |
Delta
Joined: Sun Nov 22, 2009 3:32 pm Posts: 5
|
Lua Scripted Actors and Abilities Topic
i think this could be a good idea for the Undead Contest but i have got it after the contest, a Vampire script, to use it just copy this and paste in a lua file. ______________________________________________________________________ function Create(self) healTimer = Timer(); healInterval = 10; self.healnum = 0; end
function Update(self) if healTimer:IsPastSimMS(healInterval) then for actor in MovableMan.Actors do --If the actor is on the enemy team, has more than 0 (death) health and is not the vampire, continue with code. if actor.Team ~= self.Team and actor.Health > 0 and actor.ID ~= self.ID then local avgx = actor.Pos.X - self.Pos.X; local avgy = actor.Pos.Y - self.Pos.Y; local dist = math.sqrt(avgx ^ 2 + avgy ^ 2); if dist < 100 then --If the actor is fairly close, take his life ! actor.Health = actor.Health - 1; --Every (number) health taked, put a little icon above the actor's head (NOT USED but if you need) if self.healnum == 0 then --Create the particle (NOT USED but if you need) local part = CreateMOSParticle("Particle Heal Effect"); --Set the particle's position to just over the actor's head (NOT USED but if you need) part.Pos = actor.AboveHUDPos + Vector(0,4); --Add the particle to the world. MovableMan:AddParticle(part); end end end end healTimer:Reset(); self.healnum = self.healnum - 1; if self.healnum > 8 then self.healnum = 0; end end end ______________________________________________________________________ NOTE: this is just a modified copy of the medic script. But work. I haven't heavy modified the script but i have got idea.
If you have any script (for actors) just post here Please (if possible) post only complete scripts, for help new modders
Last edited by Delta on Mon Nov 23, 2009 7:00 pm, edited 3 times in total.
|
Sun Nov 22, 2009 8:41 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Lua Scripted Actors and Abilities Topic
|
Sun Nov 22, 2009 8:44 pm |
|
|
Delta
Joined: Sun Nov 22, 2009 3:32 pm Posts: 5
|
Re: Lua Scripted Actors and Abilities Topic
yes thanks, but in the Lua Tricks topic there aren't any complete script, just parts. And in this topic will be posted (i think) only actors scripts
Thank Grif, these scripts aren't for me (i'm not going to use these scripts for my mods) but for public use
Last edited by Delta on Sun Nov 22, 2009 9:39 pm, edited 3 times in total.
|
Sun Nov 22, 2009 8:54 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Lua Scripted Actors and Abilities Topic
Your script uses global variables, inefficient distance checks, and you haven't even updated and/or deleted the comments. Also, the reason the other thread involves incomplete code is because it's meant to be inserted into mods when you need to accomplish something.
This is quite literally just a useless lua script that you spent about four seconds modifying from some other example. There's no need for a thread like this, at all, because Lua Scripting is not the "post .lua files from actual mods so that Delta can change four variables and use them for himself" forum.
|
Sun Nov 22, 2009 9:15 pm |
|
|
Delta
Joined: Sun Nov 22, 2009 3:32 pm Posts: 5
|
Re: Lua Scripted Actors and Abilities Topic
A camo script. Press [Z] to change team and [X] to return to original
function Create(self) self.curteam = self.Team self.shottimer = Timer(); end
function Update(self) if self:GetController() and UInputMan:KeyPressed(26) then self:FlashWhite(500) self.Team = 1 - self.curteam end if self:GetController() and UInputMan:KeyPressed(24) then self.Team = self.curteam self.shottimer:Reset() end if self.Health <= .5 then self.Team = self.curteam end end
function Destroy(self) self.Team = self.curteam end
NOTE: If the actor die and it's in the opposite team, the game crash If you change actor when he is of the opposite team he don't return to normal status, but you can reselect him.
if you have any improvement please post it
|
Mon Nov 23, 2009 7:13 pm |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Lua Scripted Actors and Abilities Topic
yeah here's an improvement --
learn how to post
|
Sat Dec 05, 2009 3:29 am |
|
|
DrLuke
Joined: Thu Sep 03, 2009 6:01 pm Posts: 56
|
Re: Lua Scripted Actors and Abilities Topic
Stop Using Global Variables Thanks
|
Sun Dec 06, 2009 5:14 pm |
|
|
|
|
Page 1 of 1
|
[ 7 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
|
|