Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   How do i do warping scripts? (https://forums.graalonline.com/forums/showthread.php?t=65283)

colin012 04-10-2006 02:05 AM

How do i do warping scripts?
 
I think its a npc. like when you go in a door or hit a certent spot you go to another level you made? What npc do i use and what is the scripting for it?

excaliber7388 04-10-2006 02:15 AM

Well, on a level, use the warps. All you have to do is highlight an area (or know it's x+y) and hit the Blue arrow button to set the warp info. for an NPC you would use setlevel2("newlevelname",playerx,playery) (in GS@, for online scripts) or setlevel2 newlevelname,playerx,playery; actually enter info in for playerx and y like 13, 31 etc

napo_p2p 04-10-2006 02:25 AM

2 Attachment(s)
As excaliber said, for level warps, you want to use links.

1) Select area of level where you want a Link.
2) Push the blue arrow (See attachment 1).
3) Input link info in window that pops up (See attachment 2).
4) Push OK.
3) Tada! Your link is done. You can also edit links by pushing the button next to the blue arrow.

colin012 04-10-2006 03:29 AM

1 Attachment(s)
Quote:

As excaliber said, for level warps, you want to use links.

1) Select area of level where you want a Link.
2) Push the blue arrow (See attachment 1).
3) Input link info in window that pops up (See attachment 2).
4) Push OK.
3) Tada! Your link is done. You can also edit links by pushing the button next to the blue arrow.
Wow this helps alot! I have something else to ask. How do you make an passable object unpassable? I made this one spar with a viewer and lava. But the player can swim up the lava water falls. I will atach it in this message.

napo_p2p 04-10-2006 03:35 AM

Quote:

Originally Posted by colin012
How do you make an passable object unpassable? I made this one spar with a viewer and lava. But the player can swim up the lava water falls. I will atach it in this message.

You can't. You will either have to use tiles are are blocking, or find images to replace those waterfalls with.

colin012 04-10-2006 03:54 AM

Quote:

You can't. You will either have to use tiles are are blocking, or find images to replace those waterfalls with.
This is kinda off topic but how do you add images? Also do you know how i can get the lave falls that realy fall and are anamated?

Andy0687 04-10-2006 03:57 AM

1 Attachment(s)
Quote:

Originally Posted by colin012
Wow this helps alot! I have something else to ask. How do you make an passable object unpassable? I made this one spar with a viewer and lava. But the player can swim up the lava water falls. I will atach it in this message.

Use setshape to put an npc over the falls you want to block
NPC Code:

if (created) {
setshape 1,322,110;
}



Ive attached the level so you can see it in action

colin012 04-10-2006 04:18 AM

Quote:

Use setshape to put an npc over the falls you want to block
Sweet thanks!. Whats the npc code for starting a spar?

Andy0687 04-10-2006 06:20 AM

1 Attachment(s)
Quote:

Originally Posted by colin012
Sweet thanks!. Whats the npc code for starting a spar?

Sorry I dont quite understand what you mean.
Starting the spar by laying a bomb? Or what.

You could set an npc where you want and use playerchats, and putbomb.
Not very hard but i attached the level so you can see if that was what you needed. Commented so you will see what it does.

colin012 04-10-2006 02:51 PM

Quote:

Sorry I dont quite understand what you mean.
Starting the spar by laying a bomb? Or what.
Kind of. but you can't fight befor you say start and it doesn't add to your deaths.

And whats the npc code for a healing thing?

Omini 04-10-2006 04:03 PM

An easier method for the setshape bit would be

NPC Code:

setshape 1,16*x,16*y;



Replace the x with the amount of Graal tiles horizontal and the y with the amount of Graal tiles vertical, this stops you having to calculate the amount of pixels since each Graal tile is 16x16 pixels.

Bl0nkt 04-10-2006 09:14 PM

Quote:

Originally Posted by colin012
Kind of. but you can't fight befor you say start and it doesn't add to your deaths.

And whats the npc code for a healing thing?

Depends on the system. Classic worlds use playerhearts (I think).

example:

NPC Code:
if (playertouchsme)
playerhearts++;



When the player touches the NPC, their hearts increase by one (++).

NPC Code:
playerhearts+=1;
playerhearts=playerhearts+1;



These would also do the same.

In a lot of systems, though, it uses custom HP that use client/clientr strings.

Example:

NPC Code:
if (playertouchsme)
setstring clientr.hp,strtofloat(#v(clientr.hp))+1;



At least I think that's what it is. Haven't done GS1 in a while.

napo_p2p 04-11-2006 10:19 AM

Quote:

Originally Posted by Bl0nkt
Example:

NPC Code:
if (playertouchsme)
setstring clientr.hp,strtofloat(#v(clientr.hp))+1;



At least I think that's what it is. Haven't done GS1 in a while.


Example of why old script is evil :(.

Should be:
NPC Code:
setstring clientr.hp,#v(strtofloat(#s(clientr.hp)) + 1);



Not your fault. Old gscript's fault.

Andy0687 04-11-2006 05:41 PM

1 Attachment(s)
Quote:

Originally Posted by Omini
An easier method for the setshape bit would be

Hadnt really thought of doing that for some reason. Sounds like that could be a good plan but make sure that the x or y is greater then one tile otherwise you might have trouble grabbing the npc in the level editor again :P

Quote:

Kind of. but you can't fight befor you say start and it doesn't add to your deaths.
all you put in an npc to make it a "sparringzone" is just that
NPC Code:

sparringzone



It appears its still picky in editor what you have there, and Ive always done it that way online also.

And you want it not to start before you say fight? Now you are getting into bigger scripts, you wanna check where the players are at, and have their weapons disabled first!

NPC Code:

if (playerenters) {
disableweapons;
}



Next we need to expand the playerchats block to make sure only people inside the spar zone can say "start" and then anyone in the block, enable their weapons.

NPC Code:

if (playerx in |21,42| && playery in |25,40|) {
...
}


NPC Code:

for (i=0;i<playerscount;i++) {
if (playerx in |21,42| && playery in |25,40|) {
enableweapons;
}
}



All its doing is checking the |start,end| and seeing if your x and y are in those numbers, if you are in the sparring zone, you should be in them. Otherwise you cant start the spar, or get your weapons enabled.

Of course youll need to combine this with everything else, to make a complete script, go ahead and check the level. The healer is in there too.

Hope you are learning something ^^

Prozac 04-12-2006 12:09 AM

i just have to say how wonderful it is to see people actually helping new players learn things. Has Lance been removed as a moderator? Or have the scripting forums rules changed? Keep up the good work, its great to see the open sharing of basic code principles come back to this part of the forums again.


All times are GMT +2. The time now is 12:00 AM.

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