So i've created my own quest system which works, however - i'm optimizing the system, and this requires a better index system than what i have now.
I define all the required quest variables at the start of the map with a standard array.
My issue is i'm using the array for QUEST INDEX, not for calling player number. I'm currently keeping track of the player kills and the state of the quests for each player, with variables for each player.
The quests are MUI - but it's extremely tedious, when coding in GUI.
Quest_Array = Quest_Array + 1
Quest_Name(Quest_Array) = Maintaining Balance
Quest_Description(Quest_Array) = Slay 10 wolves.
Quest_UnitType(Quest_Array) = Wolf
Quest_AmountRequired(Quest_Array) = 10
Quest_Player1Kills(Quest_Array) = 0
Quest_Player2Kills(Quest_Array) = 0
Quest_Player3Kills(Quest_Array) = 0
Quest_Player4Kills(Quest_Array) = 0
I would like to store player kills like this instead for easier access of the variables when coding triggers:
Quest_PlayerKills(Quest_Array, Player_Number) or something like that. Instead of having 4 variables with the same array.
Quest_Array = Quest_Array + 1
Quest_Name(Quest_Array) = Maintaining Balance
Quest_Description(Quest_Array) = Slay 10 wolves.
Quest_UnitType(Quest_Array) = Wolf
Quest_AmountRequired(Quest_Array) = 10
Quest_PlayerKills(Quest_Array, Player_Number) = 0
This would make If/then/else statements way shorter in triggers.
I would like to avoid hashtables all together if possible.
Example: Current method
Event
A unit dies
For each Integer A from 1 to Quest_Array do
If TriggeringUnit = Quest_Unit(Integer_A) then
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = 1 then
Quest_Player1Kills(Quest_Array) = Quest_Player1Kills(Quest_Array) + 1
else
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = 2 then
Quest_Player2Kills(Quest_Array) = Quest_Player2Kills(Quest_Array) + 1
else
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = 3 then
Quest_Player3Kills(Quest_Array) = Quest_Player3Kills(Quest_Array) + 1
else
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit))= 4 then
Quest_Player4Kills(Quest_Array) = Quest_Player4Kills(Quest_Array) + 1
else
Example: Goal
Event
A unit dies
For each Integer A from 1 to Quest_Array do
If TriggeringUnit = Quest_Unit(Integer_A) then
Quest_PlayerKills(Quest_Array, Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = Quest_PlayerKills(Quest_Array, Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) + 1
else
I define all the required quest variables at the start of the map with a standard array.
My issue is i'm using the array for QUEST INDEX, not for calling player number. I'm currently keeping track of the player kills and the state of the quests for each player, with variables for each player.
The quests are MUI - but it's extremely tedious, when coding in GUI.
Quest_Array = Quest_Array + 1
Quest_Name(Quest_Array) = Maintaining Balance
Quest_Description(Quest_Array) = Slay 10 wolves.
Quest_UnitType(Quest_Array) = Wolf
Quest_AmountRequired(Quest_Array) = 10
Quest_Player1Kills(Quest_Array) = 0
Quest_Player2Kills(Quest_Array) = 0
Quest_Player3Kills(Quest_Array) = 0
Quest_Player4Kills(Quest_Array) = 0
I would like to store player kills like this instead for easier access of the variables when coding triggers:
Quest_PlayerKills(Quest_Array, Player_Number) or something like that. Instead of having 4 variables with the same array.
Quest_Array = Quest_Array + 1
Quest_Name(Quest_Array) = Maintaining Balance
Quest_Description(Quest_Array) = Slay 10 wolves.
Quest_UnitType(Quest_Array) = Wolf
Quest_AmountRequired(Quest_Array) = 10
Quest_PlayerKills(Quest_Array, Player_Number) = 0
This would make If/then/else statements way shorter in triggers.
I would like to avoid hashtables all together if possible.
Example: Current method
Event
A unit dies
For each Integer A from 1 to Quest_Array do
If TriggeringUnit = Quest_Unit(Integer_A) then
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = 1 then
Quest_Player1Kills(Quest_Array) = Quest_Player1Kills(Quest_Array) + 1
else
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = 2 then
Quest_Player2Kills(Quest_Array) = Quest_Player2Kills(Quest_Array) + 1
else
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = 3 then
Quest_Player3Kills(Quest_Array) = Quest_Player3Kills(Quest_Array) + 1
else
If Get:TriggeringPlayer(Get:OwnerOf(Killing Unit))= 4 then
Quest_Player4Kills(Quest_Array) = Quest_Player4Kills(Quest_Array) + 1
else
Example: Goal
Event
A unit dies
For each Integer A from 1 to Quest_Array do
If TriggeringUnit = Quest_Unit(Integer_A) then
Quest_PlayerKills(Quest_Array, Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) = Quest_PlayerKills(Quest_Array, Get:TriggeringPlayer(Get:OwnerOf(Killing Unit)) + 1
else
Last edited: