- Joined
- Aug 16, 2007
- Messages
- 885
Why aren't you able to overwrite values in a hashtable? Something may be wrong, but I can't make it work. I've made a quest system for my map, to simple add and complete quests... The thing is I can't overwrite
As you can see, when I take the quest I save the QuestCompleted_Hashtable boolean as false and when I completed the quest I set it as true, but that doesn't work...
Thanks.
Edit: I'm using two hashtables to store two booleans, in order to check three things:
Accepted(False) + Completed(False) = New Quest
Accepted(True) + Completed(False) = Text: You have already accepted/completed this quest!
Accepted(True) + Completed(True) = Reward
-
Hashtable - Save False as 1 of LoopInt[1] in QuestCompleted_Hashtable
-
Hashtable - Save True as 1 of LoopInt[1] in QuestCompleted_Hashtable
-
Quest Add and Complete
-

Events
-


Unit - A unit Acquires an item
-
-

Conditions
-

Actions
-


Set p[0] = (Owner of (Triggering unit))
-


Set PlayerGroup[0] = (Player group(p[0]))
-


For each (Integer LoopInt[0]) from 1 to Quest_MaxQuests, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Item-type of (Item being manipulated)) Equal to Quest_Item[LoopInt[0]]
-
-





Then - Actions
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








(Hero level of (Triggering unit)) Greater than or equal to Quest_Required_Level[LoopInt[0]]
-
-







Then - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










(Load LoopInt[0] of (Player number of p[0]) from QuestAccepted_Hashtable) Equal to False
-
-









Then - Actions
-










Unit - Add Quest_Ability[LoopInt[0]] to (Triggering unit)
-










Hashtable - Save True as LoopInt[0] of (Player number of p[0]) in QuestAccepted_Hashtable
-










Hashtable - Save False as LoopInt[0] of (Player number of p[0]) in QuestCompleted_Hashtable
-










Game - Display to PlayerGroup[0] for 5.00 seconds the text: (Quest Accepted: + (Name of (Item being manipulated)))
-
-









Else - Actions
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












(Load LoopInt[0] of (Player number of p[0]) from QuestCompleted_Hashtable) Equal to True
-
-











Then - Actions
-












Unit - Remove Quest_Ability[LoopInt[0]] from (Triggering unit)
-












Game - Display to PlayerGroup[0] for 5.00 seconds the text: (Quest Completed: + (Name of (Item being manipulated)))
-












Hero - Add Quest_ExpReward[LoopInt[0]] experience to (Triggering unit), Show level-up graphics
-












Player - Add Quest_GoldReward[LoopInt[0]] to p[0] Current gold
-












Hashtable - Save False as LoopInt[0] of (Player number of p[0]) in QuestCompleted_Hashtable
-
-











Else - Actions
-












Game - Display to PlayerGroup[0] for 5.00 seconds the text: You have already ac...
-
-
-
-
-
-







Else - Actions
-








Game - Display to PlayerGroup[0] for 5.00 seconds the text: You do not meet up ...
-
-
-
-





Else - Actions
-
-
-
-


Custom script: call DestroyForce(udg_PlayerGroup[0])
-
-
-
Quest 1 Child Rescued
-

Events
-


Unit - A unit enters Quest1ChildsRescuePoint <gen>
-
-

Conditions
-


(Unit-type of (Triggering unit)) Equal to Lost Child (Quest 1)
-
-

Actions
-


For each (Integer LoopInt[1]) from 1 to 10, do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Triggering unit) Equal to Quest_ChildsMissing_EventUnit[LoopInt[1]]
-
-





Then - Actions
-






Game - Display to (All players) the text: (String(LoopInt[1]))
-






>>>>Hashtable - Save True as 1 of LoopInt[1] in QuestCompleted_Hashtable<<<<
-






Set Quest_ChildsMissing_EventOn[LoopInt[1]] = False
-






Unit - Hide (Triggering unit)
-






Unit - Kill (Triggering unit)
-






Set Quest_ChildsMissing_EventUnit[LoopInt[1]] = No unit
-






Set PlayerGroup[0] = (Player group((Player(LoopInt[1]))))
-






Game - Display to PlayerGroup[0] for 5.00 seconds the text: Child got home! Go ...
-






Custom script: call DestroyForce(udg_PlayerGroup[0])
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








(Load 1 of LoopInt[1] from QuestCompleted_Hashtable) Equal to True
-
-







Then - Actions
-








Game - Display to (All players) the text: true
-
-







Else - Actions
-








Game - Display to (All players) the text: false
-
-
-
-





Else - Actions
-
-
-
-
-
As you can see, when I take the quest I save the QuestCompleted_Hashtable boolean as false and when I completed the quest I set it as true, but that doesn't work...
Thanks.
Edit: I'm using two hashtables to store two booleans, in order to check three things:
Accepted(False) + Completed(False) = New Quest
Accepted(True) + Completed(False) = Text: You have already accepted/completed this quest!
Accepted(True) + Completed(True) = Reward






