Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   showpoly question (https://forums.graalonline.com/forums/showthread.php?t=53700)

prozac424242 07-11-2004 10:37 PM

showpoly question
 
How come this npc does not show the poly
that I want it to draw?
It looks right to me, and the item placement for
the x and y check work.
Ideally I want just a line to draw from the player then to go up
till it hits an onwall or the top of the level.

NPC Code:

// NPC made by Prozac
if (created || playertouchsme) {show; toweapons Line npc;}

if (weaponfired)
{
//draw a line going up this level or until till onwall
this.y=playery-.5;
this.x=playerx+1;
while (this.y>0 || !(onwall(this.x,this.y)))
{
showpoly 10,(playerx,playery,this.x,this.y);
changeimgvis 10,2;
changeimgcolors 10,1,1,1,1;

//the bombs show up .. why not the line?
// putbomb 1,this.x,this.y;

this.y--;
sleep .05;
}
}



Any help would be appreciated!

Polo 07-11-2004 10:54 PM

In the showpoly it needs {} type brackets instead of () ones.

NPC Code:

showpoly 10,{playerx,playery,this.x,this.y};


prozac424242 07-11-2004 11:06 PM

Thanks! man I need a bigger screen ... those itty bitty changes in () and {} are getin hard to see

Dach 07-12-2004 04:58 AM

use && instead of ||, and I'd suggest doing the showpoly after finding the stopping point (you're only using one line anyway, so no need to draw it over and over)

Okilian 07-12-2004 05:01 AM

newbie scripter question.
|| means or, correct
while && means and?

(my scripting abilities go...that far)

xManiamaNx 07-12-2004 06:08 AM

Correct.

ten words ten words dfsgasdad

Python523 07-12-2004 06:57 AM

to each their own but MY GOD THAT FORMATTING IS UGLY

xManiamaNx 07-12-2004 05:24 PM

Yeah I agree Jagen. Everyone has their own style though.

osrs 07-12-2004 05:59 PM

Quote:

Originally Posted by Python523
to each their own but MY GOD THAT FORMATTING IS UGLY

Reminds me of PS' weird style, hehe.

prozac424242 07-14-2004 04:15 AM

You mean the formatting that I posted the code in?
I just used the style button that comes with Graal.

Plus after programming for more than 20 years,
I know what the code means however it looks on screen.
In time you will probably develop that tendency also.

Python523 07-14-2004 05:12 AM

Quote:

Originally Posted by prozac424242
Plus after programming for more than 20 years,
I know what the code means however it looks on screen.
In time you will probably develop that tendency also.

I never said I don't know what it means on screen, so don't assume that. When I code I try to make things EASY on my eyes.

Dach 07-14-2004 05:01 PM

he's just refering to your
NPC Code:

if (created)
{
dostuffhere;
}


as opposed to the more popular
NPC Code:

if (created) {
dostuffhere;
}


among some other small things, I've gotten used to both over time, so it doesn't bother me (the added spaces from the forums do, however :pissed: )

prozac424242 07-16-2004 11:51 PM

Back in the mid to late 1990's when I was in college, the profs taught me that in programming, neat code included each bracket on its own line. This way you can draw boxes around printed sets of code and see if you are missing a bracket easier. To each his own, of course.

Lance 07-16-2004 11:55 PM

Do not use toweapons for weapon NPCs. Add weapons manually through NC, and use the serverside command 'addweapon weaponname' in some NPC to add the weapon to the player.


All times are GMT +2. The time now is 10:35 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.