Jump to content
Chris07

Adding Flag to Actor

Recommended Posts

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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...