Chris07 Posted November 26, 2013 Report Share Posted November 26, 2013 Via scripting, I want to add a "flag" to an actor, either a vehicle or a person not controlled by a player (like a random civillian on the map). I want to make a decision the first time the command is run on a civilian and then save it to that particular civilian, so that if the command is run again on that same civilian, the same result will be returned every time. As an example:The command generates a random number between 1-5 the first time it is run on a civilian. I run the command on the civilian for the first time and the number 3 is selected randomly. A dummy command which indicates that the number 3 was chosen is saved to the civilian. After this first run, every time I run the command on this civilian, the number 3 will be returned. (Remember: The commands are being assigned to a non-player controlled actor) My thought on approaching this would be to add a dummy command to the civilian on first run:Person t(Target);if(! t.HasCommand("DummyChose1") || !t.HasCommand("DummyChose2") || ! t.HasCommand("DummyChose3") || ! t.HasCommand("DummyChose4") || ! t.HasCommand("DummyChose5") ){//Generate random number here.}... //switch statement to select appropriate dummy command to send to target based on random number...case 3: t.AssignCommand("DummyChose3"); //Number 3 chosen dynamically, so save this dummy command to the civilian. break;....Then if the command was run again, we could get the same result everytime.Person t(Target);if(t.HasCommand("DummyChose1")) //Return 1else if(t.HasCommand("DummyChose2"))//Return 2else if(t.HasCommand("DummyChose3"))//Return 3......Would this solution work? What are your thoughts? Thanks for your input! Quote Link to comment Share on other sites More sharing options...
Hoppah Posted December 2, 2013 Report Share Posted December 2, 2013 Theoratically, yes, it should work like that. Dummycommands are about the safest way to add specific traits or flags as you called them. Quote Link to comment Share on other sites More sharing options...
Chris07 Posted December 3, 2013 Author Report Share Posted December 3, 2013 Thanks! Quote Link to comment Share on other sites More sharing options...