Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   newbie scripter. (https://forums.graalonline.com/forums/showthread.php?t=32737)

draygin 07-02-2002 08:54 AM

newbie scripter.
 
Ok I'm really new to scripting and I have an npc document that I swear is from 1.39 I mean it uses stuff like setgifpart etc..

Any how please bare with me as I slaughter and crucify script commands. :(

I'm trying to set it up so when your hp reaches 0 you get warped to a specified level. This is what I have so far. Sorry in advance its my first attempt at real script aside from clothes changer and details such as lighting effects.

This is what I have so far.
if (playerenters) {toweapons hellwarp;}
if (timeout=.5&&client.hp=0){setlevel2 underworld.nw,30,30;}

(toweapons and hellwarp are just temporary to test offline.) Obviously this doesnt work. I was talking to a friend and he said to use strtofloat(#s(client.HP))=0 although what some of those commands beats me since I cant find them on my npc document. I dont want some one to do the code. But maybe suggest looking into some alternate command. Etc..
(also if some one has an up to date npc document I'd appreceate it)

draygin 07-02-2002 09:00 AM

ok ok sweet I just found a handy little command playedies =D but the problem is when I get up I get warped back to where I died. Hmm maybe time out or so. Or something unos momentos I'll be editing this post.

if (playerenters) {toweapons hellwarp3;}

if (playerdies) {setlevel2 underworld.nw,30,30;}

hmm maybe if I change the setlevel2 command or perhaps a time out some where *dabbles*

/edit I also just found the strofloat command in the document. :)

hmm thats no good I cant get the player to stay in the level.

hmm what does it mean when a stack overflow comes up when you try to play the level and graal crashes? I'm going to assume if (playerdies) wont work for what I need.

Ok two hours laters and still where I was at. I'll work on this some more tommorrow.

reeset1 07-02-2002 10:01 AM

I had a nice, FLAWLESS HP script on my good comp, however, that comp broke down almost 2 months ago and is just NOW getting fixed. :rolleyes:

draygin 07-02-2002 10:32 AM

Quote:

Originally posted by reeset1
I had a nice, FLAWLESS HP script on my good comp, however, that comp broke down almost 2 months ago and is just NOW getting fixed. :rolleyes:
The hp script is fine. I just want to warp players when they die. :) This might not be for anything more than a learning experience.

Torankusu 07-02-2002 10:44 AM

Is this for Providence?

You'd need to use triggeraction, because I don't think setlevel2 can be done clientside.

Torankusu 07-02-2002 10:50 AM

Re: newbie scripter.
 
Quote:

Originally posted by draygin
Ok I'm really new to scripting and I have an npc document that I swear is from 1.39 I mean it uses stuff like setgifpart etc..

Any how please bare with me as I slaughter and crucify script commands. :(

I'm trying to set it up so when your hp reaches 0 you get warped to a specified level. This is what I have so far. Sorry in advance its my first attempt at real script aside from clothes changer and details such as lighting effects.

This is what I have so far.
if (playerenters) {toweapons hellwarp;}
if (timeout=.5&&client.hp=0){setlevel2 underworld.nw,30,30;}

(toweapons and hellwarp are just temporary to test offline.) Obviously this doesnt work. I was talking to a friend and he said to use strtofloat(#s(client.HP))=0 although what some of those commands beats me since I cant find them on my npc document. I dont want some one to do the code. But maybe suggest looking into some alternate command. Etc..
(also if some one has an up to date npc document I'd appreceate it)

wouldn't it be strtofloat(#s(client.HP),0)?

Er, whatever.

Check for it to be 0, and then to a triggeraction.
For example...
NPC Code:
 
if (actionserverside){ //Checks for serverside action in the NPCW.
setlevel2 underworld.nw,30,30; // sets level
}

//#CLIENTSIDE
if (timeout && strequals(#s(client.hp),0)){ //Checks for death with HP.
triggeraction 0,0,serverside,hellwarp,; //Triggers
timeout=0.1; //Loops...?
}



if (actionserverside) is above //#CLIENTSIDE because if it was below, it would be clientside also.
It's an example, and it might only work online, or not at all. I'm not sure about the strequals.

Goboom 07-02-2002 11:37 AM

Re: newbie scripter.
 
Quote:

Originally posted by draygin

This is what I have so far.
if (playerenters) {toweapons hellwarp;}
if (timeout=.5&&client.hp=0){setlevel2 underworld.nw,30,30;}

HEY BUDDY! YOUR FORGOT YOUR 2nd timeout! this should work...
NPC Code:

if (playerenters) {toweapons hellwarp;timeout=0.05;}
if (timeout&&client.hp=0){setlevel2 underworld.nw,30,30;timeout=0.05;}


Bhala 07-02-2002 01:45 PM

Quote:

Originally posted by Torankusu
Is this for Providence?

You'd need to use triggeraction, because I don't think setlevel2 can be done clientside.

lol yes it can

Torankusu 07-02-2002 02:04 PM

Quote:

Originally posted by Bhala


lol yes it can

you have tested this online?

It might just be our NPCserver, but it didn't work.

edit: I was talking about for NPCservers.

draygin 07-02-2002 08:48 PM

Thanks guys :) I'll play some more when I get home. Setlevel2 works serverside but not clientside. It could be for providence. But more than anything I'm just learning some scripting. :)

jeff335 07-02-2002 09:34 PM

if(actionserverside){
setlevel2 level.nw,30,30;
}
//#CLIENTSIDE
if(playerdies){
//call it -hellwarp, add it using the NPC doler or something
triggeraction 0,0,serverside,-hellwarp;
}

draygin 07-02-2002 09:43 PM

Quote:

Originally posted by jeff335
if(actionserverside){
setlevel2 level.nw,30,30;
}
//#CLIENTSIDE
if(playerdies){
//call it -hellwarp, add it using the NPC doler or something
triggeraction 0,0,serverside,-hellwarp;
}

Yeah I knew I had to put the - so it didnt show up in the inventory. Now I just need to go home and learn what triggeractions is. :D I'm sure I'll be doing better once I learn what the commands actually are instead of going through a list looking for one that does what I need.


All times are GMT +2. The time now is 06:21 PM.

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