| 08-28-2011, 06:04 AM | #1 |
Originally from this thread: http://www.wc3c.net/showthread.php?t=82929 2 problems with it: 1. I have my own "announcement" function for when a unit kills a Hero unit, complete with Hero name and team colour. I am trying to use mine instead of the one inside this script I linked but when I alter the function it gives me a bunch of errors ("Expected a name" errors). 2. I am supposed to use this function: Trigger: Custom Script: call AssistanceSystem_Register(unit)Unfortunately the thread/script creator is no longer active and I don't know how to get in touch with him, so here I am asking the rest of you gentlemen. |
| 08-29-2011, 01:29 AM | #2 | ||
Quote:
JASS:call DisplayTimedTextToForce() Quote:
JASS:call AssistanceSystem_Register(bj_lastCreatedUnit) |
| 08-29-2011, 10:00 AM | #3 |
He could use AutoIndex to detect when a new unit enters the map, for example he might want to get summoned units or newly-trained units. |
| 08-30-2011, 04:45 AM | #4 |
Thanks guys, I managed to circumcise the first problem by first renaming my own global var and then referring to that for the actual trigger. It seems to be working... And as for the second question, that snippet worked, I only want to register 1 unit per player anyway (which is what the script allows anyway). I do have another question in this subject, I want to add a value to a player's integer for when he successfully assists, like I have done for kills/deaths. I guess I should insert a code somewhere in the script for when the " assister[*] != null " but it won't take/register the input. Perhaps it's because I'm a JASS newbie and I might have coded it wrong... Here's what I wrote: JASS:set udg_AssistCount[GetConvertedPlayerId(assister[1])] = ( udg_AssistCount[GetConvertedPlayerId(assister[1])] + 1 ) As you can see I'm still thinking in GUI and that might've been the problem? |
| 08-30-2011, 01:16 PM | #5 |
Chuck a udg_ in front of (when referring to them in jass) any global variable you create in the Variables part of the trigger editor. |
| 09-05-2011, 05:55 PM | #6 |
*Back from holidays*. The variable isn't global as far as I know. That's what's confusing to me. "assister[x]" should be a variable, right? And that by assigning the number ("assister[1]") I am telling the trigger to get the owner of the killing unit and assign a number to it; so that when I call the number of the owner to add the integer, I should be able to just use that. Right? Right? |
| 09-05-2011, 07:42 PM | #7 |
It's difficult to comment on that line of code without context. The code of the system isn't posted anywhere and I would rather not have to download and open the system's demo map. Can you try posting at least the entire function where you put that line? I'm surprised there isn't a newer system available for this. All I can think of is this thing. It got stuck in the review process, but is probably still better than what you're using now, however if you stick with your current setup I can probably help you if you post more code. |
| 09-06-2011, 05:40 AM | #8 | |
Hello Anitarf, thanks for the reply. That one you linked to does sound better and if you think it's safe to use instead, I'd probably convert to that since it offers a bit more function than this one. I'll try it and get back after I'm done or if I encounter some difficulty. Meanwhile +rep for all. Edit: Ah bollocks I can't open the sample map presumably because I'm using vanilla World Editor. Anitarf if you're still interested in having a look at the code, here's the whole snippet:
Basically it works properly. But I'm trying to save the value on the scoreboard, and I'm having trouble identifying the player assisting to properly add the integer to credit, blah blah. |
| 09-17-2011, 07:40 AM | #9 |
Sorry it took until now to get back to you, next time you should post a new post instead of editing an old one. You're lucky I stumbled upon this at all. In the //Start setting the assisters: loop, inside the if statement, use Player(i) to refer to the assisting player or simply i to refer to that player's id, so to increase an integer array (your score) for that player, simply do set score[i]=score[i]+1. Note that Player 1's index is 0 in JASS. |
| 09-24-2011, 04:01 AM | #10 |
Hi Anitarf, thanks for the input and help, I didn't want to get yelled at for double posting ha ha ha (also the reason why I decided not to reply until I've tried absolutely every option first). Which brings me to my failure... I still can't seem to get it to work. As I said I tried every combination of spacing and format but this code won't give me an increase in the integer for some reason. Here is my last code snippet before I gave up and ran back here for help: JASS:elseif assister[1] != null and assister[2] == null and assister[3] == null and assister[4] == null and assister[5] == null and assister[6] == null and assister[7] == null and assister[8] == null and assister[9] == null and assister[10] == null and assister[11] == null and assister[12] == null then call DisplayTimedTextToForce(f, 10, GetPlayerNameColored(pd) + " " + AssistanceSystem_DeathMessage() + " by " + GetPlayerNameColored(pu) + " " + AssistanceSystem_AssistMessage() + " " + GetPlayerNameColored(assister[1]) + " !") if bg[1] and bounty then call FadingTextSingle(assister[1], s[2], 255, 220, 0, GetUnitX(d), GetUnitY(d), 0.03, 2, 5) call SetPlayerState(assister[1], ConvertPlayerState(1), GetPlayerState(assister[1], ConvertPlayerState(1)) + gold / 2) set udg_AssistCount[i]=udg_AssistCount[i]+1 endif The AssistCount won't increase. WHYYY won't it argh. |
| 09-24-2011, 07:32 AM | #11 |
Use debug messages. Put one in every if statement to see which parts of the code run and which don't. Is it a problem with the bg[1] or the bounty boolean? Maybe you have more than one assister? the code you posted a few posts ago doesn't seem to do anything if there are more assisters, unless that part got cut off. Anyway, as I suggested in my previous post, you should just increase your assist count in the loop previously, rather than in the assist messages part of the code. If you try to do it elsewhere, don't use the variable i, that only has the right value inside that specific loop, not anywhere in the code. |
| 10-01-2011, 03:51 PM | #12 |
Yesss. Finally. You're absolutely right, it should be placed at the Setting Up part. I guess I was still thinking in GUI. I did this and it gave me the right number all the time, then I applied this into a score board and that too took me a while to get right since I didn't know exactly where to Call the function. Anyway, long story short, problems solved AND every other functions I wanted to do is also achieved thanks to your tips. I wish I could +1 you more mate. |
