Jump to content
MakeWebGames

battletent - only one npc showing at a time


seanybob
 Share

Recommended Posts

in my battletent, no matter what I do, only one npc will show at a time.

say I make 2 npcs. We will call them npcA and npcB. both are added to the battletent.

If i go to battletent.php (in game), I see npcA there, but npcB is nowhere to be found. However, if I remove npcA from the battletent, then return to battletent.php, I can see npcB (but naturally npcA is gone)

it's friggin weird... lol

(version 2.0 code)

Link to comment
Share on other sites

Re: battletent - only one npc showing at a time

I vaguely remember this problem.

Does your query look like this?

 

$q=$db->query("SELECT cb.*,u.*,c.npcid,cy.cityname FROM challengebots cb LEFT JOIN users u ON cb.cb_npcid=u.userid LEFT JOIN challengesbeaten c ON c.npcid=u.userid AND c.userid=$userid LEFT JOIN cities cy ON u.location=cy.cityid ORDER BY cb.cb_npcid");

 

If that doesn't help, let me know. I can send you my working code.

Link to comment
Share on other sites

Re: battletent - only one npc showing at a time

 

I vaguely remember this problem.

Does your query look like this?

 

$q=$db->query("SELECT cb.*,u.*,c.npcid,cy.cityname FROM challengebots cb LEFT JOIN users u ON cb.cb_npcid=u.userid LEFT JOIN challengesbeaten c ON c.npcid=u.userid AND c.userid=$userid LEFT JOIN cities cy ON u.location=cy.cityid ORDER BY cb.cb_npcid");

 

If that doesn't help, let me know. I can send you my working code.

that was the exact query I had (except for the order by at the end)

ya, still doesn't work just by adding the order by to it...

UCC, I will give you the biggest hug in the world if you can tell me whats wrong with it ;)

Link to comment
Share on other sites

Re: battletent - only one npc showing at a time

 

UCC, I will give you the biggest hug in the world if you can tell me whats wrong with it ;)

I want a hug :) please? :P

My game is not up and running for a few days, when you get v1 codes does it have this problem as well?

i know this is v2, but im just wondering, is it the same for v1 as it is for v2 with the battletent mod

Link to comment
Share on other sites

Re: battletent - only one npc showing at a time

 

This is a long shot, But i seen a game with a problem like this with there jail.php

When you have 2 check the very bottom of the page to see if it hasnt "Fell" out of the table.

That was the issue there, The table was ending before it should so would only list 1 at a time and throw any more above the first somewhere else on the screen which was hard to notice.

hehe, nope not this time. I have had that happen to me before, think it was in jail/hospital as well, i probably spent an hour trying to fix it before i noticed that

Link to comment
Share on other sites

Re: battletent - only one npc showing at a time

 

I sent the code to your Gmail account. You can compare what you have to my working version. Hope it helps.

UCC you're a genius...

so i was examining that complex query, when I noticed what was friggin wrong...

two queries to the database that needed to work together in tandem had the same name ($q)

just change one of them to $q2 (like you did) and it works fine

for v2, here is fix

---------------------

find

$q=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$v");
$times=$db->fetch_single($q);

change to

$q2=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$v");
$times=$db->fetch_single($q2);

 

Thanks again UCC *hugs*

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...

Re: battletent - only one npc showing at a time

jeese man ive been trying to figure that out for bloomin ages and yet it takes jsut two seconds to hop in here and find out the problem and fix it i love CE so much

its also wierd because i saw the same bit of code in another post solving that error so i slapped my self round the head thinking why didn't i try that :roll:

Link to comment
Share on other sites

  • 2 months later...

Re: battletent - only one npc showing at a time

maybe its because

$q2=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$v");
$times=$db->fetch_single($q2);

the q2. Try changing that to

$q4=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$v");
$times=$db->fetch_single($q4);

Disclaimer- this is just a thought get a back up of the right stuff first. (lmao)

Link to comment
Share on other sites

Re: battletent - only one npc showing at a time

this gives me an error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Query was SELECT count(*) FROM challengesbeaten WHERE npcid=

changed

 

$q2=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$v");
$times=$db->fetch_single($q2);

 

to

 

$q2=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$userid");
$times=$db->fetch_single($q2);

 

and it works

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...