Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
fpsarmedunity

help with granade script port fpskit

Question

Hi I'm trying to import the grenade script from fpskit 1.3.5 c# version to my template based on fpskit 1.6

 

i successefully ported the melee script andall works fine (even thanks to TheMars2011 help) 

but now with GrenadeScript i have some issue since weapon i correcly picked up and drawn onscreen but animations doesnt play and i get an erro on console related to this line of code

 

weaponAnim.GetComponent<Animation>()[grenadePull].wrapMode = WrapMode.ClampForever;

 

NullReferenceException: Object reference not set to an instance of an object
GrenadeScriptOrig.Start () (at Assets/FPSKIT135/Meshes/grenadeOLDstyle/GrenadeScriptOrig.cs:39)
 

 

here the script

 

Please login or register to see this code.

any hint about that?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

replace:

Please login or register to see this code.

with public Animation anim;

 

and:

Please login or register to see this code.

with anim.****

 

Assign animation component and make sure all animations are assigned.

 

Share this post


Link to post
Share on other sites

  • 0

yes i figuret it after i asked lol.. btw now correct animations and acorrect referernces are assigned and i dont  console any error , weapon is correcly picked up and i' able to drop it too ect. anims plays correcly and all works fine.. my only problem is due to the fact that if player take one grenade gameobject and after try to ppicked up others grenades player get message that weapon is already equipped... even if player consumed all grenades it has...

i modified the wpeaon manager script to tell if there is a grenade equipeed (SetElement 6) player can take the amount of ammo specified into pickup scritp but something went wrong and player is not able to take othr grenades after first..

 

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites
  • 0

No one can help me

 

my only BIG issue is that if player pickup a grenade and after tries to pickup another grenade i got the messeage "weapon already equipped" and obviusly this is not supposed to work this way..

 

So i wathced the code into  fpskt 1.3.5 converted in c# some years ago and found the lines of coed i need to add in weapon manager

 

Please login or register to see this code.

 

and this

 

Please login or register to see this code.

 

 

and accordly added the "StickGrenades"  field in my pickup script this way

 

Please login or register to see this code.

 

So i wathced the code into your fpskt 1.3.5 you converted in c# some years ago and found the lines of coed i need to add in weapon manager

 

Please login or register to see this code.

 

 

Please login or register to see this code.

 

 

and accordly added the "StickGrenades"  field in my pickup script this way

Please login or register to see this code.

 

and now i got some results since player can pickup the correct grenade amount specified into pickup scirpt but i have always the old issue related to the "weapon already equipped"

 

i saw in a old fpskit project i found on internet (but it was JS) named ultimate survivor 2016 that this system works correcly since developer added several type of greandes/throwables and the code is the same but JS obviusly

 

 

can please someone try to help me.. i cound pay if necessary..

 

bests

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...