mIRC Home    About    Download    Register    News    Help

Print Thread
Battle script problem #76922 27/03/04 09:49 PM
Joined: Mar 2004
Posts: 9
M
MorningStarX Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2004
Posts: 9
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!

Re: Battle script problem #76923 27/03/04 11:07 PM
Joined: Oct 2003
Posts: 101
root66 Offline
Vogon poet
Offline
Vogon poet
Joined: Oct 2003
Posts: 101
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.

Re: Battle script problem #76924 28/03/04 03:54 PM
Joined: Mar 2004
Posts: 9
M
MorningStarX Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2004
Posts: 9
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.

Re: Battle script problem #76925 28/03/04 04:09 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
What do you have in the <user>.txt files?

Re: Battle script problem #76926 28/03/04 04:35 PM
Joined: Mar 2004
Posts: 9
M
MorningStarX Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2004
Posts: 9
by <user> .txt files, what do you mean?

Re: Battle script problem #76927 28/03/04 04:54 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
$nick.txt, $2.txt etc.

Re: Battle script problem #76928 28/03/04 05:00 PM
Joined: Mar 2004
Posts: 9
M
MorningStarX Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2004
Posts: 9
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?

Re: Battle script problem #76929 28/03/04 05:16 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
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?

Re: Battle script problem #76930 28/03/04 05:32 PM
Joined: Mar 2004
Posts: 9
M
MorningStarX Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2004
Posts: 9
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!

Re: Battle script problem #76931 28/03/04 11:58 PM
Joined: Mar 2004
Posts: 9
M
MorningStarX Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2004
Posts: 9
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.

1337 game #76932 29/03/04 12:25 AM
Joined: Sep 2003
Posts: 26
L
LexMortis Offline
Ameglian cow
Offline
Ameglian cow
L
Joined: Sep 2003
Posts: 26
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..

Re: Battle script problem #76933 29/03/04 12:40 AM
Joined: Dec 2003
Posts: 5
X
Xmevs Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
X
Joined: Dec 2003
Posts: 5
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

Re: Battle script problem #76934 29/03/04 07:06 PM
Joined: Mar 2004
Posts: 9
M
MorningStarX Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2004
Posts: 9
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.

Re: Battle script problem #76935 29/03/04 07:31 PM
Joined: Jun 2003
Posts: 994
C
CtrlAltDel Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
don't judge everyone here by the comments of one ..


I refuse to engage in a battle of wits with an unarmed person. wink
Re: Battle script problem #76936 29/03/04 08:33 PM
Joined: Dec 2003
Posts: 5
X
Xmevs Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
X
Joined: Dec 2003
Posts: 5
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.

Re: Battle script problem #76937 29/03/04 09:01 PM
Joined: Jun 2003
Posts: 5,024
M
Mentality Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
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,


Mentality/Chris
Re: Battle script problem #76938 29/03/04 09:28 PM
Joined: Dec 2003
Posts: 5
X
Xmevs Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
X
Joined: Dec 2003
Posts: 5
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