• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Dynamic Indexing - Submission

Status
Not open for further replies.
Level 13
Joined
Oct 12, 2016
Messages
769
One use of dynamic instancing is for custom alliance systems.

For example:

Let's say there's a trigger that uses events like string commands or abilities to set alliances between different players. This in turn pops up a dialogue box with options: share vision, declare war, go neutral, ally.
If player 1 wants to ally with player 2, they click "ally" which brings up another menu with a list of active players. Player 1 will then select player 2.

This could then assign a boolean value to an indexed array like this:
Alliance(player# triggering player(player# selected player)) = True

Afterwards, this would fire off an if/then/else check to see if the opposing player's alliance value matches:
If:
Alliance(player# triggering player(player# selected player)) = True
Alliance(player# selected player(player# triggering player)) = True
Then:
Set alliance status to allied for players 1 and 2
Else:
-

The same thing can be done for vision sharing in the example dialogue menu.
Of course I explained this in GUI, but it was still relevant to this mission post since it does not matter in what order the variables are accessed.
 
Status
Not open for further replies.
Top