For the aura you can use @aura, wich you get with
this patch, but I've preferred to use effects from the
effects_list.txt for making the script useable without any source mod.
For a faction vs faction pvp you'll need to perform a source modification, which I don't know.
Your script could be like this (untested so there may be errors/bugs):
// [jaBote] Simple faction script.// Can be done with arrays to save lots of variables and improve efficiency, but this one is easier to understand except for the menu making which is automatic./// @configurations are in OnInit label.- script Factions Manager -1,{ OnInit: set .forever, 1; // Are factions forever (value: 1) or can you decide them whenever you log in (value: 0)? set .totalfactions, 2 // Total number of factions // Faction 1 parameters set .faction1_name$, "Red"; // Name for faction 1 set .faction1_item, 7575; // CHANGE it to any item ID you want. It should be character-bound. set .faction1_effect, 22; // CHANGE it to an existent effect from effects_list.txt set .faction1_effectdelay, 10000; // Delay, in milliseconds, for reapplying the faction effect so it seems a consistent aura // Faction 2 parameters set .faction2_name$, "Blue"; // Name for faction 2 set .faction2_item, 7576; // CHANGE it to any item ID you want. It should be character-bound. set .faction2_effect, 33; // CHANGE it to an existent effect from effects_list.txt set .faction2_effectdelay, 10000; // Delay, in milliseconds, for reapplying the faction effect so it seems a consistent aura // Add more factions here if you want // More info on effects:
https://github.com/HerculesWS/Hercules/blob/master/doc/effect_list.txt set .init, 1; end; OnPCLoginEvent: if (!.init) donpcevent strnpcinfo(3)+"::OnInit"; // Faction data from OnInit MUST be loaded if (!(.forever && faction)) { // Need to set faction as you don't have one mes "Hey " + strcharinfo(0) + "! Pick a faction!"; for (set .@i, 1; .@i <= .totalfactions; set .@i, .@i + 1){ // Dynamic menu set set .@menu$, .@menu$ + getd(".faction" + .@i + "_name$"); // Dynamically getting the name of the faction if (.@i < .totalfactions) set .@menu$, .@menu$ + ":"; } set faction, select(.@menu$); next; mes "You're now in the " + getd(".faction" + faction + "_name$") + " faction."; getitem getd(".faction" + faction + "_item"); close2; } doevent strnpcinfo(3)+"::OnMakeAura"; // Do Aura Loop end; OnMakeAura: enable_items; // May be a possible exploit but it's necessary misceffect getd(".faction" + faction + "_effect"); addtimer getd(".faction" + faction + "_effectdelay"),strnpcinfo(3)+"::OnAuraRefresh"; end; OnAuraRefresh: deltimer strnpcinfo(3)+"::OnAuraRefresh"; doevent strnpcinfo(3)+"::OnMakeAura"; // Start again end; OnPCLogoutEvent: if (!.forever && countitem(getd(".faction" + faction + "_item"))) delitem getd(".faction" + faction + "_item"),1; end;}
Check if it works.
Edit: I'd seriously better make an array version of this, I'll do it again later of tomorrow when I have time but I can't right now.
Edit 2: Made some corrections, thanks Capuche.