Jump to content
Sign in to follow this  
Powerslide

Properties are not inherited

Recommended Posts

I have several custom objects in my island, Canadian Prairie, and I have oiltanks and custom fuelstations. The oiltanks have burn scripts as do the fuelstation but for some reason the burn only works on the oiltanks. Also you cant fuel up from the fuel station. Here is a code sample maybe someone can see where I went wrong.

class CAF_Oiltank: FuelStation

{

icon="Fuel_object";

ladders[]={ {"start","end"} };

scope=2;

cost=600000;

armor=100;

vehicleClass="Canadian Objects";

model=\CAF_Prairie\CAF_Oiltank.p3d;

displayName="Oiltank";

destrType = "DestructEngine";

accuracy=0.50;

secondaryexplosion=5000;

transportFuel = 100000;

class EventHandlers

{

killed = "_this exec ""\CAF_Prairie\fire.sqs""";

};

};

class CAF_PetroCanada: CAF_Oiltank

{

icon="Fuel_object";

armor=15;

accuracy=0.60;

nameSound="fuelstation";

vehicleClass="Canadian Objects";

model="\CAF_Prairie\CAF_Petrocan.p3d";

displayName="Petro Canada Gas Station";

destrType = "DestructEngine";

cost=10000;

secondaryexplosion=2500;

transportFuel = 10000;

class EventHandlers

{

killed = "_this exec ""\CAF_Prairie\fire.sqs""";

};

};

class CAF_Pumpjack: CAF_Oiltank

{

model="\CAF_Prairie\oelpumpe";

armor=5;

vehicleClass="Canadian Objects";

displayName="Pumpjack";

destrType = "DestructEngine";

secondaryexplosion=500;

cost=1000;

class EventHandlers

{

killed = "_this exec ""\CAF_Prairie\fire.sqs""";

};

};

Share this post


Link to post
Share on other sites
Guest

Cannot refuel from it before or after Binarizing?

Share this post


Link to post
Share on other sites
(...) Here is a code sample maybe someone can see where I went wrong.

Make sure you've set memory points for the fuel station correctly (I don't remember how they're called but I'll check that when I'll return home)

Share this post


Link to post
Share on other sites

1 or more vertexes in a selection called

doplnovani

that mark the place where you want the

'refuel at fuel station' action to appear

Share this post


Link to post
Share on other sites
1 or more vertexes in a selection called

doplnovani

that mark the place where you want the

'refuel at fuel station' action to appear

Would that go in the memory LOD? Also I still don't understand why the burn won't function.

Share this post


Link to post
Share on other sites
1 or more vertexes in a selection called

doplnovani

that mark the place where you want the

'refuel at fuel station' action to appear

Would that go in the memory LOD? Also I still don't understand why the burn won't function.

As scousejedi said those vertices are called doplnovani and doplnovani2. They should be set in the memory LOD.

I don't know why your burn fuction doesn't work, but if you're setting your gasstation through the wrpeditor then you can forget about eventhandlers - I'm not 100% sure about it, but it seems that when the addon is placed in the wrpfile (not through the in-game editor), then the only section engine takes from the config is class actions, and rest is taken from the p3d file itself.

Share this post


Link to post
Share on other sites

Actually, I placed my custom binarized objects through visitor after running em through bisbin and i used an open unbinned cpp, and the eventhandler works, but only for the oiltank for some reason, even though i classed the other objects to the oiltank and included the eventhandler in the cpp for each object.

Working burn script in wrp:

tanks.jpg

Where I need fuelstation burn script as well

pc.jpg

Share this post


Link to post
Share on other sites

I think its a problem with how the eventhandler accesses the script. This is the script line:

_path = "\CAF_Prairie\"

_object = _this select 0

and the eventhandler

killed = "_this exec ""\CAF_Prairie\fire.sqs""";

So it only works with the first object it is assigned to. I'm not much at scripting but could I do this? Make another script based on the same and

_object1 = _thisA select 0

And in the event handler

killed = "_thisA exec ""\CAF_Prairie\fire.sqs""";

Or is there a way to add it all to the same script?

Share this post


Link to post
Share on other sites
Guest

*Bump*

I'd really like to know about this one too. There is no MLOD copy of the original Fuel Station floating about (AFAIK...anyone who can help about in that aspect I'd love to hear from you).

The basic thing is how to have an object that can be refuelled from that can be Binarized and placed on an island through the .wrp file. Obviously it is possible...BIS have fuel stations...so the question is...HOW? Are the useractions that have to be added into the cpp....and what are they exactly? Etc.....  smile_o.gif

Share this post


Link to post
Share on other sites

@powerslide:

might help if you could post the class of your fuelstation, too,

not only the inheritetd classes.

maybe you have a tiny mistake in your f.station class that makes the eventhandler not working, but in inherited classes you overrode a property that makes it work for them.

your latest idea of adding multiple variants of eventhandler scripts won´t help, because each "physical" object has it´s own eventhandler thread at runtime, so it deosn´t matter how your variables are named...

another thing: each type of eventhandler has a specific set of arguments that can be passed. a good documentation on eventhandlers can be found here:

http://www.ofpec.com/editors/comref.php?letter=3#Event%20handlers

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  

×