Draconio Posted May 14, 2005 Last night I was trying to come up with a script that would check what class a player in Hexen is, and reject access to an area if the player was not of the desired class. This is what I came up with: Script 1 (int CheckerTID, int DenialAngle) { If (ThingCount(T_NONE, CheckerTID) == 0) { Print(s:"Your caste is not welcome here. Be gone!"); ThrustThing(DenialAngle, 512); } }When the player attempts to cross the line that activates the script, it searches for a map spot with the TID CheckerTID, which is flagged only to appear for the allowed class(es). If it's not there, the player is given a message and thrown back in the direction defined by DenialAngle. This can, of course, be modified for different effects. This works, but I'm pretty sure it will get broken on a multiplayer game, since it relies on the map rather than the player themself. Is there a better way to get this result, that will work even if there are players of more than one class around? 0 Share this post Link to post
Chopkinsca Posted May 14, 2005 Using a library script: script ### enter { if(class != 0) { terminate; } delay(15); //I forget what this is for if(checkweapon("FWeapFist")) { class = 1; } if(checkweapon("CWeapMace")) { class = 2; } if(checkweapon("MWeapWand")) { class = 3; } } function int getclass(void) { return class; } Where class is a world variable. I'm not sure if it works across multiple maps, but it works for a single map. Edit: I missed the multiplayer part. You could modify it to run for each player and store the class in an arrary or a variable for each player number. You'll have to excuse me, I just woke up. 0 Share this post Link to post
Draconio Posted May 14, 2005 Thanks for the input. From that info, I was able to make this new version of the script: #include "common.acs" int Class[8]; str FighterWeapons[4] = { "FWeapFist", "FWeapAxe", "FWeapHammer", "FWeapQuietus" }; str ClericWeapons[4] = { "CWeapMace", "CWeapStaff", "CWeapFlame", "CWeapWraithverge" }; str MageWeapons[4] = { "MWeapWand", "MWeapFrost", "MWeapLightning", "MWeapBloodscourge" }; Script 1 Enter { Delay(15); For(Int CheckEachWeapon = 0; CheckEachWeapon < 4; CheckEachWeapon++) { If(Class[PlayerNumber()] != 0) { terminate; } If(CheckWeapon(FighterWeapons[CheckEachWeapon])) { Class[PlayerNumber()] = 1; } If(CheckWeapon(ClericWeapons[CheckEachWeapon])) { Class[PlayerNumber()] = 2; } If(CheckWeapon(MageWeapons[CheckEachWeapon])) { Class[PlayerNumber()] = 3; } } } Script 2 (int AllowedClass, int DenialAngle) { If (Class[PlayerNumber()] != AllowedClass) { Print(s:"Your caste is not welcome here. Be gone!"); ThrustThing(DenialAngle, 512); } } This one identifies the player's class even if they come into the level holding a different weapon than weapon #1, and should identify all eight players in a cooperative game. 0 Share this post Link to post