Custom railguns with user and team colors
Posted: Mon May 20, 2013 12:30 am
by Qent
Custom railguns that use A_RailAttack to change the attack damage or damage type cannot use the player's railcolor or team color directly. Team-colored custom railguns have been made by using inventory flags and identical Fire states with different colors. This is one possible way to use the player's railcolor in addition to his team color.
Spoiler: decorate.txt (Open)Code: Select all
actor Railgun : DoomWeapon 5012 { SpawnID 164 Radius 20 Height 16 Weapon.Selectionorder 100 Weapon.SlotNumber 6 Weapon.SlotPriority 0.75 Weapon.AmmoUse 10 Weapon.AmmoGive 40 Weapon.AmmoType "Cell" Inventory.Pickupmessage "$PICKUP_RAILGUN" Obituary "$OB_RAILGUN" Decal RailScorch States { Ready: RLGG A 1 A_WeaponReady Loop Deselect: RLGG A 1 A_Lower Loop Select: RLGG A 1 A_Raise Loop Fire: RLGG E 0 A_GunFlash RLGG E 0 A_JumpIfInventory("TeamCounter", 4, "FireNoTeam") RLGG E 0 A_JumpIfInventory("TeamCounter", 3, "FireGoldTeam") RLGG E 0 A_JumpIfInventory("TeamCounter", 2, "FireGreenTeam") RLGG E 0 A_JumpIfInventory("TeamCounter", 1, "FireRedTeam") Goto FireBlueTeam FireNoTeam: RLGG E 0 A_JumpIfInventory("RailColorItem", 9, "Fire9") RLGG E 0 A_JumpIfInventory("RailColorItem", 8, "Fire8") RLGG E 0 A_JumpIfInventory("RailColorItem", 7, "Fire7") RLGG E 0 A_JumpIfInventory("RailColorItem", 6, "Fire6") RLGG E 0 A_JumpIfInventory("RailColorItem", 5, "Fire5") RLGG E 0 A_JumpIfInventory("RailColorItem", 4, "Fire4") RLGG E 0 A_JumpIfInventory("RailColorItem", 3, "Fire3") RLGG E 0 A_JumpIfInventory("RailColorItem", 2, "Fire2") RLGG E 0 A_JumpIfInventory("RailColorItem", 1, "Fire1") // Fall-through Fire0: RLGG E 0 A_RailAttack(100, 0, 1, "Blue", "White", 0, 1) Goto FireEnd Fire1: RLGG E 0 A_RailAttack(100, 0, 1, "Red", "White", 0, 1) Goto FireEnd Fire2: RLGG E 0 A_RailAttack(100, 0, 1, "Yellow", "White", 0, 1) Goto FireEnd Fire3: RLGG E 0 A_RailAttack(100, 0, 1, "Black", "White", 0, 1) Goto FireEnd Fire4: RLGG E 0 A_RailAttack(100, 0, 1, "Gray", "White", 0, 1) Goto FireEnd Fire5: RLGG E 0 A_RailAttack(100, 0, 1, "Gold", "White", 0, 1) Goto FireEnd Fire6: RLGG E 0 A_RailAttack(100, 0, 1, "Green", "White", 0, 1) Goto FireEnd Fire7: RLGG E 0 A_RailAttack(100, 0, 1, "White", "White", 0, 1) Goto FireEnd Fire8: RLGG E 0 A_RailAttack(100, 0, 1, "Purple", "White", 0, 1) Goto FireEnd Fire9: RLGG E 0 A_RailAttack(100, 0, 1, "Orange", "White", 0, 1) Goto FireEnd FireBlueTeam: RLGG E 0 A_JumpIfInventory("RailColorItem", 9, "FireBlue9") RLGG E 0 A_JumpIfInventory("RailColorItem", 8, "FireBlue8") RLGG E 0 A_JumpIfInventory("RailColorItem", 7, "FireBlue7") RLGG E 0 A_JumpIfInventory("RailColorItem", 6, "FireBlue6") RLGG E 0 A_JumpIfInventory("RailColorItem", 5, "FireBlue5") RLGG E 0 A_JumpIfInventory("RailColorItem", 4, "FireBlue4") RLGG E 0 A_JumpIfInventory("RailColorItem", 3, "FireBlue3") RLGG E 0 A_JumpIfInventory("RailColorItem", 2, "FireBlue2") RLGG E 0 A_JumpIfInventory("RailColorItem", 1, "FireBlue1") // Fall-through FireBlue0: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Blue", 0, 1) Goto FireEnd FireBlue1: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Red", 0, 1) Goto FireEnd FireBlue2: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Yellow", 0, 1) Goto FireEnd FireBlue3: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Black", 0, 1) Goto FireEnd FireBlue4: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Gray", 0, 1) Goto FireEnd FireBlue5: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Gold", 0, 1) Goto FireEnd FireBlue6: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Green", 0, 1) Goto FireEnd FireBlue7: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "White", 0, 1) Goto FireEnd FireBlue8: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Purple", 0, 1) Goto FireEnd FireBlue9: RLGG E 0 A_RailAttack(100, 0, 1, "00 00 FF", "Orange", 0, 1) Goto FireEnd FireRedTeam: RLGG E 0 A_JumpIfInventory("RailColorItem", 9, "FireRed9") RLGG E 0 A_JumpIfInventory("RailColorItem", 8, "FireRed8") RLGG E 0 A_JumpIfInventory("RailColorItem", 7, "FireRed7") RLGG E 0 A_JumpIfInventory("RailColorItem", 6, "FireRed6") RLGG E 0 A_JumpIfInventory("RailColorItem", 5, "FireRed5") RLGG E 0 A_JumpIfInventory("RailColorItem", 4, "FireRed4") RLGG E 0 A_JumpIfInventory("RailColorItem", 3, "FireRed3") RLGG E 0 A_JumpIfInventory("RailColorItem", 2, "FireRed2") RLGG E 0 A_JumpIfInventory("RailColorItem", 1, "FireRed1") // Fall-through FireRed0: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Blue", 0, 1) Goto FireEnd FireRed1: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Red", 0, 1) Goto FireEnd FireRed2: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Yellow", 0, 1) Goto FireEnd FireRed3: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Black", 0, 1) Goto FireEnd FireRed4: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Gray", 0, 1) Goto FireEnd FireRed5: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Gold", 0, 1) Goto FireEnd FireRed6: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Green", 0, 1) Goto FireEnd FireRed7: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "White", 0, 1) Goto FireEnd FireRed8: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Purple", 0, 1) Goto FireEnd FireRed9: RLGG E 0 A_RailAttack(100, 0, 1, "FF 00 00", "Orange", 0, 1) Goto FireEnd FireGreenTeam: RLGG E 0 A_JumpIfInventory("RailColorItem", 9, "FireGreen9") RLGG E 0 A_JumpIfInventory("RailColorItem", 8, "FireGreen8") RLGG E 0 A_JumpIfInventory("RailColorItem", 7, "FireGreen7") RLGG E 0 A_JumpIfInventory("RailColorItem", 6, "FireGreen6") RLGG E 0 A_JumpIfInventory("RailColorItem", 5, "FireGreen5") RLGG E 0 A_JumpIfInventory("RailColorItem", 4, "FireGreen4") RLGG E 0 A_JumpIfInventory("RailColorItem", 3, "FireGreen3") RLGG E 0 A_JumpIfInventory("RailColorItem", 2, "FireGreen2") RLGG E 0 A_JumpIfInventory("RailColorItem", 1, "FireGreen1") // Fall-through FireGreen0: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Blue", 0, 1) Goto FireEnd FireGreen1: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Red", 0, 1) Goto FireEnd FireGreen2: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Yellow", 0, 1) Goto FireEnd FireGreen3: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Black", 0, 1) Goto FireEnd FireGreen4: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Gray", 0, 1) Goto FireEnd FireGreen5: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Gold", 0, 1) Goto FireEnd FireGreen6: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Green", 0, 1) Goto FireEnd FireGreen7: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "White", 0, 1) Goto FireEnd FireGreen8: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Purple", 0, 1) Goto FireEnd FireGreen9: RLGG E 0 A_RailAttack(100, 0, 1, "00 FF 00", "Orange", 0, 1) Goto FireEnd FireGoldTeam: RLGG E 0 A_JumpIfInventory("RailColorItem", 9, "FireGold9") RLGG E 0 A_JumpIfInventory("RailColorItem", 8, "FireGold8") RLGG E 0 A_JumpIfInventory("RailColorItem", 7, "FireGold7") RLGG E 0 A_JumpIfInventory("RailColorItem", 6, "FireGold6") RLGG E 0 A_JumpIfInventory("RailColorItem", 5, "FireGold5") RLGG E 0 A_JumpIfInventory("RailColorItem", 4, "FireGold4") RLGG E 0 A_JumpIfInventory("RailColorItem", 3, "FireGold3") RLGG E 0 A_JumpIfInventory("RailColorItem", 2, "FireGold2") RLGG E 0 A_JumpIfInventory("RailColorItem", 1, "FireGold1") // Fall-through FireGold0: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Blue", 0, 1) Goto FireEnd FireGold1: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Red", 0, 1) Goto FireEnd FireGold2: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Yellow", 0, 1) Goto FireEnd FireGold3: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Black", 0, 1) Goto FireEnd FireGold4: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Gray", 0, 1) Goto FireEnd FireGold5: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Gold", 0, 1) Goto FireEnd FireGold6: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Green", 0, 1) Goto FireEnd FireGold7: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "White", 0, 1) Goto FireEnd FireGold8: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Purple", 0, 1) Goto FireEnd FireGold9: RLGG E 0 A_RailAttack(100, 0, 1, "FF FF 00", "Orange", 0, 1) Goto FireEnd FireEnd: RLGG E 12 RLGG F 6 RLGG GHIJKLA 6 RLGG M 0 A_ReFire goto Ready Flash: TNT1 A 5 bright A_Light1 TNT1 A 5 bright A_Light2 TNT1 A 0 bright A_Light0 Goto LightDone Spawn: RAIL A -1 Stop } } // Encodes the player's railcolor in inventory. actor RailColorItem : Inventory { +INVENTORY.UNDROPPABLE Inventory.MaxAmount 9 } // Encodes the player's team in inventory. actor TeamCounter : Inventory { +INVENTORY.UNDROPPABLE Inventory.MaxAmount 255 }
Spoiler: railgun.acs (Open)Code: Select all
#library "railgun" #include "zcommon.acs" #define MAXPLAYERS 64 // Script numbers used: #define RAIL_INIT_ENTER 345 #define RAIL_INIT_RESPWAN 346 #define GET_RAILCOLOR 347 #define SEND_RAILCOLOR 348 #define RAIL_ITEM_ENTER 349 #define RAIL_ITEM_RESPAWN 350 // How frequently railcolor gets sent to the server: #define LOOP_DELAY_TICS 35 int railColor[MAXPLAYERS]; script RAIL_INIT_ENTER ENTER CLIENTSIDE { if(ConsolePlayerNumber() != PlayerNumber()) Terminate; ACS_Execute(GET_RAILCOLOR, 0, 0, 0, 0); } script RAIL_INIT_RESPWAN RESPAWN CLIENTSIDE { if(ConsolePlayerNumber() != PlayerNumber()) Terminate; ACS_Execute(GET_RAILCOLOR, 0, 0, 0, 0); } script GET_RAILCOLOR (void) CLIENTSIDE { int color = GetCVar("railcolor"); str cmd = StrParam(s:"puke -", d:SEND_RAILCOLOR, c:' ', d:color); ConsoleCommand(cmd); Delay(LOOP_DELAY_TICS); Restart; } script SEND_RAILCOLOR (int color) NET { if(color < 0 || color > 9) color = 0; railColor[PlayerNumber()] = color; checkRailItems(); } script RAIL_ITEM_ENTER ENTER { checkRailItems(); giveTeamItems(); } script RAIL_ITEM_RESPAWN RESPAWN { checkRailItems(); giveTeamItems(); } function void checkRailItems(void) { if(CheckInventory("RailColorItem") != railColor[PlayerNumber()]) { TakeInventory("RailColorItem", 999); GiveInventory("RailColorItem", railColor[PlayerNumber()]); } } function void giveTeamItems(void) { GiveInventory("TeamCounter", GetPlayerInfo(PlayerNumber(), PLAYERINFO_TEAM)); }
[/spoiler]