Here is one way you can use CreateEntityAtArea (as others have suggested).
Put a script area around where you want the valve to appear. Ill Assume for now you called it "ScriptArea_Valve". Don't put a valve there at the start.
As we want to be able to generate an infinite number of valves we are going to want a way to generate new names for them. That's where this first function comes in:
//Function for generating unique names
string generateNewName(string prefix)
{
AddLocalVarInt("generateNewName_Count_" + prefix,1); //Add one to a count of how many times this was called
return prefix + GetLocalVarInt("generateNewName_Count_" + prefix); //Use the count to generate a unique valve name
}
Next we want to use this code to be able to create valves. We will create another function which will create a valve at a specified area.
//Create a new valve entity at an area
void createNewValveAtArea(string &in asArea)
{
//This will generate "Spawning_Valve_1" "Spawning_Valve_2" etc...
string newValveName = generateNewName("Spawning_Valve_");
//Create the valve
CreateEntityAtArea(newValveName,"[FileName].ent",asArea,false);
//Do any stuff with the valve here (E.g. callbacks) but use newValveName instead of "Spawning_Valve"
//E.g. AddEntityCollideCallback(newValveName,"SomeEntity","SomeFunction",false,1);
//Finally we need to keep track of what the most current valve name is (for later)
SetLocalVarString("CurrentValvename",newValveName);
}
Now we have the code down to generate valves, we need to make a valve spawn when we start the map, as well as set up the checkpoint (your checkpoint code is probably elsewhere rather than OnStart though).
void OnStart()
{
//Create a valve with all it's callbacks etc
createNewValveAtArea("ScriptArea_Valve");
//Create a checkpoint which calls "cbDeath_ValveChase"
CheckPoint("SomeName","SomeStartArea","cbDeath_ValveChase","SomeCategory","SomeEntry");
}
Finally, all we need to do is disable the old valve and create a new one on death:
void cbDeath_ValveChase(string &in asName, int alCount)
{
//Disable the old valve
string oldValve = GetLocalVarString("CurrentValvename");
SetEntityActive(oldValve,false);
//Create a new one
createNewValveAtArea("ScriptArea_Valve");
// **The rest of your checkpoint code here**
}
There are some blanks you will have to fill in, and that code untested but provided you can activate/deactivate the entity you are using this should work.