| 07-16-2004, 03:42 AM | #1 |
I'm in a huge stick here.. someone help me out. Heres my problem. Some of you know of my DBZ rpg that is in progress. Well, I am making dragonballs saveable from game to game, and there are 7 of em. As you all know there's only 6 inventory spots. So I started making a system that when you pick up a ball, it combines them with all of the other Dragonballs in your inventory, and refuses to let you pick up two of the same ball. Here's the coding for it (bear with its LONG, but once you start reading it you'll get the picture): Code:
Second Combine1
Events
Unit - A unit Acquires an item
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item being manipulated)) Equal to One Star Dragonball
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,3 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,3 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,4 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,4 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,5 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,5 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 3,4 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,3,4 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 3,5 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,3,5 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 3,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,3,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 3,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,3,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 4,5 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,4,5 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 4,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,4,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 4,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,4,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 5,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,5,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 5,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,5,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 6,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,6,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,3,4 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,3,4 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,3,4,5 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,3,4,5 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,3,4,5,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,3,4,5,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,3,4,5,6,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create All 7 Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,4,5 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,4,5 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,4,5,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,4,5,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,4,5,6,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,4,5,6,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,5,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,5,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,5,6,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,5,6,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,6,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,6,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,3,4,5,7 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,3,4,5,7 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type 2,3,4,6 Star Dragonballs) Equal to True
Then - Actions
For each (Integer A) from 1 to 6, do (Item - Remove (Item carried by (Triggering unit) in slot (Integer A)))
Hero - Create 1,2,3,4,6 Star Dragonballs and give it to (Triggering unit)
Hero - Give (Last created item) to (Triggering unit)
Else - Actions
Else - Actions
Do nothing
This is the code for when the One Star Dragonball is picked up, and combined with every other combination of dragonballs. (This is roughly half of the code). For some reason this seriously lags the WE and gives me all kinds of errors when I try and load the map. It gives me a message with 872 compile errors in war3map.j Anyone know of an easier way to do all of this? |
| 07-16-2004, 05:31 AM | #2 |
the map doesnt wanna read all that.. look how much it is!.. poor map.. poor wc.. lol jk.. idk i used a less complicated system for mine.. could use variables for it? marking that you have 6 dragonballs or 7 dragonballs types but you only see you have 6 then making it so they can do -dragonballs to see what numbers they have |
| 07-16-2004, 05:40 AM | #3 | |
Quote:
That's about 10% of the coding for it.. I had to cut it off cause it wouldnt let me post it all. Oh.. and what did you say? I'm completely lost. |
| 07-16-2004, 05:49 AM | #4 |
Okay, I think I got the system figured out.. for now. Thanks anyway ;) |
| 07-16-2004, 07:49 AM | #5 |
are dragonballs the only items you have in your map? Because the trigger removes all items from the hero if he finds a combination. Otherwise, that's a whole lot of code, for every ball you can pick up, you can already have 6 single balls, 15 two-ball combinations, 10 three-ball combinations, 15 four-ball combos, 6 five-balls and 1 six-ball. That's 37 different items you need to check for every different ball you collect. Kind of too much. But there's a solution. Actually, a rather simple solution. Of course, you still need to do a lot of object editor work to get all the different balls, but from there on, there's a simple method of getting the thing to work without tons of triggers. For this, you will need the item levels. That means that if you use this method, and you have other items in your map, all those items will need to be level 0 (Edit: Not neccesarily, we'll make all the dragonballs "artifacts", so non-artifact items can have whatever level they want (that way, you don't need to change all the already existing items in the object editor, only the eight artifacts)). Now, what we'll do is assign each dragonball a different, unique level. The basic seven dragonballs will have levels: 1, 2, 4, 8, 16, 32, 64. Each of the combo balls will have a level equal to the sum of the levels of the balls that make it. So, a ball combo of first, second, and fifth ball will have a level equal to 1+2+16=19. The ultimate item that holds all seven balls would have a level of 127. This is also the ammount of custom items you'll have to create for this. Now for the trigger that does the item merging (I'm not sure if a hero can acquire an already merged item, so i'll just write the triggers so that they take that option into account, they'll work even if you can't pick up a merged item): Code:
Dragonball Merge
Events
Unit - A unit Acquires an item
Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
(Item level of (Item being manipulated)) Not equal to 0
Actions
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
(Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Artifact
(Item level of (Item carried by (Hero manipulating item) in slot (Integer A))) Greater than 0
Then - Actions
Set integerVariable = (Item level of (Item being manipulated))
For each (Integer B) from 1 to 7, do (Actions)
Loop - Actions
Set booleanVariable[(Integer B)] = False
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(integerVariable - (Integer((Power(2.00, (7.00 - (Real((Integer B))))))))) Greater than or equal to 0
Then - Actions
Set integerVariable = (integerVariable - (Integer((Power(2.00, (7.00 - (Real((Integer B)))))))))
Set booleanVariable[(Integer B)] = True
Else - Actions
Do nothing
Set integerVariable = (Item level of (Item carried by (Hero manipulating item) in slot (Integer A)))
For each (Integer B) from 1 to 7, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
booleanVariable[(Integer B)] Equal to True
(integerVariable - (Integer((Power(2.00, (7.00 - (Real((Integer B))))))))) Greater than or equal to 0
Then - Actions
Set integerVariable = (integerVariable - (Integer((Power(2.00, (7.00 - (Real((Integer B)))))))))
Set booleanVariable[(Integer B)] = False
Set tempPoint = (Position of (Hero manipulating item))
Item - Create (Random level (Integer((Power(2.00, (7.00 - (Real((Integer B)))))))) Artifact item-type) at tempPoint
Custom script: call RemoveLocation ( udg_tempPoint )
Else - Actions
Set integerVariable = (Item level of (Item carried by (Hero manipulating item) in slot (Integer A)))
For each (Integer B) from 1 to 7, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
booleanVariable[(Integer B)] Equal to True
Then - Actions
Set integerVariable = (integerVariable + (Integer((Power(2.00, (7.00 - (Real((Integer B)))))))))
Else - Actions
Do nothing
Item - Remove (Item being manipulated)
Item - Remove (Item carried by (Hero manipulating item) in slot (Integer A))
Hero - Create (Random level integerVariable Artifact item-type) and give it to (Hero manipulating item)
Else - Actions
Do nothingFor this trigger, you need a boolean variable array, an integer variable, and a point variable. And remember, the only artifact items allowed to have their level higher than 0 are the dragonballs, and their levels must be set correctly for this to work. |
| 07-19-2004, 06:19 AM | #6 |
you could also base DB off of the shadow orbs... |
