- Home /
Why won't my power up work to buff my sword?
So i'm trying to make the damage on my sword go from 50 up to 100 once I walk into a power up orb. This process should also activate the fire particle system which is a child of my sword already. I've had to rewrite this a number of times due to different errors and in my simplifying it I think I've lost sight of any alternate way of doing it...but I usually get any number of errors from this when I actually collide with the power up. Any help is appreciated.
script 1: On Sword
static var fireActive = false;
function Update (){ if (fireActive){ Damage += 50; fireActive = false; }
script 2: On Fire
var preFireBuffed : int = MeleeSystem.Damage; var fireBuffed : int = MeleeSystem.Damage + 50; static var Fire : Transform; //filled with particle system Fire
function Update(){ if (Fire.active){ MeleeSystem.fireActive = true; } }
script 3: On Power Up Orb
var Power : Transform; // the particle system called Fire var energySource : Transform; //the collider that this code is on var weapon : Transform; //filled with my sword which is active
function OnTriggerEnter (theCollider : Collider){ if (theCollider.tag == "Player" && weapon.active == true){ FireBuff.Fire1 = true; Power.active = true; Destroy(gameObject); } }
Please format the code snippets in your post to make it more readable so the experts can help you. :)
Enter the expert...hehe.
First, I think you want to declare your Transforms as GameObjects.
It looks like you need to set fireActive on your sword to true in the OnTriggerEnter if statement.
I'm not sure what FireBuff.Fire1 refers to. $$anonymous$$aybe this is supposed to be fireActive?
Your answer
Follow this Question
Related Questions
Unity 5 can't start up 0 Answers
Interact with Objects around the player 0 Answers
Static Variables Issue 0 Answers
Unity C# question 2 Answers