Data Realms Fan Forums http://45.55.195.193/ |
|
Undroppable weapons http://45.55.195.193/viewtopic.php?f=1&t=15529 |
Page 1 of 1 |
Author: | Gotcha! [ Wed Jun 24, 2009 8:01 am ] |
Post subject: | Undroppable weapons |
Hi people, I am in the process of making an actor that comes equipped with its own weapons and it is very important that this actor doesn't lose these since it won't be able to pick up any others. Is there a way to disable the ability to drop its weapons without resorting to using a turret? (The reason I don't want to use a turret is that it'll carry more than one weapon.) |
Author: | Grif [ Wed Jun 24, 2009 8:06 am ] |
Post subject: | Re: Undroppable weapons |
If the weapon is dropped automagically return it? |
Author: | MaximDude [ Wed Jun 24, 2009 8:09 am ] |
Post subject: | Re: Undroppable weapons |
Well, you can set the JointStrength of the weapon to something like over9000, that will ensure the weapon won't get blown/shot out of the actors hands. |
Author: | mail2345 [ Wed Jun 24, 2009 8:22 am ] |
Post subject: | Re: Undroppable weapons |
Try rapidly disabling the controller state: WEAPON_DROP If that fails, constantly check for the weapon, and add to inventory if it odes not have it. The weapon on update self lifetimes to 0. |
Author: | Gotcha! [ Wed Jun 24, 2009 8:27 am ] |
Post subject: | Re: Undroppable weapons |
@Grif: That'd be amazing. How would I accomplish that? @MaximDude: That's not an issue thankfully. They can't be hit by anything. @mail2345: I think you're talking lua here? |
Author: | Roon3 [ Wed Jun 24, 2009 8:46 am ] |
Post subject: | Re: Undroppable weapons |
Give the weapon low gil so it breaks when hitting the ground then check for WEAPON_DROP and if the actor is missing that weapon in his inventory, add a new one. (Yes this does require Lua) |
Author: | Geti [ Wed Jun 24, 2009 8:59 am ] |
Post subject: | Re: Undroppable weapons |
no, just have the weapon's lua (currently only run on weapons that noone is holding) add the weapon to the nearest actor's inventory, and delete itself. |
Author: | piipu [ Wed Jun 24, 2009 8:59 am ] |
Post subject: | Re: Undroppable weapons |
Code: function Update(self) self.LifeTime = 0 end Code: function Update(self) i = 1 self.gunfound = 0 while i < MovableMan:GetMOIDCount() - 1 do --iterate through everything self.thingie = MovableMan:GetMOFromID(i) --get a pointer to the object if self.ID == self.thingie.RootID and self.thingie.presetName == "gun presetname here" then --if self has the gun in inventory self.gunfound = 1 end i = i + 1 end if self.gunfound == 0 then --if the gun wasn't found, add the gun into the actor's inventory local gun = CreateHDFirearm("gun preset name here") self:AddInventoryItem(gun) end end |
Author: | Geti [ Wed Jun 24, 2009 9:06 am ] |
Post subject: | Re: Undroppable weapons |
self.ToDelete = true is marginally faster than lifetime tweaks, but that is probably a better way of doing it if you only want the weapon to be undroppable for one actor. |
Author: | Gotcha! [ Wed Jun 24, 2009 9:08 am ] |
Post subject: | Re: Undroppable weapons |
Thanks! You are lifesavers. |
Author: | Grif [ Wed Jun 24, 2009 6:53 pm ] |
Post subject: | Re: Undroppable weapons |
Also, lifetime = 0 means infinite lifetime, not no lifetime. |
Author: | mail2345 [ Wed Jun 24, 2009 7:08 pm ] |
Post subject: | Re: Undroppable weapons |
@piipu He has multiple weapons, so self:HasObject("gun name") works better. |
Author: | numgun [ Wed Jun 24, 2009 7:52 pm ] |
Post subject: | Re: Undroppable weapons |
Eh, if the actor will recreate a gun each time it drops, you will be able to spam that. And not only that, but you wont be able to destroy the gun ever since it keeps respawning. Just make sure JointStrength is very high so knocking it off the actor will be tough enough (50000 = rocket to the face). Then if you want the weapons to be able to pickup again, but not let any other units pick them up, check out Darlos' code on the heavy soldier weapons. It has a good example of making weapons be able to pickup only by certain units. |
Author: | Grif [ Wed Jun 24, 2009 8:01 pm ] |
Post subject: | Re: Undroppable weapons |
Hurfadurf numgun, if you DELETE the previous copy and then add a new one to the actor it's not going to be "spammable". |
Author: | piipu [ Wed Jun 24, 2009 8:51 pm ] |
Post subject: | Re: Undroppable weapons |
@Mail: Yeah, I just thought about it myself. Besides, the gun doesn't have a MOID when it's not held. Code: function Update(self) if not self:HasObject("gun name") then gun = CreateHDFireArm("gun name") self:AddInventoryItem(gun) end end |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |