Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-28-2007, 10:38 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
setimg/setimgpart? offset

Is there any way to set where the img starts (in pixels) relative to the NPC? I'd like to use setimgpart() but basically do:

setimgpart("image.png",-10,0,width,height);

to give the image a transparent border on the left of 10px. Is this at all possible? I could do it with showimg, but it doesn't move in pixels unless I set the layer to 5 but with the layer at 5 i can't easily put the image in the correct place relative to the level.


Is this possible?

Thanks.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #2  
Old 02-28-2007, 11:23 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by JkWhoSaysNi View Post
I could do it with showimg, but it doesn't move in pixels unless I set the layer to 5 but with the layer at 5 i can't easily put the image in the correct place relative to the level.
Well, you can use the layer of 5 and use:
worldx(screenx, screeny);
worldy(screenx, screeny);

To convert screen coordinates to level coordinates.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 03-01-2007, 12:36 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by napo_p2p View Post
Well, you can use the layer of 5 and use:
worldx(screenx, screeny);
worldy(screenx, screeny);
Please explain this :o
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 03-01-2007, 12:49 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Angel_Light View Post
Please explain this :o

Converts things such as mousex and mousey to level coordinates.
Reply With Quote
  #5  
Old 03-01-2007, 12:55 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Angel_Light View Post
Please explain this :o
"Converts screen coordinates to level coordinates"

Each function takes two screen coordinates (an x and a y), then returns the level x or y (depending on the function).

Play around with it....

PHP Code:
//#CLIENTSIDE
function onMouseDown() {
  
player.chat  worldx(mousescreenxmousescreenySPC worldy(mousescreenxmousescreeny);

That would be more or less the same thing as outputting mousex and mousey.

I'm not entirely sure about gmap behavior though, but those can be easily converted too.

Quote:
Originally Posted by Gambet View Post
Converts things such as mousex and mousey to level coordinates.
I think mousex and mousey are already in level coordinates...
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #6  
Old 03-01-2007, 01:00 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by napo_p2p View Post
I think mousex and mousey are already in level coordinates...

Not sure actually.


How we normally make checks it would appear to be the position in the level, but I double checked and looked at the worldx/worldy descriptions and they stated that mousex was screen position, which ultimately wouldn't make much sense.

The worldx description and the mousex description state that they are two different things x-x

Last edited by Gambet; 03-01-2007 at 01:11 AM..
Reply With Quote
  #7  
Old 03-01-2007, 02:55 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
mousex/y is in level coordinates, though it may give different values than worldx/y. mousex/y may only be relative to a flat gmap (I don't think so, but maybe...) whereas worldx/y varies depending on the terrain, and thus the need for both x and y parameters.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #8  
Old 03-01-2007, 03:04 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
ah, I get it, Thanks Napo
__________________
Deep into the Darkness peering...
Reply With Quote
  #9  
Old 03-01-2007, 10:52 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by JkWhoSaysNi View Post
Is there any way to set where the img starts (in pixels) relative to the NPC? I'd like to use setimgpart() but basically do:

setimgpart("image.png",-10,0,width,height);

to give the image a transparent border on the left of 10px. Is this at all possible? I could do it with showimg, but it doesn't move in pixels unless I set the layer to 5 but with the layer at 5 i can't easily put the image in the correct place relative to the level.


Is this possible?

Thanks.
This thread seems to have derailed a little. layer 3 and lower places the showimg per tile. if you want to move it just a pixel, well its just a little math.
One tile is 16x16 pixels, so if you want to move it a pixel on the level space, you move it by 1/16 tiles, which is equal to one pixel =)
__________________
Reply With Quote
  #10  
Old 03-01-2007, 11:06 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Kristi View Post
This thread seems to have derailed a little. layer 3 and lower places the showimg per tile. if you want to move it just a pixel, well its just a little math.
One tile is 16x16 pixels, so if you want to move it a pixel on the level space, you move it by 1/16 tiles, which is equal to one pixel =)
But then you are changing the real position. He wants to be able to offset the image displayed, not the object displaying it (such as a npc or a TShowImg)
__________________
Do it with a DON!
Reply With Quote
  #11  
Old 03-01-2007, 11:11 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by zokemon View Post
But then you are changing the real position. He wants to be able to offset the image displayed, not the object displaying it (such as a npc or a TShowImg)
No, what I started is exactly what he wanted.
" I could do it with showimg, but it doesn't move in pixels unless I set the layer to 5 but with the layer at 5 i can't easily put the image in the correct place relative to the level."
He only looked at the showimgpart as an alternative because he didnt know how to move it by pixel on the level layer (showimgpart allows a pixel manipulation on this layer, so he thought it was the way to go).
__________________
Reply With Quote
  #12  
Old 03-01-2007, 04:16 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Kristi View Post
No, what I started is exactly what he wanted.
" I could do it with showimg, but it doesn't move in pixels unless I set the layer to 5 but with the layer at 5 i can't easily put the image in the correct place relative to the level."
He only looked at the showimgpart as an alternative because he didnt know how to move it by pixel on the level layer (showimgpart allows a pixel manipulation on this layer, so he thought it was the way to go).
Wtf, it doesnt? What about something like ->
PHP Code:
showimg 200,blah.png,30 16,30
The x would then be 30 + 1 pixel ;>
Reply With Quote
  #13  
Old 03-01-2007, 06:05 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Can things be moved by small amounts like 1px serverside though?

I cant seem to get anything to move that little.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #14  
Old 03-01-2007, 06:15 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by JkWhoSaysNi View Post
Can things be moved by small amounts like 1px serverside though?

I cant seem to get anything to move that little.
Should work o.O Not sure though.
Reply With Quote
  #15  
Old 03-01-2007, 06:21 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Well it's actually part of an NPC. I'm using setimgpart() to show part of an npc but i need the npc to move slightly.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #16  
Old 03-01-2007, 09:32 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by JkWhoSaysNi View Post
Can things be moved by small amounts like 1px serverside though?

I cant seem to get anything to move that little.
serverside only displays with an accurcy of .5 tiles. why not put the showimg in the clientside anyway...
__________________
Reply With Quote
  #17  
Old 03-01-2007, 10:14 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Maybe display the image with an index below 200 instead of using a serverside script? Well, maybe you are already doing this, not sure.
Reply With Quote
  #18  
Old 03-01-2007, 10:39 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Quote:
Originally Posted by Kristi View Post
serverside only displays with an accurcy of .5 tiles. why not put the showimg in the clientside anyway...
The NPC is a door which I want everyone in the level to see open/close at the same time.

I guess i'll have to use showimg to do it.

Edit: do serverside showanis have a accuracy of .5 tiles too? I'm doing showanis with indexes < 200 and clientside they look fine but for everyone else they're in the wrong place (rounded to .5 tiles by the looks of it)
__________________

Coming soon (Hopefully:P)

Last edited by JkWhoSaysNi; 03-01-2007 at 10:53 PM..
Reply With Quote
  #19  
Old 03-01-2007, 10:42 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by JkWhoSaysNi View Post
The NPC is a door which I want everyone in the level to see open/close at the same time.

I guess i'll have to use showimg to do it.

Well, you can always set the img to a blank img on the serverside via setimg().
Reply With Quote
  #20  
Old 03-01-2007, 11:47 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by JkWhoSaysNi View Post
The NPC is a door which I want everyone in the level to see open/close at the same time.

I guess i'll have to use showimg to do it.

Edit: do serverside showanis have a accuracy of .5 tiles too? I'm doing showanis with indexes < 200 and clientside they look fine but for everyone else they're in the wrong place (rounded to .5 tiles by the looks of it)
It would be easier to just edit the gani and adjust the positioning of the door in there.

If the gani sprites are positioned correctly, then all you have to do is use setcharprop.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #21  
Old 03-02-2007, 06:33 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by JkWhoSaysNi View Post
The NPC is a door which I want everyone in the level to see open/close at the same time.

I guess i'll have to use showimg to do it.

Edit: do serverside showanis have a accuracy of .5 tiles too? I'm doing showanis with indexes < 200 and clientside they look fine but for everyone else they're in the wrong place (rounded to .5 tiles by the looks of it)
Anis = rounded, although you answered your own question

if its opening, use an ani instead, so the opening animation looks smooth. you shouldnt be looping an npc animation serverside, which im assuming youre trying to do if its pixel by pixel
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:54 PM.


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