Da0ne / DZMods

DayZ Standalone Vanilla++ project
Other
35 stars 19 forks source link

Add Custom resurrection parameter #83

Closed chinayern closed 5 years ago

chinayern commented 5 years ago

Edit DayZSurvival.c

Assign different parameters to different players according to steamid64

` override void StartingEquipSetup(PlayerBase player, bool clothesChosen) { int avNum = 0; int iPlayer = 0; array aVstr = new array; //VIP UID array aVtype = new array; //VIP TYPE aVstr.Insert("76561198187499005");//chinayern aVtype.Insert("gm"); avNum++; aVstr.Insert("76561198149886291");//JohnWick aVtype.Insert("gm"); avNum++; aVstr.Insert("76561198145371223");//LCPD_PartinG aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198168846308");//MelodyC aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198098202754");//NoZuoNoDie666 aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198344731800");//MMMADER aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198248405610");//Jx aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198103153932");//M0 aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198126906304");//SunDay aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198823833675");//YUT1AN aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198280176118");//M1911 aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198214669420");//tiancheng aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198408466417");//Chris aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198159156675");//tangyuan aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198173633682");//YySusheng aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198136132502");//FakeRY aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198326468235");//nmsl aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198120146123");//xiaoof aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198202910786");//shadow aVtype.Insert("v1"); avNum++; aVstr.Insert("76561198291674251");//King aVtype.Insert("gm"); avNum++; aVstr.Insert("76561198090393327");//guoke aVtype.Insert("v1"); avNum++;

    bool vipPass = false;

    ItemBase itemBs;
    EntityAI itemEnt;
    vector NewPosition;
    vector OldPosition;

    for (int i = 0; i < avNum; i++)
    {
        if (player.GetIdentity().GetPlainId() == aVstr[i] )
        {
            vipPass = true;
            iPlayer = i;
        }
    }

    if(vipPass == true)
    {
        player.RemoveAllItems();
        switch(aVtype[iPlayer])
        {
            case "gm":
                itemEnt = player.GetInventory().CreateInInventory("huntingbag");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("gorkahelmetComplete");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("gorkaejacket_summer");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("gorkapants_summer");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("militaryboots_brown");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Rag");
                itemBs = ItemBase.Cast(itemEnt);
                itemBs.SetQuantity(4);
                itemEnt = player.GetInventory().CreateInInventory("combatknife");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("tacticalgloves_black");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("WaterBottle");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("tunacan");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("tunacan");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("fnx45");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Mag_fnx45_15Rnd");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Mag_fnx45_15Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("m4a1");
                itemEnt.GetInventory().CreateAttachment("m4_oebttstck");
                itemEnt.GetInventory().CreateAttachment("m4_plastichndgrd");
                itemEnt.GetInventory().CreateAttachment("acogoptic");
                //itemEnt.GetInventory().CreateAttachment("M4_Suppressor");
                player.LocalTakeEntityToHands(itemEnt);
                player.SetQuickBarEntityShortcut(itemEnt,0,true);
                itemBs = ItemBase.Cast(itemEnt);

                itemEnt = player.GetInventory().CreateInInventory("Mag_stanag_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("Mag_stanag_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("Mag_stanag_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);
            break;
            case "v1":
                itemEnt = player.GetInventory().CreateInInventory("gorkaejacket_autumn");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("gorkapants_autumn");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("militaryboots_brown");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Rag");
                itemBs = ItemBase.Cast(itemEnt);
                itemBs.SetQuantity(4);
                itemEnt = player.GetInventory().CreateInInventory("combatknife");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("AliceBag_Camo");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("WaterBottle");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("tunacan");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("tunacan");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("fnx45");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Mag_fnx45_15Rnd");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Mag_fnx45_15Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("m4a1");
                itemEnt.GetInventory().CreateAttachment("m4_oebttstck");
                itemEnt.GetInventory().CreateAttachment("m4_plastichndgrd");
                itemEnt.GetInventory().CreateAttachment("acogoptic");
                //itemEnt.GetInventory().CreateAttachment("M4_Suppressor");
                player.LocalTakeEntityToHands(itemEnt);
                player.SetQuickBarEntityShortcut(itemEnt,0,true);
                itemBs = ItemBase.Cast(itemEnt);

                itemEnt = player.GetInventory().CreateInInventory("Mag_stanag_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("Mag_stanag_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("Mag_stanag_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);

                /*OldPosition = player.GetPosition();
                NewPosition[0] = OldPosition[0] + 1.5;
                NewPosition[1] = OldPosition[1] + 2.5;
                NewPosition[2] = OldPosition[2] + 1.5;

                itemEnt = GetGame().CreateObject( "gorkaejacket_autumn", NewPosition, false, true, true );
                itemEnt = GetGame().CreateObject( "gorkapants_autumn", NewPosition, false, true, true );
                itemEnt = GetGame().CreateObject( "militaryboots_brown", NewPosition, false, true, true );*/
            break;
            default:
                itemEnt = player.GetInventory().CreateInInventory("gorkaejacket_autumn");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("gorkapants_autumn");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("militaryboots_brown");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Rag");
                itemBs = ItemBase.Cast(itemEnt);
                itemBs.SetQuantity(4);
                itemEnt = player.GetInventory().CreateInInventory("combatknife");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("AliceBag_Camo");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("WaterBottle");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("tunacan");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("tunacan");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("fnx45");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Mag_fnx45_15Rnd");
                itemBs = ItemBase.Cast(itemEnt);
                itemEnt = player.GetInventory().CreateInInventory("Mag_fnx45_15Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("akm");
                itemEnt.GetInventory().CreateAttachment("AK_WoodHndgrd");
                //itemEnt.GetInventory().CreateAttachment("AK_Suppressor");
                itemEnt.GetInventory().CreateAttachment("AK_WoodBttstck");
                itemEnt.GetInventory().CreateAttachment("KobraOptic");
                player.LocalTakeEntityToHands(itemEnt);
                player.SetQuickBarEntityShortcut(itemEnt,0,true);
                itemBs = ItemBase.Cast(itemEnt);

                itemEnt = player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);    
                itemEnt = player.GetInventory().CreateInInventory("Mag_AKM_30Rnd");
                itemBs = ItemBase.Cast(itemEnt);    

                /*OldPosition = player.GetPosition();
                NewPosition[0] = OldPosition[0] + 1.5;
                NewPosition[1] = OldPosition[1] + 2.5;
                NewPosition[2] = OldPosition[2] + 1.5;

                itemEnt = GetGame().CreateObject( "gorkaejacket_autumn", NewPosition, false, true, true );
                itemEnt = GetGame().CreateObject( "gorkapants_autumn", NewPosition, false, true, true );
                itemEnt = GetGame().CreateObject( "militaryboots_brown", NewPosition, false, true, true );*/
            break;
        }
    }else{
        itemEnt = player.GetInventory().CreateInInventory("Rag");
        itemBs = ItemBase.Cast(itemEnt);
        itemBs.SetQuantity(4);

        itemEnt = player.GetInventory().CreateInInventory("policevest");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("SteakKnife");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("smershbag");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("tunacan");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("WaterBottle");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("cz61");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("Mag_cz61_20Rnd");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("Mag_cz61_20Rnd");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("ammobox_380_35rnd");
        itemBs = ItemBase.Cast(itemEnt);
        itemEnt = player.GetInventory().CreateInInventory("tunacan");
        itemBs = ItemBase.Cast(itemEnt);
    }
}

`

LArtDesChOiX commented 5 years ago

Hiii !!

Woooooah !!! NICE work guy !!

But,i need more info PLS

ALL code in Daysurvival ??

the 2 parts in a row ??

If I understand correctly, we can make a rank, GM, another VIP, the default is the stuff that NO VIP people will ?? And ELSE, the stuff for all player if theboolvippass its on "false" ??

HARD for me !! TY

LArtDesChOiX commented 5 years ago

Basically, i must replace all the code after:

override void StartingEquipSetup (PlayerBase player, bool clothesChosen)

Or just ADD the present code ? ^^

S4MT3K commented 5 years ago

@chinayern do you think its possible to implement as tunables?

GravityWolfNotAmused commented 5 years ago

It shouldn't be too hard in order to turn into a module and implement into a tunable module

chinayern commented 5 years ago

Basically, i must replace all the code after:

override void StartingEquipSetup (PlayerBase player, bool clothesChosen)

Or just ADD the present code ? ^^

Replace the "override void StartingEquipSetup (PlayerBase player, bool clothesChosen)" function.

@chinayern do you think its possible to implement as tunables?

It should be OK. It will take time to revise it.

GravityWolfNotAmused commented 5 years ago

It's quite messy... I just had to clean mine up today x.x

GravityWolfNotAmused commented 5 years ago

Just remember that this may not get pushed due to there not being a need for us to get too in-depth with default. If you want to make custom classes use the advanced loadout feature.

S4MT3K commented 5 years ago

I know buddy, i just want to keep my Custom loadout, managed over startingequipsetup. I think i will make it in cases and set my custom as default:

The problem is, that i cant put it as module or in an extra file. Then it says is marked as override but there is no gunction in base class... thats why im asked

GravityWolfNotAmused commented 5 years ago

What are you trying to override?

S4MT3K commented 5 years ago

The StartingequipSetup. It says: override void StartingEquipSetup(); Inside Mainclass it is no problem... But when i try to exclude it into a external file. it gives me this error. Even when i classify it. But then it says Open state, missing "}"? The problem is, that my Loadoutfunction hast about 800 lines. (44 cases) And i really want to put it in a external file... But all my solutions doesnt work... So, thats why i asked to put this into the admintool respectively in the tunables, and/or call this in a other file...

GravityWolfNotAmused commented 5 years ago

Okay, so...In order for you to override the StartEquipmentSetup() you need to be inside of the MissionServer, or a class which extends MissionSever. Personally, I would wait...The update is bigger than just my pull request and could heavily impact what you are doing, or thinking.

If I were to change the code to implement yours I would start: On line 249 or where this is located:

else
{
      //Vanilla
      itemEnt = player.GetInventory().CreateInInventory( "Rag" );
      itemBs = ItemBase.Cast(itemEnt);
      itemBs.SetQuantity(6);
}

Also, I would disable the loadout modules if you plan to use your spawning system. I don't know your programming knowledge so I cannot sit here and explain to you how to come up with a solution. I am sure you have one in your head, but not sure how to execute it, this happens to the best of us. 💯 If you wish to talk programming concepts I am available at GravityWolf#6981 on Discord.

chinayern commented 5 years ago

Maybe you should wait for me to optimize the code and add it to tunables Add it as a module for dzmod.

If I have time, maybe I can make this function stand alone. It works even without dzmod.

S4MT3K commented 5 years ago

Thanks for the answers guys. Im very good in programming. At least i know what i do, and can imagine what i have to write :P The problem is, that some things wont get in my head, so this weird function. I just want to store the whole Starting equip setup in a external file. BUT HE DONT LET ME -.-" including the .c wont work. Calling the function in Mission---> Nope. ADDING the funtion in missionserver.c... Computer says no ^^ Even when i try to put it into a class and .super it (by ref a new class it always says (missing ";") and believe me, i missing nothing. When i put it back into missionserver (DayZSurvival.c) it works. So why dont let me this rude compiler =(

I hope you guys get me :D

PS: My idea btw. is: Adding a 5 case switch with static loadout for each case: Case 1: Sniper Case2: Soldier1 ....... These are only accesable for admins like Chinayerns way :D

the other cases are a mix out of everything only acessable for members...

and then is the default case a Vanilla loadout but highly mixed (not randomized yet, but i will add it)

If anybody want to adabt this idea!

chinayern commented 5 years ago

good idea

Create a new file and include it in DayZSurvival. C.

Increase the first line in override void Starting Equip Setup (Player Base player, bool clothes Chosen)

If (flag of new method)

{

Call your new method.

Return;

}

Later code does not need to be changed