Sign in to follow this  
geekm0nkey

PVP mod idea.

9 posts in this topic

So a player gave me an idea for a mod and after searching couldn't find it or the like.. Here is the concept, we would call it "Ears" of war.. Once a player is killed, the action menu would give you the option to "claim trophy" where you would then see an animation followed by the body disappearing.  This being replaced with some item.. Something you can't buy or find in loot. We set it to a high sell price so you can collect the reward. This is all pretty easy to make, here comes the issue. I need to know how to code in, that this "body" was the result of PVP action.. Not AI kill or suicide.  To prevent abuse from someone spawning, suicide then collecting trophy and repeating. Any ideas?

Share this post


Link to post
Share on other sites
2 hours ago, geekm0nkey said:

So a player gave me an idea for a mod and after searching couldn't find it or the like.. Here is the concept, we would call it "Ears" of war.. Once a player is killed, the action menu would give you the option to "claim trophy" where you would then see an animation followed by the body disappearing.  This being replaced with some item.. Something you can't buy or find in loot. We set it to a high sell price so you can collect the reward. This is all pretty easy to make, here comes the issue. I need to know how to code in, that this "body" was the result of PVP action.. Not AI kill or suicide.  To prevent abuse from someone spawning, suicide then collecting trophy and repeating. Any ideas?

ExileServer_object_player_event_onMpKilled

case 7:

just set a variable on the _victim

Share this post


Link to post
Share on other sites
Advertisement

I see where the case is called, but how exactly would I assign _victum to a result from that function, and how would I pass the _this to the function so that it even knows who i'm checking.

Share this post


Link to post
Share on other sites
14 minutes ago, geekm0nkey said:

I see where the case is called, but how exactly would I assign _victum to a result from that function, and how would I pass the _this to the function so that it even knows who i'm checking.

Use the Exile interaction system, and add it to the player section and check if they're dead, then make a network request to the server to do the dooooooooo

 

  • Like 1

Share this post


Link to post
Share on other sites
16 minutes ago, geekm0nkey said:

sigh... sounds great? could you maybe show me an example i could work from? I learn best by picking code apart.

Just look at the lock or something, there are tons of things you can look at that are default to exile...

Share this post


Link to post
Share on other sites
4 hours ago, StokesMagee said:

Just look at the lock or something, there are tons of things you can look at that are default to exile...

DUH? yeah, I had already looked at that.. I know exactly where to put the call, and how to address if the player is dead.

Spoiler

class Trophy: ExileAbstractAction
            {
                title = "Claim trophy";
                condition = "!(alive ExileClientInteractionObject)";
                action = "_this call EOW_ClaimTrophy";
            };

Not what I was referring too.. will the "_this" listed above pass the _victim and _killer content to the function? if I use the...

Spoiler

_victim = _this select 0;
_killer = _this select 1;

_killingPlayer = _killer call ExileServer_util_getFragKiller;
_killType = [_victim, _killer, _killingPlayer] call ExileServer_util_getFragType;

At the beginning of the file associated with my function?

now.. to my original question, with that information? will the above result in _killType = 7 in the event it was a player caused death? which I can then use to fuel the rest of the conditions in my script?

Share this post


Link to post
Share on other sites
// on killed...

case 7:
{
	_victim setVariable ["SomeShit", "someRandomShit"];
	...........
};



// the action menu
ExileClientInteractionObject call EOW_ClaimTrophy;



// EOW_ClaimTrophy
...........
["blah", [netID _this]] call ExileClient_system_network_send;



// the server-side network
params["_sessionID","_params"];
_params params["_victimID"];
try
{
	private _victim = objectFromNetID _victimID;
	if (isNull _victim) throw "....";
	if (_victim getVariable ["SomeShit",""] != "some condition") throw "....";
	//give the player the reward
	_victim setVariable ["SomeShit",nil];
}
catch
{
	[_sessionID,"ToastRequest",["ErrorTitleAndText",["...",_exception]]] call ExileServer_system_network_send_to;
}

 

Edited by StokesMagee

Share this post


Link to post
Share on other sites

Love you man.. Lol.. Here is what I have thus far, but it doesn't fire off the script as nothing appears to happen.

edit added to config.cpp

Spoiler

            // Ears of war mod
            class Trophy: ExileAbstractAction
            {
                title = "Claim Trophy";
                condition = "!(alive ExileClientInteractionObject)";
                action = "_this call EOW_FN_ClaimTrophy";
            };

Edits made to initplayer.sqf

Spoiler

// Ears of war mod
EOW_FN_ClaimTrophy = compileFinal preprocessFileLineNumbers "addons\eow_claimtrophy.sqf";

And finally the script itself.

Spoiler

/* --------------------------------------------------
 * Ears of war mod
 * Created by Geekm0nkey for Arma 3 Exile.
 * Copyright 2018, Geekm0nkey, All rights reserved.
 * --------------------------------------------------
 */

["SuccessTitleAndText", ["EOW: Trophy search!", "looking for a trophy to collect."]] call ExileClient_gui_toaster_addTemplateToast;
 
private["_reward","_victim","_killer","_killingPlayer","_killType","_playerObject","_playerMoney"];

_reward = 2500;

_victim = _this select 0;
_killer = _this select 1;
_playerObject = player;

if !(alive _victim) then
{    
    _victim setVariable ["ExileName", name _victim, true];
    _killingPlayer = _killer call ExileServer_util_getFragKiller;
    _killType = [_victim, _killer, _killingPlayer] call ExileServer_util_getFragType;

    switch (_killType) do
    {
        default
        {
            _playerObject playMove "AinvPknlMstpSnonWnonDr_medic1";
            sleep 10;
            deleteVehicle (_this select 0);
            ["ErrorTitleAndText", ["EOW: Trophy failed!", format["%1 was not killed as a result of PVP.", name _victim]]] call ExileClient_gui_toaster_addTemplateToast;
        }
        case 1;
        case 2;
        case 3;
        case 4;
        case 5;
        case 6: // Includes all cases above
        {
            _playerObject playMove "AinvPknlMstpSnonWnonDr_medic1";
            sleep 10;
            deleteVehicle (_this select 0);
            ["ErrorTitleAndText", ["EOW: Trophy failed!", format["%1 was not killed as a result of PVP.", name _victim]]] call ExileClient_gui_toaster_addTemplateToast;
        };
        case 7:
        {
            _playerObject playMove "AinvPknlMstpSnonWnonDr_medic1";
            sleep 10;
            deleteVehicle (_this select 0);
            
            _playerMoney = _playerObject getVariable ["ExileMoney", 0];
            _playerMoney = _playerMoney + _reward;
            _playerObject setVariable ["ExileMoney", _playerMoney, true];
            format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
            ["SuccessTitleAndText", ["EOW: Trophy collected!", format["You have successfully claimed your trophy of %1 poptabs from %2.",_reward, name _victim]]] call ExileClient_gui_toaster_addTemplateToast;
        };
    };
};

 

Edited by geekm0nkey

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.