Author Topic: Could someone make it so you cant jet in this?  (Read 4295 times)

I've tried Player_NoJet
Player_nojet
Player_No_Jet
Player_noJet

and Player_Nojet

The add-on file is Player_No_Jet
The datablock name is PlayerNoJet
Case doesn't matter
These are things you could solve by looking at and opening the file

Post your current code
« Last Edit: October 07, 2013, 11:36:19 PM by Headcrab Zombie »

Code: [Select]
datablock PlayerData(OmgDatablock : PlayerNoJet) {
   uiname="Noice";
};
function OmgDatablock::onTrigger(%this,%obj,%slot,%io)
{
   Armor::onTrigger(%this,%obj,%slot,%io);
   if(%slot==4&&%io&&%obj.getClassName()$="Player")
      %obj.spawnProjectile(200,RocketLauncherProjectile,"1 1 1","1 1 1");
}

The problem is most likely because your add-on is executing before player_nojet. The solution is to
Use forceRequiredAddon whenever you have dependancies like this
Theres a sticky on the subject
« Last Edit: October 07, 2013, 11:38:35 PM by Headcrab Zombie »

Can I make it independent and not require it to be enabled, like adding
Code: [Select]
minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;
somewhere?

Yeah, just put that in the datablock definition.

Also, please, do everyone who looks over your code, including people trying to learn, people trying to help you, and your future self a favor:
Don't cram everything together like you did in that if statement, space it out
Even if thats not the problem, it still looks really bad and makes your code less readable

Like this
if(%slot == 4 && %io && %obj.getClassName() $= "Player")

Yeah, just put that in the datablock definition.

Also, please, do everyone who looks over your code, including people trying to learn, people trying to help you, and your future self a favor:
Like this
if(%slot == 4 && %io && %obj.getClassName() $= "Player") <-- Ok thank
Which line is the datablock definition
« Last Edit: October 07, 2013, 11:57:05 PM by Legoboss »

Lines one through three
Put in inside the brackets, like uiName

Lines one through three
Put in inside the brackets, like uiName
So like

Code: [Select]
datablock PlayerData(OmgDatablock : PlayerNoJet) {
   uiname="Noice";
"minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;"
};
function OmgDatablock::onTrigger(%this,%obj,%slot,%io)
{
   Armor::onTrigger(%this,%obj,%slot,%io);
if(%slot == 4 && %io && %obj.getClassName() $= "Player")
      %obj.spawnProjectile(200,RocketLauncherProjectile,"1 1 1","1 1 1");
}


or

Code: [Select]
datablock PlayerData("minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;") {
   uiname="Noice";
"minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;"
};
function OmgDatablock::onTrigger(%this,%obj,%slot,%io)
{
   Armor::onTrigger(%this,%obj,%slot,%io);
if(%slot == 4 && %io && %obj.getClassName() $= "Player")
      %obj.spawnProjectile(200,RocketLauncherProjectile,"1 1 1","1 1 1");
}



The first one
But without random indents and without the " on the beginning of the third line

The first one
But without random indents and without the " on the beginning of the third line
that only messes it up more

aaa I am horrible at this

Code: [Select]
datablock PlayerData(OmgDatablock : PlayerNoJet) {
uiname="Noice";
minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;"
};
function OmgDatablock::onTrigger(%this,%obj,%slot,%io)
{
   Armor::onTrigger(%this,%obj,%slot,%io);
if(%slot == 4 && %io && %obj.getClassName() $= "Player")
      %obj.spawnProjectile(200,RocketLauncherProjectile,"1 1 1","1 1 1");
}

wish someone could do it and get it to work so I can have it
« Last Edit: October 08, 2013, 12:30:53 AM by Legoboss »

function OmgDatablock::onTrigger(%this,%obj,%slot,%io)
{
   parent::onTrigger(%this,%obj,%slot,%io);
if(%slot == 4 && %io && %obj.getClassName() $= "Player")
      %obj.spawnProjectile(200,RocketLauncherProjectile,"1 1 1","1 1 1");
}
and remove the " after the canJet = 0;

parent::onTrigger(%this,%obj,%slot,%io);

That makes no difference. Method inheritance does not work for datablocks - the parent is always Armor.

That makes no difference. Method inheritance does not work for datablocks - the parent is always Armor.
today i learned

function OmgDatablock::onTrigger(%this,%obj,%slot,%io)
{
   parent::onTrigger(%this,%obj,%slot,%io);
if(%slot == 4 && %io && %obj.getClassName() $= "Player")
      %obj.spawnProjectile(200,RocketLauncherProjectile,"1 1 1","1 1 1");
}
and remove the " after the canJet = 0;
don't you need the UI name as well?

don't you need the UI name as well?
just remove the quotation at the end of
Code: [Select]
canJet = 0;"code if very picky and if you break its rules it's going to be mad.