|
Page 1 of 1
|
[ 10 posts ] |
|
Author |
Message |
SnowMonster20
Joined: Wed Jul 16, 2008 12:49 am Posts: 226
|
Non dropable weapons
How do you make it so a weapon can not be dropped?
Also if its dropped the GibImpulseLimit set really low make it pop upon hitting the ground right?
|
Mon Sep 05, 2011 2:03 am |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
Re: Non dropable weapons
Add a lua script to said gun and make it force the parent to not drop it. Something like: Code: function Create(self) self.parent = MovableMan:GetMOFromID(self.RootID) end function Update(self) self.parent:GetController():SetState(WEAPON_DROP,false) end I'm not entirely sure though, something looks wierd.
|
Mon Sep 05, 2011 2:25 am |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Non dropable weapons
It seems constantly forcing the actor to not drop stuff does not work. (Constantly making it drop does work, though, and is fun to watch when an unarmed AI actor wants it) If an item that replaces itself back into one's inventory when dropped is acceptable, use this. Mind you, this can be exploited to repair damaged weapons, the replacement won't have the same wounds. Code: function Update(self) if self.ID ~= self.RootID then self.operator = ToActor(MovableMan:GetMOFromID(self.RootID)) elseif self.operator then if self.operator.ID ~= 255 and self.Lifetime ~= 1 then local Replacement = CreateHDFirearm(self.PresetName) self.operator:AddInventoryItem(Replacement) self.Lifetime = 1 end end end I could try to make it so that this can't be exploited for instant reloading, if that's needed.
Last edited by Azukki on Mon Sep 05, 2011 3:34 am, edited 1 time in total.
|
Mon Sep 05, 2011 3:21 am |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
Re: Non dropable weapons
Hey Azukki, could this work? Code: function Create(self) self.parent = MovableMan:GetMOFromID(self.RootID) end function Update(self) if self.parent == nil then self.parent = MovableMan:GetMOFromID(self.RootID) end if self.parent:GetController():IsState(WEAPON_DROP) then self.parent:GetController():SetState(WEAPON_DROP,false) end end
|
Mon Sep 05, 2011 3:25 am |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Non dropable weapons
Before, I attempted constantly telling it to not drop. I seriously doubt waiting until it's already trying to drop [an instantaneous process] and telling it not to in response will do any better. And I don't think you need the create function in there, since parent, when undefined, gets defined in the update function. And you'll get errors when no one's holding it, because it is its own parent when unheld, and then you'll attempt to check and set states of its controller, which is invalid because it has no controller nor controller states because it's a HDFirearm.
Resolve those issues and maybe some minor formatting fixes, and it should work.
Last edited by Azukki on Mon Sep 05, 2011 5:53 am, edited 3 times in total.
|
Mon Sep 05, 2011 3:29 am |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
Re: Non dropable weapons
Uh, I still need to learn a lot more lua.
|
Mon Sep 05, 2011 3:42 am |
|
|
alphagamer774
Joined: Wed Feb 10, 2010 4:06 am Posts: 1294 Location: Comox, BC, Canada
|
Re: Non dropable weapons
When did azukki get so epic with lua?
|
Mon Sep 05, 2011 4:01 am |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Non dropable weapons
Well, I heard CC would have Lua scripting a couple days after that was announced, so I downloaded a Lua compiler, failed (to format) basic addition, and it was a gradual process of trials and errors from there to here.
|
Mon Sep 05, 2011 5:50 am |
|
|
SnowMonster20
Joined: Wed Jul 16, 2008 12:49 am Posts: 226
|
Re: Non dropable weapons
I think replacing would work. Only reason I need it is cause the "weapon" is supposed to be part of the actor (Digging claws) so realistically you cant drop those.
Not like people or AI will go around dropping them though. Although hands dont grow back so maybe I'll just leave it at a high gibimpulse. That way if dropped or shot it wont come back.
So would that replace code work for attachables? Say for example a tail getting shot off then growing back after the actor gets a kill or a timer runs out?
|
Mon Sep 05, 2011 6:36 am |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Non dropable weapons
Oh, it's specific to an actor? Mentioning that before might have saved some trouble. In that case, you could copy the method I used for the [SE] Rifleman's Neck Breaker device. It may be slightly superior and simpler. But if this works well enough, and you don't want to mess with it, that works too.
In the case of attachables, that would be very different. It used to be impossible without entirely replacing the actor, and if B25 has made it possible, I know nothing of how to do it. I can think of a workaround, though, that also may or may not be possible.
|
Mon Sep 05, 2011 6:52 am |
|
|
|
|
Page 1 of 1
|
[ 10 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
|
|