#Help pls

1 messages · Page 1 of 1 (latest)

devout zodiac
#

Battery flashlight system dont work

#

i have a flashlight battery system for when i use the flashlight the battery losse intensity until he dont have any intensity but i decided to try create a script for when pick a battery my flashlight recharge the flashlight intensity

#

but dont work

devout zodiac
#

after the "batteryPercentage = Mathf.Clamp(batteryPercentage, 0, 100);" line

#

and i enter in the hitbox of the battery but dont add battery percentage for my falshlight

#

or intensity

wraith umbra
#

You need some sort of OnTriggerEnter method to actually call pickup

devout zodiac
#

but have

#

the on trigger enter

wraith umbra
#

oh, oops

#

Make sure the battery has a collider, and it's set to "IsTrigger"

#

Player also needs a rigidbody. Add a debug.log to the beginning of OnTriggerEnter to make sure it's actually running

devout zodiac
devout zodiac
#

i ad the Debug.Log before or after the void ?

wraith umbra
#

Yeah if that's your question, this is way too advanced for you

devout zodiac
#

sorry if i am starter, but i need this script i am mading a terror game

wraith umbra
#

You need to learn some basic C# to get it going then

unkempt merlin
#

i have the same problem

#

i need a script for battery pick up system

#

but the what i have dont work

devout zodiac
#

:/

#

pls anyone help

devout zodiac
wraith umbra
#

What kind of errors?

devout zodiac
#

i dont now i doo right but probrably not

#

syntax error

#

and name other don thave context

#

and private dont is valid

hollow sphinx
#

Ok that is really not valid

#

You cannot Debug.Log there at all ever

#

And your issue is you put IsTriggerEnter, the callback is called OnTriggerEnter

wraith umbra
#

Oh Jesus

#

Good luck

devout zodiac
#

but jon tell me to put Istriggerenter and no Ontrigger

hollow sphinx
#

Don't lie to me

#

He told you to mark the Collider component on the GameObject in the Scene as IsTrigger

#

He did not tell you to write IsTriggerEnter

devout zodiac
#

but is

#

all the time is

hollow sphinx
#

Does it work now after the changes I asked for?

devout zodiac
#

but what changes you asked bro

#

you dont asked to i doo any changes

#

cotinue dont working

hollow sphinx
#

Let me make one thing very clear, you are testing my patience

#

Two things, do them

#

Remove the stupid Debug.Log, which is never valid in it's current location

#

And fix the method name

devout zodiac
#

i remove the debuger

hollow sphinx
#

I hear that all the time, if you think your lack of sleep is impeding your ability, you should rest

devout zodiac
#

but i wana only finish this script

hollow sphinx
#

Then do the changes I mentioned

devout zodiac
#

bro but OnTriggerEnter its what its in the first screenshot

#

like this is the first script that

#

was not working

hollow sphinx
#

Define not working

#

Is the Player tagged as such?

#

Is the collider a trigger?

#

Is the script on an object?