Scripting noob needs help

  1. 6 years ago

    I'm really hoping you guys can help. I'm running an Alive server for a local community and had the awesome idea to have the map randomly spawn warlords than you can capture or kill when the hostility in a map gets too high. I had the idea all planned out about how it would work and then hit a MASSIVE wall. I have no idea how to suss the necessary information out of the Alive infrastructure and calling the documentation of Alive functions sparse would be polite. I'm hoping someone here can point me to something I may have overlooked or help me with a few functions that I have been trying to crack.

    Essentially what I what the mission to do is to check at regular intervals what the average hostility of the server is and to spawn a warlord and his lieutenants if the hostility drops below a certain level. The server will spawn the warlord in the town with the most hostility and the Lt's in the rest of the town assuming their hostility is above a certain level. The Warlord and his Lt's will then increase the hostility of these areas in regular intervals with the warlord increasing hostility the most. You can stop their influence and gain some favor by killing or capturing the HVTs with the most favor gained by capture and less by killing.

    Ok, here is the TL;DR I promise.
    I can't for the life of me figure out what constitutes as a "cluster" or how to get its position. I can however get its hostility (ty SpyderBlack for you code snippets).

    Another problem I am having is the sector hostility is refusing to update. I have used the code snippet provided to update hostility (http://alivemod.com/wiki/index.php/Insurgency ) and used the code snippet provided by spiderblack to check the town's hostility (http://alivemod.com/forum/2192-trigger-on-hostility-level/0).

    Before you ask, I wasn't checking the average. I was using the "ALiVE_fnc_getNearestClusterHostilityBySide" function.

    (OK, maybe not much of a TL;DR)

    Any modicum of help would be so greatly appreciated. Here's a video of a kitten for your trouble.
    http://i.imgur.com/3m2qabw.gifv

  2. Neat idea! Hopefully someone can help you out. I'm a big fan of the idea that someday ALiVE could generate tasks like these dynamically based on happenings around the battlefield.

    Thanks for the report on the hostility thing. It may or may not be a bug. Probably worth checking one way or the other.

  3. Here is a brief example of how to get a list of clusters and access each of their positions. A cluster is essentially just a cluster of civilians, such as a town. Civilians are spawned when their cluster is activated.

    _clusterHash = [ALiVE_clusterHandler,"clusters"] call. ALiVE_fnc_hashGet;
    
    _clusterPositions = [];
    
    {
        _clusterPosition = [_x,"center"] call ALiVE_fnc_hashGet;
    
        _clusterPositions pushback _clusterPosition;
    } foreach (_clusterHash select 2);

    The hostility might not be updating if you aren't executing the code on the server. You can try calling your function like this.

    [parameters to your function>] remoteExecCall ["your function", 2];

 

or Sign Up to reply!