It would be handy to be able to set the damage and speed of a projectile in the weapon script. I want to make a laser that is charged when fire is down, then when its released shoot with the damage being based on the length of time fire has been down
Hmm... i tried this a bit ago, but failed. i'd like to implement it in my new gun - the nightspitter, a rapid fire low strength with an awful lot of ammo.
Answer: Global Variables
You know how to use them?
(it would be just as easy as if you could enter them normally into the weapon script, but different API ofcourse

.)
Are those the same as the data.___ commands?
You could use messages (i think) or the data.___ thing. It worked for me when I made my code buttons.
QQQQQ
Chainfist: Code buttons??
Anyway, yea, they are the data. commands

.
How do I use global variables?
With all these:
Code:
data
---
add(name,value); // value can be any js primitive (int, decimal, string, boolean)
sub(name);
set(name,value); // returns false if name doesn't exist
get(name); // returns value
addScriptSpecific(name,value); // value only viewable by same script
subScriptSpecific(name);
setScriptSpecific(name,value);
getScriptSpecific(name);
These can be called from any script.
I'm not sure what set(name) does. Also, whats the difference between a scriptspecific and just a variable in the script?
Probably this...
Code:
// Player.js
function playerConstruct
{
data.add('projDmg', 55);
}
function changeDamage
{
data.set('projDmg', 76);
}
// projectile file
var dmg = get('projDmg');
// set projectile damages to: dmg