Jump to content
Sign in to follow this  
-radkeff-

Cpp probs, eventhandler

Recommended Posts

I want a script to be executed when picking up/using a weapon..heres the code, check the last rows:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class Bizon

{

units[]={"SoldierESaboteurBizon"};

weapons[]={"Bizon"};

requiredVersion=1.260000;

};

};

class CfgAmmo

{

class default {};

class BulletSingle: default {};

class BulletSilencedSingle: BulletSingle {};

class Bizon: BulletSilencedSingle

{

hit=7

indirectHit=1

indirectHitRange=0.100000;

};

};

class CfgWeapons

{

class Default {};

class MGun: Default {};

class Riffle: MGun {};

class BizonBase: Riffle

{

scopeWeapon=1

scopeMagazine=1

model="\Bizon\Bizon";

modelOptics="\Bizon\optika_Bizon";

picture="\bizon\w_bizon.paa";

count=64

optics=1

opticsZoomMin=0.350000;

opticsZoomMax=0.350000;

distanceZoomMin=300

distanceZoomMax=300

displayName="$STR_DN_ADD_BIZON";

displayNameMagazine="$STR_DN_ADD_BIZON_MAG";

shortNameMagazine="$STR_DN_ADD_BIZON";

drySound[]={"weapons\M16dry",0.003162,1};

modes[]={"Single","Fullauto"};

class Single

{

ammo="Bizon";

multiplier=1

burst=1

displayName="$STR_DN_ADD_BIZON";

dispersion=0.010000;

sound[]={"\Bizon\bizon",0.000316,1};

soundContinuous=0

reloadTime=0.100000;

ffCount=1

recoil="riffleSilenced";

autoFire=0

aiRateOfFire=0.500000;

aiRateOfFireDistance=500

useAction=0

useActionTitle="";

};

class FullAuto

{

ammo="Bizon";

multiplier=1

burst=1

displayName="$STR_DN_ADD_BIZON_AUTO";

dispersion=0.015000;

sound[]={"\Bizon\bizon",0.000316,1};

soundContinuous=0

reloadTime=0.070000;

ffCount=1

recoil="riffleSilenced";

autoFire=1

aiRateOfFire=0.500000;

aiRateOfFireDistance=500

useAction=0

useActionTitle="";

};

};

class BizonMag: BizonBase

{

scopeMagazine=2

picture="\Bizon\m_bizon.paa";

};

class Bizon: BizonBase

{

scopeWeapon=2

magazines[]={"BizonMag"};

};

};

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class Man: Land {};

class Soldier: Man {};

class SoldierEB: Soldier {};

class SoldierESaboteur: SoldierEB {};

class SoldierESaboteurPipe: SoldierESaboteur {};

class SoldierESaboteurBizon: SoldierESaboteurPipe

{

displayName="$STR_DN_ADD_BIZON_SOLDIER";

weapons[]={"Bizon","NVGoggles","Throw","Put"};

magazines[]={"BizonMag","BizonMag","BizonMag","BizonMag","PipeBomb","PipeBomb","PipeBomb"};

};

};

class CfgNonAIVehicles

{

class ProxyWeapon {};

class ProxyBizon: ProxyWeapon {};

};

class EventHandlers

{

init = [this] exec "\bizon\cp.sqs";

};

};

Now im sure this is something very basic..whats wrong ??

Share this post


Link to post
Share on other sites

Should be

class EventHandlers

{

init = "[this] exec ""\bizon\cp.sqs"";";

};

Share this post


Link to post
Share on other sites

hmm...it didnt work...the strange thing is that i dont get a single error msg !...any more ideas ?

Share this post


Link to post
Share on other sites

Well, have you tried doing a hint out in the cp.sqs? I'll bet it simply does not get triggered when you think. You may wish to use a fired EH or some other? smile_o.gif

You can even do a hint directly from the EH line, not even the script.

Share this post


Link to post
Share on other sites
Guest BratZ
I want a script to be executed when picking up/using a weapon..heres the code, check the last rows:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class Bizon

{

units[]={"SoldierESaboteurBizon"};

weapons[]={"Bizon"};

requiredVersion=1.260000;

};

};

class CfgAmmo

{

class default {};

class BulletSingle: default {};

class BulletSilencedSingle: BulletSingle {};

class Bizon: BulletSilencedSingle

{

hit=7

indirectHit=1

indirectHitRange=0.100000;

};

};

class CfgWeapons

{

class Default {};

class MGun: Default {};

class Riffle: MGun {};

class BizonBase: Riffle

{

scopeWeapon=1

scopeMagazine=1

model="\Bizon\Bizon";

modelOptics="\Bizon\optika_Bizon";

picture="\bizon\w_bizon.paa";

count=64

optics=1

opticsZoomMin=0.350000;

opticsZoomMax=0.350000;

distanceZoomMin=300

distanceZoomMax=300

displayName="$STR_DN_ADD_BIZON";

displayNameMagazine="$STR_DN_ADD_BIZON_MAG";

shortNameMagazine="$STR_DN_ADD_BIZON";

drySound[]={"weapons\M16dry",0.003162,1};

modes[]={"Single","Fullauto"};

class Single

{

ammo="Bizon";

multiplier=1

burst=1

displayName="$STR_DN_ADD_BIZON";

dispersion=0.010000;

sound[]={"\Bizon\bizon",0.000316,1};

soundContinuous=0

reloadTime=0.100000;

ffCount=1

recoil="riffleSilenced";

autoFire=0

aiRateOfFire=0.500000;

aiRateOfFireDistance=500

useAction=0

useActionTitle="";

};

class FullAuto

{

ammo="Bizon";

multiplier=1

burst=1

displayName="$STR_DN_ADD_BIZON_AUTO";

dispersion=0.015000;

sound[]={"\Bizon\bizon",0.000316,1};

soundContinuous=0

reloadTime=0.070000;

ffCount=1

recoil="riffleSilenced";

autoFire=1

aiRateOfFire=0.500000;

aiRateOfFireDistance=500

useAction=0

useActionTitle="";

};

};

class BizonMag: BizonBase

{

scopeMagazine=2

picture="\Bizon\m_bizon.paa";

};

class Bizon: BizonBase

{

scopeWeapon=2

magazines[]={"BizonMag"};

};

};

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class Man: Land {};

class Soldier: Man {};

class SoldierEB: Soldier {};

class SoldierESaboteur: SoldierEB {};

class SoldierESaboteurPipe: SoldierESaboteur {};

class SoldierESaboteurBizon: SoldierESaboteurPipe

{

displayName="$STR_DN_ADD_BIZON_SOLDIER";

weapons[]={"Bizon","NVGoggles","Throw","Put"};

magazines[]={"BizonMag","BizonMag","BizonMag","BizonMag","PipeBomb","PipeBomb","PipeBomb"};

};

class EventHandlers

{

init = [this] exec "\bizon\cp.sqs";

};

};

class CfgNonAIVehicles

{

class ProxyWeapon {};

class ProxyBizon: ProxyWeapon {};

};

};

Now im sure this is something very basic..whats wrong ??

eventhandlers is a derivative of cfgvehicles

put it in your cfgvehicle class

ie: can have seperate eventhandlers for each vehicle class you configure

Share this post


Link to post
Share on other sites
Quote[/b] ]Well, have you tried doing a hint out in the cp.sqs?

unfortunately i thought of that too...cp.sqs is:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

hint "hora"

~1

goto "loop"

i guess i could try with another eh....

Share this post


Link to post
Share on other sites
I want a script to be executed when picking up/using a weapon..heres the code, check the last rows:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class Bizon

{

units[]={"SoldierESaboteurBizon"};

weapons[]={"Bizon"};

requiredVersion=1.260000;

};

};

class CfgAmmo

{

class default {};

class BulletSingle: default {};

class BulletSilencedSingle: BulletSingle {};

class Bizon: BulletSilencedSingle

{

hit=7

indirectHit=1

indirectHitRange=0.100000;

};

};

class CfgWeapons

{

class Default {};

class MGun: Default {};

class Riffle: MGun {};

class BizonBase: Riffle

{

scopeWeapon=1

scopeMagazine=1

model="\Bizon\Bizon";

modelOptics="\Bizon\optika_Bizon";

picture="\bizon\w_bizon.paa";

count=64

optics=1

opticsZoomMin=0.350000;

opticsZoomMax=0.350000;

distanceZoomMin=300

distanceZoomMax=300

displayName="$STR_DN_ADD_BIZON";

displayNameMagazine="$STR_DN_ADD_BIZON_MAG";

shortNameMagazine="$STR_DN_ADD_BIZON";

drySound[]={"weapons\M16dry",0.003162,1};

modes[]={"Single","Fullauto"};

class Single

{

ammo="Bizon";

multiplier=1

burst=1

displayName="$STR_DN_ADD_BIZON";

dispersion=0.010000;

sound[]={"\Bizon\bizon",0.000316,1};

soundContinuous=0

reloadTime=0.100000;

ffCount=1

recoil="riffleSilenced";

autoFire=0

aiRateOfFire=0.500000;

aiRateOfFireDistance=500

useAction=0

useActionTitle="";

};

class FullAuto

{

ammo="Bizon";

multiplier=1

burst=1

displayName="$STR_DN_ADD_BIZON_AUTO";

dispersion=0.015000;

sound[]={"\Bizon\bizon",0.000316,1};

soundContinuous=0

reloadTime=0.070000;

ffCount=1

recoil="riffleSilenced";

autoFire=1

aiRateOfFire=0.500000;

aiRateOfFireDistance=500

useAction=0

useActionTitle="";

};

};

class BizonMag: BizonBase

{

scopeMagazine=2

picture="\Bizon\m_bizon.paa";

};

class Bizon: BizonBase

{

scopeWeapon=2

magazines[]={"BizonMag"};

};

};

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class Man: Land {};

class Soldier: Man {};

class SoldierEB: Soldier {};

class SoldierESaboteur: SoldierEB {};

class SoldierESaboteurPipe: SoldierESaboteur {};

class SoldierESaboteurBizon: SoldierESaboteurPipe

{

displayName="$STR_DN_ADD_BIZON_SOLDIER";

weapons[]={"Bizon","NVGoggles","Throw","Put"};

magazines[]={"BizonMag","BizonMag","BizonMag","BizonMag","PipeBomb","PipeBomb","PipeBomb"};

};

class EventHandlers

{

init = [this] exec "\bizon\cp.sqs";

};

};

class CfgNonAIVehicles

{

class ProxyWeapon {};

class ProxyBizon: ProxyWeapon {};

};

};

Now im sure this is something very basic..whats wrong ??

eventhandlers is a derivative of cfgvehicles

put it in your cfgvehicle class

ie: can have seperate eventhandlers for each vehicle class you configure

when i try this code ofp kicks me into desktop without a error msg...c'mon guys..*sniff*..im getting depressed here sad_o.gif

Share this post


Link to post
Share on other sites
Guest BratZ

Try it with this { removed.Like I said it needs to be within your cfgvehicles

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class Man: Land {};

class Soldier: Man {};

class SoldierEB: Soldier {};

class SoldierESaboteur: SoldierEB {};

class SoldierESaboteurPipe: SoldierESaboteur {};

class SoldierESaboteurBizon: SoldierESaboteurPipe

{

displayName="$STR_DN_ADD_BIZON_SOLDIER";

weapons[]={"Bizon","NVGoggles","Throw","Put"};

magazines[]={"BizonMag","BizonMag","BizonMag","BizonMag",&quot

;PipeBomb","PipeBomb","PipeBomb"};

}; <----------------------------- remove this

class EventHandlers

{

init = [this] exec "\bizon\cp.sqs";

};

If your still getting errors ,its a matter of too many }; here and there I think.

I would go thru and check your brackets

Share this post


Link to post
Share on other sites

Oh joy and glory...i finally got it to work, thanks for the help bratz smile_o.gif  smile_o.gif

now if anyone is interested it was by removing these brackets:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class Man: Land {};

class Soldier: Man {};

class SoldierEB: Soldier {};

class SoldierESaboteur: SoldierEB {};

class SoldierESaboteurPipe: SoldierESaboteur {};

class SoldierESaboteurBizon: SoldierESaboteurPipe

{

displayName="$STR_DN_ADD_BIZON_SOLDIER";

weapons[]={"Bizon","NVGoggles","Throw","Put"};

magazines[]={"BizonMag","BizonMag","BizonMag","BizonMag","PipeBomb","PipeBomb","PipeBomb"};

};  <----------------------------this

class EventHandlers

{

init = [this] exec "\bizon\cp.sqs";

};<----------------------------this

};

class CfgNonAIVehicles

{

class ProxyWeapon {};

class ProxyBizon: ProxyWeapon {};

};

};

Share this post


Link to post
Share on other sites
Guest BratZ

NP glad to be of help, anything to help OFP addons.

Share this post


Link to post
Share on other sites

Ah, hehhe no kidding, if you want to add an event handler to a class, add it to the class. wink_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×