mIRC Homepage
Posted By: MorningStarX Battle script problem - 27/03/04 09:49 PM
Ok, im not that new to scripting, but im good enough that i know how to create a battle script. But the problem is, the only HP that is depleted is the HP of the last person to register. So if 2 completely different people attack each other (lets say person 1 has 92 HP and person 2 has 83 HP) Person one does 20 damage. But the last person to register had 48 HP, so now the HP of person 2 is 28. And then person 2 attacks doing 34 damage, it killes person 1, even though he had 92 HP. I have no clue how to fix this. If you guys need to see my script, ill show it to you on MIRC. THanks!
Posted By: root66 Re: Battle script problem - 27/03/04 11:07 PM
I am not sure your question is specific enough to catch anyone's interest. Maybe if the script is not entirely too large, you could just post it here and someone will take a look at it. Be warned though, not everyone likes to read through a ton of code.
Posted By: MorningStarX Re: Battle script problem - 28/03/04 03:54 PM
ok, here is part of my code, its the attack part. Its in remote. Ive discovered another problem. When it decreases HP, it decreases it permenently. So if someone does 5 damage to someone with 95 health. It makes his health 90 damage for ever. not exactly sure how i would fix that. I might take a look at that later on. But right now, here is my attack code:

Code:
on 1:TEXT:*!attack*:#: {
  if ($exists(C:\Progra~1\mIRC\ $+ $nick $+ .txt) == $true) {
    if ($exists(C:\Progra~1\mIRC\ $+ $2 $+ .txt) == $true) {
      msg $chan $nick has attacked $2 dealing %attackvalue Damage!
      dec { %hpvalue %attackvalue
        inc { %hpvalue %defencevalue
          msg $chan But, with $2 $+ 's defence, $2 $+ 's HP is %hpvalue
          if (%hpvalue < 1) {
            msg $chan $2 is now dead.
            remove $nick $+ .txt
            msg $chan 3 I am sorry $nick, but you have died, you must now create a new character.  1
          }
          else { 
            if (%hpvalue > 0) {
              msg $chan Thankfully, $2 $+ , you have lived, be careful next time.
            }
          }
        }
      }
    }
  }  
  else {
    msg $chan I'm sorry, but you do not have a character to attack with! Type !create (class) (weapon) to make a character!
  }
  else {
    msg $chan I'm sorry, but the character you are attacking does not exist!
  }
}
 




If anyone knows the porblem, that would be great! thanks.
Posted By: Online Re: Battle script problem - 28/03/04 04:09 PM
What do you have in the <user>.txt files?
Posted By: MorningStarX Re: Battle script problem - 28/03/04 04:35 PM
by <user> .txt files, what do you mean?
Posted By: Online Re: Battle script problem - 28/03/04 04:54 PM
$nick.txt, $2.txt etc.
Posted By: MorningStarX Re: Battle script problem - 28/03/04 05:00 PM
well, i have the nicks of the people that sign up, and then in there, i have their HP value (%hpvalue) MP value, Attack value, defence value, and level value. But it wont read the right persons value. Am i not specifying which value for it to read?
Posted By: Online Re: Battle script problem - 28/03/04 05:16 PM
In your script you're not reading from the files at all. You should have something like set %hpvalue $read($2 $+ .txt), depending on the structure of your file.

Can you please paste the contents of some of the files that you have so we can try to adjust your script?
Posted By: MorningStarX Re: Battle script problem - 28/03/04 05:32 PM
in my files, here is what is in one of them:
Surge , half-op , hubcap , 1 , 74 , 1

so the nick is Surge
his class is Half-op
his weapon is Hubcap,
his level is 1
has 74 HP
and has 1 defence.

Another problem is, its not writing the MP value, or the attack.
heres my creation script that writes the values and stuff.
Code:
 on 1:TEXT:*!create*:#:{
  if ($exists(C:\Progra~1\mIRC\ $+ $nick $+ .txt) == $true) {
    msg # Sorry, $nick, you have already made a character.
  }
  else {
    set %hpvalue $rand(40,100)
    set %mpvalue $rand(1,20)
    set %attackvalue $rand(30,40)
    set %defencevalue $rand(1,10)
    set %level 1
    write $nick $+ .txt $nick , $3 , $2 , %level , %hpvalue , %mpvalue, %attackvalue, %defencevalue
    msg $chan 5 Congrats!!! A new character has been created. 1  
    msg $chan 4 $+ $nick $+ 1, the level %level $2 $+ -using $3 has been created!!!!
    msg $chan 4 $+ $nick $+ 3 has  %hpvalue $+  HP, %mpvalue $+  MP, %attackvalue $+  AT, and %defencevalue $+ DF.
  }
} 


any help would be GREATLY apreciated!
Posted By: MorningStarX Re: Battle script problem - 28/03/04 11:58 PM
ok, i would edit my other post, but my time to edit has expired. But here is what i figured out. I made it so that it read $2's stats. But heres the problem, it reads his stats, so when you attack another person, it uses the other persons stats on the other person. So if one person had 19 attack and another had 21 attack. If the 19 attacks the 21, the guy with 19 does 21 to the guy with 21 because its only reading the guy with 21's stats. Do you understand what im saying? im not sure how to fix this problem now.
Posted By: LexMortis 1337 game - 29/03/04 12:25 AM
Im working on a similar game.. but im pretty damn sure mine is bigger and better laugh

Its basicly gonna be a MUD for irc...
A few features:
- 2 classes: Mage & Warrior
- Stats: intelligence, dexerity, strength, magic, magical resistance, defense
- Complete town: the town is about 33x25 rooms, small 5x5 ascii map shows the surroundings
- Alcohol: Can buy drinks & get drunk, slurred speech, fight differently
- Temples: Join a temple for statboost, 5 ranks for members
- Shops & items: 6 itemslots (weapon, spellbook, armor, shield, amulets), 10+ items of each type
- No level cap
- PK'ing is possible, graveyard for losers
- mIRCcolors are used (but optional incase of non-mircclient)

And prolly more but forgot..
Posted By: Xmevs Re: Battle script problem - 29/03/04 12:40 AM
Dude... that script s*cks... sorry... but it has to be the lamest script I have ever seen. Take a few tutorials or something, because you definately aren't "good enough to make a battle script" crazy

Lex's game pwns. cool
Posted By: MorningStarX Re: Battle script problem - 29/03/04 07:06 PM
Well, here's the problem, no one asked for your jackass opinions. I just asked for your help. Go away if you don't want to answer one question. It’s a script I'm just working on. Yes, I've only been scripting for about 2 weeks. Go screw yourselves.
Posted By: CtrlAltDel Re: Battle script problem - 29/03/04 07:31 PM
don't judge everyone here by the comments of one ..
Posted By: Xmevs Re: Battle script problem - 29/03/04 08:33 PM
No need to give it all that... shocked

When you stated in your first post "...I'm not that new to scripting...", and then posted your code... Apparently, one of those two places, you were lying.

Just a friendly advice: take some tutorials.
Posted By: Mentality Re: Battle script problem - 29/03/04 09:01 PM
Mk, don't want to seem too bossy or anything, but I see where both people are wrong, and I am such an opinionated person!

Xmevs: This is a scripting help forum - we get people who have been scripting for 2 days, 2 weeks, 2 months, years whatever. Because their standards don't match yours isn't a reason to publically (or even privately) flame/embarass them. Your comment wasn't helpful, constructive nor did it really have much of a point in my opinion.

MorningStarX: Just because one person is in the wrong isn't a need to be rude to everyone who has tried to help you. We are just volunteer helpers giving up our free time to help you (and others of course) out. I can see why you'd react the way you did...but not to everyone who hasn't been horrible to you smile

Peace and love everyone, peace and love! <Grin> grin

Regards,
Posted By: Xmevs Re: Battle script problem - 29/03/04 09:28 PM
Well... I am still waiting for some people to point out the most obvious mistake in his code... I can give it to you if you can't find it yourself...

inc { %...
dec { %...

now... what the **** is that '{' doing in there? shocked
© mIRC Discussion Forums