Jump to content

Cellus

Member
  • Content Count

    116
  • Joined

  • Last visited

  • Medals

Posts posted by Cellus


  1. Anyone had problems with this in 1.03? Every time I respawn they are all re-written. So, three objectives, four deaths, I now have those three objectives four times each in tasks. I've tried removing the killed handler. Not sure whether to start on fixing it or just go break something.

    Ed: also tried removing it from init.sqf and execing it from an in-game trigger with 'local player' as condition. I'm gonna go cry...


  2. Hey how do you set the damage of an object like a building? I'm trying to destroy the entire city of Chernorgorsk and bombs are really innefective (and crash my game - about 200-300 of them).

    Also, does anyone know how to remove trees?

    Stolen from elsewhere on these boards:

    // place a game logic where you want to destroy the trees and pass gamelogic name and the radius of detruction.
    // nul=[location,radius] execVM"gclear.sqf"
    _location = _this select 0;
    _radius   = _this select 1;
    
    _what = (nearestObjects [_location,[],_radius]) - ((getPos _location) nearObjects _radius);
    sleep 1.5;
    {_x setdammage (1.0)} forEach _what;

    Heh - too late ;)


  3. Oh, it's well worth de-pbo'ing all the add-ons that come with the game. This one is in characters/scripts:

    /*
    File: selectRandomSentence.sqf
    Author: Joris-Jan van 't Land
    
    Description:
    Analyzes conversation partners and determines which tags should be used 
    in selecting a sentence. A random matching sentence is then returned.
    
    Parameter(s):
    _this select 0: 'this' - speaking party - person for who tags are determined (Object)
    _this select 1: 'from' - spoken to party (Object)
    
    Returns:
    Sentence (String)
    */
    
    private ["_personThis", "_personFrom"];
    _personThis = _this select 0;
    _personFrom = _this select 1;
    
    
    private ["_tags"];
    _tags = ["greeting", "question"];
    
    
    //Determine partner combination.
    private ["_typeTag", "_sideThis", "_sideFrom"];
    _sideThis = side _personThis;
    _sideFrom = side _personFrom;
    
    if (_sideThis == civilian) then 
    {
    _typeTag = "civilianTo";
    } 
    else 
    {
    _typeTag = "combatantTo";	
    };
    
    if (_sideFrom == civilian) then 
    {
    _typeTag = _typeTag + "Civilian";	
    } 
    else 
    {
    _typeTag = _typeTag + "Combatant";
    };
    
    _tags = _tags + [_typeTag];
    
    
    //Two combatants are speaking to one another.
    if (_typeTag == "combatantToCombatant") then 
    {
    //TODO: Does this apply to player? Or should he have the option to speak still?
    //Determine combat situation.
    private ["_behaviour"];
    _behaviour = behaviour _personThis;
    
    if ((_behaviour == "COMBAT") || (_behaviour == "STEALTH")) then 
    {
    	_tags = _tags + ["inCombat"];	
    } 
    else 
    {
    	_tags = _tags + ["notInCombat"];	
    };
    
    
    //Determine rank difference.
    private ["_rankTag", "_rankIdThis", "_rankIdFrom"];
    _rankIdThis = rankId _personThis;
    _rankIdFrom = rankId _personFrom;
    
    if ((typeName _rankIdThis) != (typeName 0)) then 
    {
    	_rankIdThis = 0;
    };
    
    if ((typeName _rankIdFrom) != (typeName 0)) then 
    {
    	_rankIdFrom = 0;
    };
    
    if (_rankIdThis > _rankIdFrom) then 
    {
    	_rankTag = "toLowerRank";
    } 
    else 
    {
    	if (_rankIdThis < _rankIdFrom) then 
    	{
    		_rankTag = "toHigherRank";
    	} 
    	else 
    	{
    		_rankTag = "toSameRank";
    	};
    };
    
    _tags = _tags + [_rankTag];
    
    
    //Speaking to a lower-ranking combatant.
    if (_rankTag == "toLowerRank") then 
    {
    	_tags = _tags + ["to" + (rank _personFrom)];
    };
    };
    
    
    //Determine instigator morale.
    //TODO: When negative, often don't approach at all?
    private ["_morale"];
    _morale = morale _personThis;
    
    if (_morale > 0.3) then 
    {
    _tags = _tags + ["positive"];
    } 
    else 
    {
    if (_morale < 0) then 
    {
    	_tags = _tags + ["negative"];
    } 
    else 
    {
    	_tags = _tags + ["neutral"];
    };
    };
    
    
    //Determine gender combination.
    private ["_womanThis", "_womanFrom"];
    _womanThis = getNumber(configFile >> "CfgVehicles" >> (typeOf _personThis) >> "woman");
    _womanFrom = getNumber(configFile >> "CfgVehicles" >> (typeOf _personFrom) >> "woman");
    
    if ((_womanThis == 1) && (_womanFrom != 1)) then 
    {
    _tags = _tags + ["femaleToMale"];
    } 
    else 
    {
    if ((_womanThis != 1) && (_womanFrom == 1)) then 
    {
    	_tags = _tags + ["maleToFemale"];
    } 
    else 
    {
    	if ((_womanThis != 1) && (_womanFrom != 1)) then 
    	{
    		_tags = _tags + ["maleToMale"];
    	} 
    	else 
    	{
    		_tags = _tags + ["femaleToFemale"];
    	};
    };
    };
    
    
    //Determine time of day.
    if ((dayTime > 6) && (dayTime < 12)) then 
    {
    _tags = _tags + ["morning"];
    } 
    else 
    {
    if ((dayTime > 16) && (dayTime < 22)) then 
    {
    	_tags = _tags + ["evening"];
    } 
    else 
    {
    	if ((dayTime >= 22) || (dayTime <= 6)) then 
    	{
    		_tags = _tags + ["night"];
    	} 
    	else 
    	{
    		_tags = _tags + ["day"];
    	};
    };
    };
    
    
    //Determine surrender status.
    if (captive _personThis) then 
    {
    _tags = _tags + ["surrendered"];
    } 
    else 
    {
    _tags = _tags + ["notSurrendered"];	
    };
    
    
    //Select random, matching greeting and gesture.
    //We want to access the config only once.
    if (isNil "BIS_coreTalkSentences") then 
    {
    BIS_coreTalkSentences = [];
    BIS_coreTalkTags = [];
    
    private ["_cfgTalkSentences"];
    _cfgTalkSentences = configFile >> "CfgTalkSentences";
    
    for "_i" from 0 to ((count _cfgTalkSentences) - 1) do 
    {
    	private ["_candidate"];
    	_candidate = _cfgTalkSentences select _i;
    
    	BIS_coreTalkSentences = BIS_coreTalkSentences + [configName _candidate];
    	BIS_coreTalkTags = BIS_coreTalkTags + [getArray(_candidate >> "tags")];
    };
    };	
    
    //Make a list of candidates which match all given tags.
    private ["_candidates"];
    _candidates = [];
    
    for "_i" from 0 to ((count BIS_coreTalkSentences) - 1) do 
    {
    private ["_candidate", "_candidateTags"];
    _candidate = BIS_coreTalkSentences select _i;
    _candidateTags = BIS_coreTalkTags select _i;
    
    //Are all tags in this candidate?
    if (({_x in _candidateTags} count _tags) == (count _tags)) then 
    {
    	_candidates = _candidates + [_candidate];
    };
    };
    
    //TODO: remove.
    //debugLog (format ["Log: %1", _tags]);
    
    //Select a random sentence from the candidates.
    private ["_sentence"];
    _sentence = _candidates select (floor (random (count _candidates)));
    
    _sentence

    I don't play with AI, so can't be more help than that.


  4. For C, you'll likely want to use 'knowsabout', and setcaptive when it reaches 0.

    For B, vehicle player. Easy enough.

    A I'm not sure about, and can't access ArmA to test. There is http://community.bistudio.com/wiki/weapons, but I haven't used it before, so can't be sure of its use. Likley you'll be wanting to test if it returns a null array, but I can't be specific, sorry. If nothing else, this will bump the thread for someone who knows what they're doing will see it and help you :p

    The AI conversation is indeed possible - but I'm out of time. If nobody comes along beforehand, the random coversation between AI has it's own little script (I believe it's annotated, from memory) in the de-pbo'd add-ons in the game. Search there if no one has it handy.


  5. There is nothing wrong with the modules - only their lack of documentation (ie they are configurable). It is coming, however. The 'empty' option is the same as placing a unit - Bluefor, Opfor, Civ, Empty, couple of others in that drop down. If you don't already have a player unit you'll need to select 'non-playable' from the control menu. You could also select weapons from the briefing screen before the game starts if you'd prefer. Just search the scripting forum here and at OFPEC and read Murray's Guide.


  6. Search Armaholic for Mr Murray's editing guide.

    A further great example is the textmessage which displays the information who killed

    who. This option is a special feature espacially for the Multiplayer games. The

    Eventhandler needs to be given to all units which are dedicated to. The Syntax looks as

    follows:

    {_x addEventHandler ["Killed", {hint format["%1 killed by%2",

    _this select 0, _this select 1]}]} foreach [s1, S2, S3, S4]

    Which should be good enough for a base for whatever you need doing.


  7. init.sqf, not the box in the editor. What Tigga said for the box thing, but it's better to run it from init file I reckon. And just after I posted that I realised you could just as easily move the respawn_west marker around the same way (more or less), which would probably be a preferred way. Anyhow, this IS 'on killed' - it's an event handler, not a looping script.


  8. You needn't name the player. Get rid of this [sidebase] in the event handler. Put a location in the location field :rolleyes:. You might put a marker in named 'here', so location is '_location = getMarkerPos "here"; ', then move the marker depending on the objective. Don't forget to update the tasks in the killed handler. When I went to test this, I just ripped the briefing update out and whacked the setpos in:

    init:

    [] execVM "Respawn.sqf";

    Respawn.sqf:

    if ( isNil{player getVariable "mk_killedEHadded"} ) then
    {
    player addEventHandler ["killed",
    {
    [] spawn 	{
    waitUntil { alive player };
    player setPos getMarkerPos "here";
    		};
    }];
    player setVariable ["mk_killedEHadded", true];
    }; 
    

    Then stick in whatever else - tasks update, spawn resistance maybe, valkyries riding off, i don't know - whatever it is you lot do when you get risen from the dead/ drop fresh troops at the front line. Then just move the 'here' marker around with the objective.

×