Jump to content

alleycat

Member
  • Content Count

    1003
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by alleycat

  1. While trying to create my own ghetto water drinking items I have encountered a problem: If I want to have an addaction for a player to use if he has a specific item in inventory how do I do that in an efficient way? I know how to check the player inventory for items, however hammering the game with a looping script seems not a good idea. Is there some event handler that detects whenever the player inventory is changed?
  2. Does this also work on scripts that call other scripts? For example if I want to precompile the toplevel script that itself calls 3 other lower scripts which then call each call another script for each town on the map? When I used waituntil the toplevel scripts called complete long before the actual work by the lower scripts was completed. Also, are interrupts safe to use as in, not blocking the other scripts? If I would create a scripts that sets the weather to random then waits an hour until it repeats itself?
  3. I am coding a script that places AI units all over the map after examining a lot of locations. Basically it ends up with a few thousand lines of log (if each loop writes something in the log). The problem is that (so far only on a local server) the script creeps a few minutes into the mission start. How to front load stuff so the server (ideally) dedicated does all of it before players join the mission? I have tried waituntil but that did not appear reliable as the scripts stepped over each other.
  4. You could try to detect what weapon the killer used in the last few seconds before the player died. In pseudocode: 1. when killer throws grenade, start some script that catches any kill up to several seconds after it. Not sure how to do it
  5. alleycat

    SQF Encryptor

    I get what you mean, but let me explain something. Lets take the models you created. If someone would decompile them to look at them int a modeling program to find out how properly model complex things that would be ok I guess, someone trying to learn from your work. But if he rips the models and repackages them as his own you would certainly not like it. Even worse if he puts them into a mod that becomes very successful and even more worse if that success is relied on the models you made. That would be someone else profiting off your work. Now lets translate this to programming. Looking at someones scripts to learn how to do stuff is ok, copying and re-using is not. Unless the author allows it. The issue with coding is that it is far easier to copy stuff and get away with it than copying models because it takes a lot more effort to cover your tracks when stealing models. And there is a huge gap between relying on help for some snippet and 100% depending on outside help.
  6. alleycat

    SQF Encryptor

    That is very useful, thanks! btw can I simply pbo-pack my script and load it within a @folder or does it need its own cpp?
  7. alleycat

    SQF Encryptor

    But how to access these scripts? Assuming they have to be in the addons folder and not in the mission folder?
  8. alleycat

    SQF Encryptor

    I dont get it, isnt a mission always a packed pbo that is sent to the client when he connects?
  9. alleycat

    SQF Encryptor

    WTF is wrong with the haters? There is nothing wrong with encryption. What some people dont get is that sharing small scripts and helping others with scripting problems is a good thing. But having something very large that you spent weeks or months coding ripped and re-used is not a good thing. Anyone who babbles this shit about people wanting to protect their hard work should really try to think from someone else's perspective. It is easy to say that sharing is fun and nice if you are the one receiving free stuff. But wait until you code something a few thousand lines of code worth and then have it copied, taken apart and therefore ruined its success, because your work is scattered and diluted in quality. Point is, always free sharing no matter what is not always a good thing. Hard work should be rewarded which is achieved by having complete control over your work and gathering a large playerbase in this case. Most mission/addon makers, while doing the work for free in a monetary sense, do not do it for free in the sense of the work getting attention. So the guy who made the stuff GETS TO BATH IN THE GLORY IT BRINGS. Imagine badass modders like gnat having his models ripped and re-used with hello kitty textures or sickboy having the source code of SIX stolen and then many derivates of it popping up, being turned into porn downloading torrent programs? They would probably track you down and bitch slap you so hard that you will get knocked out and the last thought before you hit the floor with be _THIS SELECT 0. So I am done ranting, if anyone wonders, coding dialog menus in OA for a week does that to your temper. Could you elaborate on this? I not very experienced with addon scripting. How would you increase dependency on server addons? Have functions that are called from an addon that is only on the server? Or is it keeping parts of the mission scripts exclusively on the server, by preventing scripts from the mission file to be sent to the client?
  10. It appears that writing class lowercase fixed the issue. Thanks for helping
  11. class CfgPatches { class MyItems { units[] = {}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {}; }; }; class CfgMagazines { class Default; class ItemCore: Default {}; class CA_Magazine : Default { scope = 1; value = 1; displayName = ""; model = "\ca\weapons\mag_univ.p3d"; picture = ""; modelSpecial = ""; useAction = 0; useActionTitle = ""; reloadAction = "ManActReloadMagazine"; ammo = ""; count = 30; type = 256; initSpeed = 900; selectionFireAnim = "zasleh"; nameSound = "magazine"; maxLeadSpeed = 23; }; class MyItem1 : CA_Magazine { scope=2; model = "\ca\weapons\mag_univ.p3d"; displayName="Item1"; picture="\CA\misc\data\icons\picture_photo_folder_ca.paa"; }; class MyItem2 : CA_Magazine { scope=2; model = "\ca\weapons\mag_univ.p3d"; displayName="Item2"; picture="\CA\misc\data\icons\picture_photo_folder_ca.paa"; }; }; class CfgVehicles { Class ReammoBox; Class MyCrate : ReammoBox { scope=2; accuracy=1000; displayName="MyCrate"; model="\ca\weapons\AmmoBoxes\USBasicAmmo.p3d"; Class TransportMagazines { Class _xx_30Rnd_556x45_Stanag { magazine="30Rnd_556x45_Stanag"; count=400; }; }; Class TransportWeapons { Class _xx_M4A1 { weapon="M4A1"; count=4; }; Class _xx_M9 { weapon="M9"; count=4; }; }; }; }; Everything above cfg vehicles works (commening out the contents of cfgvehicles but leaving the shell compiles without errors). I suspect that it might be some dependency on some pbo, but why the hell would cloning an existing stock ammobox cause that? Also could it be something about baseclasses? The ammobox inherits from: Class All; Class Static; Class Building; Class Strategic; But I would only need to have "Class ReammoBox;" because that class already inherits all of them, right?
  12. So is it possible to attach eventhandlers in an objects config.cpp?
  13. I am looking for a way to add addactions to objects and I found this: useAction=1; useActionTitle="$STR_ACTION_PUTBOMB"; Where is the action stored for this?
  14. alleycat

    isPlayer question

    I just edited the first post including some more questions, did not see your posts. What I fear is that these server/client switches might silently fail and carpetbomb the server with scripts ---------- Post added at 04:45 PM ---------- Previous post was at 04:36 PM ---------- if (local player) then { call { [player] execVM "player_hud.sqf"; }; }; if (isServer) then { _handle1 = execVM "script1.sqf" ; _handle2 = execVM "script2.sqf" ; }; Modified the code following your suggestions. Going to test that on a dedicated
  15. Well, shit. Would have been so convenient.
  16. http://community.bistudio.com/wiki/displayAddEventHandler Put it into the player init field in editor. OBVIOUSLY THAT SHIT WONT WORK. Would be too easy, shit simply working in this game. fuckthis shit, Ill code a loop instead.
  17. _dspl = findDisplay 106; While {true} do { waitUntil {! isNull _dspl;}; waitUntil { isNull _dspl;}; if (player hasweapon ) exitWith {}; }; Stuff to do; http://community.bistudio.com/wiki/User_Interface_Event_Handlers I looked at UI eventhandlers, perhaps they can be used. However when I tried this it would not do anything: _handleee = (findDisplay 106) displayAddEventHandler ["onLBDrag", "hint 'test'"]; Assuming 106 is the inventory screen?
  18. I would like to ask a few things about addons. I do a lot of mission scripting but I never did any addons before. 1. If I wanted to create a new soldier type that can be placed in the editor, which would be just a clone of an existing one in terms of textures and model (except for the loadout), would this be achievable by cloning, de-pboing some unit and changing up a script file? Or is that something that needs more involvement? 2. Same question for items.
  19. The thing I wonder is how much constantly looping stuff can a client take before it drags down performance.
  20. class CfgPatches { class ALLEY_Drink { units[] = {}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {}; }; }; class CfgVehicleClasses { class ALLEY_CobraItems { displayName = "Cobra Items"; }; }; class CfgVehicles { class All; class Small_items : Thing { vehicleClass = "Small_items"; destrType = "DestructNo"; animated = false; mapSize = 2; }; class Thing; // External class reference class EvPhoto : Small_items { scope = public; model = "\Ca\misc\SmallObj_File_photos"; icon = "\CA\misc\data\icons\picture_photo_folder_ca.paa"; displayName = "Cobra 1"; }; }; This is supposed to clone an evidence items,however during binarizing 2 error messages appear. ---------- Post added at 07:36 AM ---------- Previous post was at 05:49 AM ---------- class CfgPatches { class ALLEY_Drink { units[] = {}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {}; }; }; class CfgVehicleClasses { class ALLEY_CobraItems { displayName = "Cobra Items"; }; }; class CfgVehicles { class All; class Thing; class Small_items : Thing { vehicleClass = "Small_items"; destrType = "DestructNo"; animated = false; mapSize = 2; }; class Cobra_Drink1 : Small_items { scope = public; model = "\Ca\misc\SmallObj_File_photos"; icon = "\CA\misc\data\icons\picture_photo_folder_ca.paa"; displayName = "Cobra 1"; //vehicleClass = ALLEY_CobraItems; destrType = "DestructNo"; animated = false; mapSize = 2; vehicleClass = "Small_items"; }; }; No errors, but the object is nowhere to befound ingame. The "CobraItems category is not there and the object is not under small items. Anyone got a clue what is wrong with this?
  21. Found a config.cpp in the misc.pbo (I am looking for the evidence items) and derapped it. But there is no config.cpp that relates to the object I want. nevermind found it in another pbo
  22. Where do I find the cpp files for existing objects? I wanted to clone the evidence items but in the misc.pbo there only are p3d files.
  23. That is of no use as it repeatedly loops all all the time, which I want to avoid
  24. hintsilent "test2"; ////////FOR EACH HOUSE//////////////////////////////////////////////// { //Counts the amount of positions (=loot spots) _c = 0; while { format ["%1", _x buildingPos _c] != "[0,0,0]" } do {_c = _c + 1}; _spawnlocs = _c; //as long as there are spawn locations not processed: while {_spawnlocs > 0} do { //roll dice for each lootspot (starts with topmost) if ((random 1) < 1) then { _loot = createVehicle ["TKBasicAmmunitionBox_EP1", (_x buildingpos _spawnlocs), [], 0, "can_collide"]; _posx = (_x buildingpos _spawnlocs) select 0; _posy = (_x buildingpos _spawnlocs) select 1; _posz = (_x buildingpos _spawnlocs) select 2; clearweaponcargoglobal _loot; clearmagazinecargoglobal _loot; _loot setpos [_posx,_posy,(_posz)]; _loot addWeaponCargoGlobal ["MetisLauncher",1]; _total_loot = _total_loot +1; }; _spawnlocs = _spawnlocs - 1; }; hintsilent "test3"; } forEach _loot_house_list; hintsilent "test4"; What is wrong with this? It never gets to "test4". The last hintsilent displayed is "test3" ---------- Post added at 11:59 AM ---------- Previous post was at 11:30 AM ---------- hintsilent "test2"; ////////FOR EACH HOUSE//////////////////////////////////////////////// { //Counts the amount of positions (=loot spots) _c = 0; while { format ["%1", _x buildingPos _c] != "[0,0,0]" } do {_c = _c + 1}; _spawnlocs = _c; //as long as there are spawn locations not processed: while {_spawnlocs > 0} do { //roll dice for each lootspot (starts with topmost) if ((random 1) < 1) then { _loot = createVehicle ["TKBasicAmmunitionBox_EP1", (_x buildingpos _spawnlocs), [], 0, "can_collide"]; _posx = (_x buildingpos _spawnlocs) select 0; _posy = (_x buildingpos _spawnlocs) select 1; _posz = (_x buildingpos _spawnlocs) select 2; clearweaponcargoglobal _loot; clearmagazinecargoglobal _loot; _loot setpos [_posx,_posy,(_posz)]; _loot addWeaponCargoGlobal ["MetisLauncher",1]; _total_loot = _total_loot +1; }; _spawnlocs = _spawnlocs - 1; }; hintsilent "test3"; } forEach _loot_house_list; hintsilent "test4"; Found the problem, it is the "if random" code. But I am not sure how to fix it. I would like to apply foreach to each _spawnlocs. How do I nest 2 forEach? is that even possible? ---------- Post added at 12:31 PM ---------- Previous post was at 11:59 AM ---------- Actually, skip that, avoided the nesting by packing the spawning into a script.
  25. I have the following problem: After counting the amount of positions are in a house, I would like to apply a set of code for each house position. To do that I figured I should transform that amount into an array with each entry representing a house position. Like this: Counting the house positions: _c = 0; while { format ["%1", _x buildingPos _c] != "[0,0,0]" } do {_c = _c + 1}; _spawnlocs = _c; _array = [an entry for each spawnloc] Is that even a good approach?
×