| 08-24-2004, 04:30 AM | #1 |
No guesses, no 'hunches' only reply if you have a solid idea of what your talking about, and know what I'M talking about, ok!? Heres my problem: I have these variables (SmithingXP and SmithingLevel) which are constantly for some reason becoming "corrupt," or so I call them. It seems that triggers related to them stop working. See below: Whenever I smith something, it does not show the message and does not apply the XP. Now, I recreated the variable. Then, it works, but it doesn't give any more XP! Whats going on? Please help...this has been a MAJOR pain. Code:
Smelting and Smithing
Events
Unit - A unit Begins casting an ability
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Casting unit)) Equal to Multi-Purpose Forge and Anvil
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by (Casting unit) in slot 1)) Equal to Bar Mold
(Item-type of (Item carried by (Casting unit) in slot 2)) Equal to Copper Ore
(Item-type of (Item carried by (Casting unit) in slot 3)) Equal to Tin Ore
Then - Actions
Item - Remove (Item carried by (Casting unit) in slot 1)
Item - Remove (Item carried by (Casting unit) in slot 2)
Item - Remove (Item carried by (Casting unit) in slot 3)
Hero - Create Bronze Bar and give it to (Casting unit)
Game - Display to (Player group((Owner of (Casting unit)))) the text: You smelted tin ore...
Set SmithingXP[(Player number of (Owner of (Casting unit)))] = (SmithingXP[(Player number of (Owner of (Casting unit)))] + (30 / SmithingLevel[(Player number of (Owner of (Casting unit)))]))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by (Casting unit) in slot 1)) Equal to Dagger Blueprints
(Item-type of (Item carried by (Casting unit) in slot 2)) Equal to Bronze Bar
Then - Actions
Item - Remove (Item carried by (Casting unit) in slot 2)
Hero - Create Bronze Dagger and give it to (Casting unit)
Game - Display to (Player group((Owner of (Casting unit)))) the text: Carefully following...
Set SmithingXP[(Player number of (Owner of (Casting unit)))] = (SmithingXP[(Player number of (Owner of (Casting unit)))] + (50 / SmithingLevel[(Player number of (Owner of (Casting unit)))]))
Else - Actions
Do nothing
Else - Actions
Do nothing |
| 08-24-2004, 05:44 AM | #2 |
Code:
Set SmithingXP[(Player number of (Owner of (Casting unit)))] = (SmithingXP[(Player number of (Owner of (Casting unit)))] + [b](30 / SmithingLevel[(Player number of (Owner of (Casting unit))[/b])])) You could get a division by zero here if SmithingLevel starts at 0. |
| 08-24-2004, 07:26 AM | #3 |
Im just taking a wild guess here, but, under conditions shouldn't you have "Cast abilty equal to smithing"??? I can't rlly remember the exact trigger, but maybe that will help, I hope =\ |
| 08-24-2004, 10:09 AM | #4 |
Something wrong right here. I'm not sure what you're trying to do with this action. Set SmithingXP[(Player number of (Owner of (Casting unit)))] = (SmithingXP[(Player number of (Owner of (Casting unit)))] + (30 / SmithingLevel[(Player number of (Owner of (Casting unit)))])) Are you trying to give the casting unit XP here? You already gave the casting hero an item if 3 items are in an exact order in the hero's inventory (by the way, I posted an item merging trigger that IS PERFECT! Search for "item merging" and you'll find it, it allows a hero to have 3 items in inventory in ANY order and it will still combine them into the item of your choice.). This is screwy --> Set smithingxp[1] = smithingxp[1] + 30/smithinglevel[1] I understand what you're saying when you say "player number of owner of casting unit" this is a very good way to make each variable different depending on the player causing the actions. However, it's a little complicated to look at and therefor hard to troubleshoot, simplifiying it may help you understand what's wrong. Wouldn't it be easier to say something like Add SmithingXP[playernumberownercastingunit] (whatever addition/division/etc... you would like to do to come to your value) to (casting unit) show level up graphics? |
| 08-24-2004, 04:48 PM | #5 |
-Sigh- No, no, and no! Sorry, but I'm getting aggravated here. There isn't anything wrong with my trigger and it was working fine...before... My problem here is the variables not working correctly. I'v gone over the formula plenty of times, and I know it works correctly. And for the last time (I'v said this to MANY people before) you do not level up your hero--you 'level up' a variable, which is SmithingLevel/XP. This map has multiple tradeskills. See this levelling trigger >\ Code:
Smithing Level Up
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SmithingXP[(Integer A)] Greater than or equal to ((SmithingLevel[(Player number of (Owner of (Casting unit)))] x 200) + 200)
Then - Actions
Set SmithingLevel[(Integer A)] = (SmithingLevel[(Integer A)] + 1)
Game - Display to (Player group((Player((Integer A))))) the text: Smithing Level Up!
Else - Actions
Do nothing |
| 08-25-2004, 12:52 AM | #6 |
Woulda appreicated it if you said whether or not SmithingLevel could be zero, because AFAIK there is no way to tell from the triggers you have posted (altough the "x 200) + 200" indicates it does start at 0). A divide by zero error will cause the trigger to stop running at the "Set SmithingXP line", meaning that line wont run but the conditions, item creation and text message WILL run. This is not a hunch, it perfectely describes your problem and there is no evidence you posted that SmithingLevel cannot be zero. I know you've stated your determination to ignore advice, but atleast confirm or deny that it's a divide by zero error. Assuming it's not a divide by zero error it seems to me you have a "everything checks but it doesn't work" problem, the problem is probably in another trigger, and probably really "duh" when you notice it. A typical example (something I often do) involves setting the wrong variable in another simple trigger, so I may think i've correctely initialized the right variable, but actually set a variable that looks a lot like it, this ends up with effectively garbage results in two variables, and the problem doesn't show up in the trigger with the bug, it shows up in a long complex trigger which is a "natural" candidate for bugs due to complexity. |
| 08-25-2004, 01:22 AM | #7 | |
Quote:
You can't use "Casting Unit". That's an event response, which is ultimately a local variable, and you haven't mentioned any unit casting anything |
| 08-26-2004, 02:04 AM | #8 |
@ Grater: Seriously, I'm not stupid enough to set the level as 0. Come on! @ EePoRgOrG: Yeah, I know--thats an old copy paste. @ Everyone: None of this is of any use to me whatsoever... |
| 08-26-2004, 02:25 AM | #9 |
Alright... I'm gonna try to help, sorry if I annoy you with this but I need to get a feel for the problem. My questions: can i get some variable info? like type, size of array, and original values? you said " it was working fine...before..." does that mean the whole trigger was working fine then it just crapped out? and as it is, the trigger is completely fine except for the xp right? how are you keeping track of the xp? if it's a trigger, can I see it? lotsa questions, and sorry again if I annoy you, but I really am trying to help! |
