View unanswered posts | View active topics It is currently Fri Apr 26, 2024 6:28 pm



Reply to topic  [ 7 posts ] 
 Creating a Re-Gbulator? 
Author Message
User avatar

Joined: Sat Mar 23, 2013 7:59 am
Posts: 99
Reply with quote
Post Creating a Re-Gbulator?
Has ANYONE ever figure out if there was a way to add gibs back onto an actor? I mean Arms, and Lost limbs?

I was thinking there could be a way to overwrite the Arm status of someone with some kind of lua so they get new arms.

Possible or no?

I mean the ZomBots use a complex lua with a chance that upon the death and the head is intact that the head generates a new body with a nice animation and everything....

but i just want a smaller version and i need it to be used onto any actors the item is used on, etc.


Fri Apr 05, 2013 9:39 am
Profile
User avatar

Joined: Tue Apr 07, 2009 8:24 am
Posts: 193
Location: Australia
Reply with quote
Post Re: Creating a Re-Gbulator?
That won't work as there is no function exposed to lua. The zombot works by spawning a new actor in its place.


Fri Apr 05, 2013 1:03 pm
Profile
User avatar

Joined: Sat Mar 23, 2013 7:59 am
Posts: 99
Reply with quote
Post Re: Creating a Re-Gbulator?
helifreak wrote:
That won't work as there is no function exposed to lua. The zombot works by spawning a new actor in its place.


I was afraid of this, is it possible then to create a rebirth vehicle that kills an actor off screen, and then when selected again re-spawn that actor again?

Meaning, if I did create such a device, would I need to define the actor specifically by list, or would I just look for the appropriate Lua hooks to add to my device so it will take any actor, and then respawn last actor used on the device.


Fri Apr 05, 2013 2:49 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Creating a Re-Gbulator?
Not entirely sure what you're asking, but recreating actors is a simple matter of copying the actor's PresetName and creating a new actor later using that PresetName. What isn't simple is inventory copying, but it's still possible.

Here's a script of my repair kit, which is a particle fired from a device that completely "repairs" the user:
Code:
function Create(self)
   self.maxcopyitems = 15; -- maximum number of items to copy from the original actor
   self.sameitem = false;

   self.curdist = 20;
   for i = 1,MovableMan:GetMOIDCount()-1 do
      self.gun = MovableMan:GetMOFromID(i);
      if self.gun.PresetName == "Repair Kit Mk2" and self.gun.ClassName == "HDFirearm" and SceneMan:ShortestDistance(self.Pos,self.gun.Pos,SceneMan.SceneWrapsX).Magnitude < self.curdist then
         self.actor = MovableMan:GetMOFromID(self.gun.RootID);
         if MovableMan:IsActor(self.actor) then
            self.parent = ToActor(self.actor);
            self.parentname = self.parent.PresetName;
            self.repairedactor = CreateAHuman(self.parentname);
            self.repairedactor:AddInventoryItem(CreateHDFirearm("Repair Kit Mk2"));

            self.itemblocker = CreateTDExplosive("Stone","Ronin.rte");
            self.itemblocker.PresetName = "Repair Kit Blocker Rock";
            self.parent:AddInventoryItem(self.itemblocker);

            self.parent:GetController():SetState(Controller.WEAPON_CHANGE_PREV,true);

--            self.inventorychecker = self.parent:Inventory();
--            if self.inventorychecker ~= nil then
--               self.parent:SwapNextInventory(self.inventorychecker,true);
--            end

            for i = 1, self.maxcopyitems do

               self.potentialwep = self.parent:Inventory();
               if self.potentialwep ~= nil and self.potentialwep.PresetName ~= "Repair Kit Blocker Rock" then

                  if self.potentialwep.ClassName == "HDFirearm" then
                     self.repairedactor:AddInventoryItem(CreateHDFirearm(self.potentialwep.PresetName));
                  elseif self.potentialwep.ClassName == "TDExplosive" then
                     self.repairedactor:AddInventoryItem(CreateTDExplosive(self.potentialwep.PresetName));
                  elseif self.potentialwep.ClassName == "HeldDevice" then
                     self.repairedactor:AddInventoryItem(CreateHeldDevice(self.potentialwep.PresetName));
                  end

                  self.parent:SwapNextInventory(self.potentialwep,true);
               else
                  break;
               end
            end

            if self.parent:IsPlayerControlled() == true then
               self.parentplayer = self.parent:GetController().Player;
            end

            self.repairedactor.HFlipped = self.parent.HFlipped;
            self.repairedactor:SetAimAngle(self.parent:GetAimAngle(false));
            self.repairedactor.Pos = self.parent.Pos;
            self.repairedactor.Team = self.parent.Team;
            self.repairedactor.AIMode = Actor.AIMODE_SENTRY;
            self.parent.ToDelete = true;
            MovableMan:AddActor(self.repairedactor);
            if self.parentplayer ~= nil then
               ActivityMan:GetActivity():SwitchToActor(self.repairedactor,self.parentplayer,self.repairedactor.Team);
            end
            local sparticle = CreateAEmitter("Repair Kit Mk2 Sound Repair");
            sparticle.Pos = self.repairedactor.Pos;
            MovableMan:AddParticle(sparticle);
            self.repairedactor:FlashWhite(610);
            ActivityMan:GetActivity():ReportDeath(self.repairedactor.Team,-1);

         end
      end
   end

   self.ToDelete = true;
end

Mod is here if you want to play around with it.


Fri Apr 05, 2013 3:11 pm
Profile
User avatar

Joined: Sat Mar 23, 2013 7:59 am
Posts: 99
Reply with quote
Post Re: Creating a Re-Gbulator?
Ah, I have that mod already and didnt see that.


Well, is it possible to create a mod that works like this mod's mechs?

viewtopic.php?f=61&t=19665

I was going to have a within range on use icon if condition that will teleport the actor


So I see how you got the actor

self.parent = ToActor(self.actor);
self.parentname = self.parent.PresetName;
self.repairedactor = CreateAHuman(self.parentname);
self.repairedactor:AddInventoryItem(CreateHDFirearm("Repair Kit Mk2"));

self.itemblocker = CreateTDExplosive("Stone","Ronin.rte");
self.itemblocker.PresetName = "Repair Kit Blocker Rock";
self.parent:AddInventoryItem(self.itemblocker);

Thanks alot.

But how would I apply this to say, another actor or craft, and not just the device?


Also, what is this lua for?


self.parent:GetController():SetState(Controller.WEAPON_CHANGE_PREV,true);

-- self.inventorychecker = self.parent:Inventory();
-- if self.inventorychecker ~= nil then
-- self.parent:SwapNextInventory(self.inventorychecker,true);
-- end

for i = 1, self.maxcopyitems do

self.potentialwep = self.parent:Inventory();
if self.potentialwep ~= nil and self.potentialwep.PresetName ~= "Repair Kit Blocker Rock" then

if self.potentialwep.ClassName == "HDFirearm" then
self.repairedactor:AddInventoryItem(CreateHDFirearm(self.potentialwep.PresetName));
elseif self.potentialwep.ClassName == "TDExplosive" then
self.repairedactor:AddInventoryItem(CreateTDExplosive(self.potentialwep.PresetName));
elseif self.potentialwep.ClassName == "HeldDevice" then
self.repairedactor:AddInventoryItem(CreateHeldDevice(self.potentialwep.PresetName));
end

self.parent:SwapNextInventory(self.potentialwep,true);
else
break;
end
end

if self.parent:IsPlayerControlled() == true then
self.parentplayer = self.parent:GetController().Player;
end

self.repairedactor.HFlipped = self.parent.HFlipped;
self.repairedactor:SetAimAngle(self.parent:GetAimAngle(false));
self.repairedactor.Pos = self.parent.Pos;
self.repairedactor.Team = self.parent.Team;
self.repairedactor.AIMode = Actor.AIMODE_SENTRY;
self.parent.ToDelete = true;
MovableMan:AddActor(self.repairedactor);
if self.parentplayer ~= nil then
ActivityMan:GetActivity():SwitchToActor(self.repairedactor,self.parentplayer,self.repairedactor.Team);
end
local sparticle = CreateAEmitter("Repair Kit Mk2 Sound Repair");
sparticle.Pos = self.repairedactor.Pos;
MovableMan:AddParticle(sparticle);
self.repairedactor:FlashWhite(610);
ActivityMan:GetActivity():ReportDeath(self.repairedactor.Team,-1);

end
end
end

self.ToDelete = true;
end

is that to control the amount of repair kits in any given inventory so more dont accidentally spawn when the actor is recreated?


I want to make a actor, or a craft, without legs called a "Cybernetics Lab". If I "borrowed" the type of lua from the apocalypse mod, where when an actor selects a pie function actor is added to the inventory and killed and then respawned, how would I do that?


Fri Apr 05, 2013 6:56 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Creating a Re-Gbulator?
Jackslancer wrote:
Also, what is this lua for?

That is what actually copies the actor's inventory.

And to actually get a pointer to other actors, it depends on how you'd want it to work. You'd either need to do an area scan or a ray cast of some sort.


Fri Apr 05, 2013 7:05 pm
Profile
User avatar

Joined: Sat Mar 23, 2013 7:59 am
Posts: 99
Reply with quote
Post Re: Creating a Re-Gbulator?
CaveCricket48 wrote:
Jackslancer wrote:
Also, what is this lua for?

That is what actually copies the actor's inventory.

And to actually get a pointer to other actors, it depends on how you'd want it to work. You'd either need to do an area scan or a ray cast of some sort.


hmmmmm ok I will go read up on my lua and report back later..... hopefully...


Fri Apr 05, 2013 7:10 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.084s | 15 Queries | GZIP : Off ]