Whoa, sorry sorry... my mistake. That code is actually in on_key_press... I don't know what I was thinking.
I've shuffled it all around now, and put the code necessary into repeatedly_execute, and InjureMe now works fine.
The problem now is just that the attacking part of the code won't work.
This is all in repeatedly_execute:
Code: ags
It's now just the line if ((moleret == CD_COLLISION) && (character[EGO].view==19)) that doesn't appear to be working. The collision is fine because it works when I use (IsKeyPressed(88)) instead of the character[EGO].view line. The necessary view is 20, so I have taken 1 off it.
I've shuffled it all around now, and put the code necessary into repeatedly_execute, and InjureMe now works fine.
The problem now is just that the attacking part of the code won't work.
This is all in repeatedly_execute:
if (character[EGO].loop == 0) {
Ã, egoslot = 202;
Ã, }
else if (character[EGO].loop == 1) {
Ã, Ã, egoslot = 203;
Ã, }
else if (character[EGO].loop == 2) {
Ã, Ã, egoslot = 204;
Ã, }
else if (character[EGO].loop == 3) {
Ã, Ã, egoslot = 200;
Ã, }
///////////////////////////////// MONSTERS ///////////////////////////////
moleret = spriteSpriteColDetect (EGO, CD_CHARACTER, egoslot, MOLERAT, CD_CHARACTER, 201);
moleret2 = spriteSpriteColDetect (EGO, CD_CHARACTER, 68, MOLERAT, CD_CHARACTER, 201);
//////////////////////////////////////////////////////////////////////////
Ã,Â
if (character[EGO].room == 1) {
Ã, if ((moleret == CD_COLLISION) && (character[EGO].view==19)) {
Ã, Ã, Ã, if ((Random(luck))<2) {
Ã, TypeLineKaya (510, 130, 50, 1, 12, 200, 0, -1); //miss
}
else {
mondmg = ((str + wpnstr) + (RandomEx(((str/5)-str%5)*4,str)) - (RandomEx(((mondef/5)-mondef%5)*4,mondef)));
if (mondmg<1) mondmg=1;
molehp -= mondmg;
DisplayDMG ();
Display ("Molerat takes %d damage! Molerat's HP is %d", mondmg, molehp);
}
Ã, Ã, Ã, }
Ã, if ((moleret2 == CD_COLLISION) && (character[EGO].view!=19) && (GetGlobalInt(6)==0)) {
Ã, Ã, Ã, InjureMe();
Ã, Ã, Ã, }
}
It's now just the line if ((moleret == CD_COLLISION) && (character[EGO].view==19)) that doesn't appear to be working. The collision is fine because it works when I use (IsKeyPressed(88)) instead of the character[EGO].view line. The necessary view is 20, so I have taken 1 off it.