View Full Version : Exec scripted enhancement from ccp
vader_21vb
Nov 25 2002, 18:01
I'm trying to add script to a Addon, but I can only execute script true "class UserActions", have any found a way to exec script in addon without haveing the player "activating" it true "class UserActions" in the ccp file ?
I was hoping to add i line int the CCP , like :
Initline="[this,""MH-6""] exec ""\Addonname\Sling.sqs""";
Hi
Since 1.75
Add your script to the file of your addon alongside your model.p3d and your config.cpp
In the config.cpp of your addon include this
</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class EventHandlers
{
init = [this] exec "\YourAddonsNamehere\YourScrptsNameHere.sqs";
};[/QUOTE]<span id='postcolor'>
config.cpp executable events are listed in the latest command Ref They include things like GetIn, Getout, Fuel, etc
Kind Regards walker
vader_21vb
Nov 27 2002, 21:00
thanx , it works, now I only need to find a way to get the Object name of my addon transfered to the script, cos "this" is not the same var anymore..
Does that mean that scripts in addons are MP usable? If I include them into the pbo everyone who uses the addon will have the script and so can run it (if it is run from the init line of the config.cpp).
For instance, if I want to change the textures of an addon with only one p3d file I could make selections in Oxygene, define them in the CfgModels section, add a script.sqs to the pbo file with a line like this for every texture - selection:
vehicle setObjectTexture [hidearrayindex,texturename]
and add this Init-Line thing to the config.cpp, which will run the script.
And if someone would place the addon in the editor it would swap the files if the addon is used...
But does it work in MP?
Joe
</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (PSC @<hidden> Dec. 12 2002,22:24)</td></tr><tr><td id="QUOTE">But does it work in MP?[/QUOTE]<span id='postcolor'>
Unfortunatelly it does not. Init event handler is executed only ony the computer that owns the unit.
Ok, thanks. Thats what I was fearing (since it was written in that other topic). But sometimes I'm a bit slow regarding some things (especially script/code things). Thats why I asked again to be 100% sure. Thanks again.
http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/xmas.gif Fröhliche Weihnachten http://www.flashpoint1985.com/ikonboard301/iB_html/non-cgi/emoticons/xmas.gif ach ham wir ja noch gar nicht...
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.