Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   The LH Scripting Questions Thread (https://forums.graalonline.com/forums/showthread.php?t=23084)

lordhelmut 02-05-2002 07:48 AM

The LH Scripting Questions Thread
 
Alright, u guys are prolly sick of all my threads and questions so I will ask here and answer if you (and will)

My first question is...

say you have a gani (single dir) that is 8 frames and its the exact same as the normal walk gani going left accept its single dir and it has slight modifications. How would you script it so it replaced it when they walk?

TDK_RC6 02-05-2002 07:55 AM

replaceani walk,whateverganiofyours;

lordhelmut 02-05-2002 08:50 AM

first off this wouldnt work cuz this is a single dir gani so setani wont work

Python523 02-05-2002 08:53 AM

Hmm, are you allowed to use multiframe single dir ganis on free? I thought you could only use the default ones and single frame and dir ganis

royce 02-05-2002 08:59 AM

Non-P2P should be allowed to use stuff that modifys the walking npc, like adding a backpack or such, anything else that is not legal should be out the door. There is no use for gani on a non-p2p server.

Faheria_GP2 02-05-2002 09:55 AM

except **** like the jumprope <3

lordhelmut 02-05-2002 10:07 AM

free can use the jump rope but its ***, however, free servers can use multi frame single dir ganis. Anyways, i just modified the walking NPC and im trying to make this work. Anyone with any ideas?

TDK_RC6 02-05-2002 10:16 AM

fine, then do this:

NPC Code:

if (created) {
replaceani walk,newalk;
toweapons -ganisystem; }
if (isweapon) { timeout=.05; }
if (timeout) {
if (playerdir!=1) {
playerdir=1;
}
timeout=.05; }


Saga2001 02-05-2002 01:28 PM

non-p2p can use multi-framed single dir. prooved when some guy so keenly pointed out that you could make go karts for non-p2p...what a smart guy...:rolleyes:

TDO2000 02-05-2002 06:25 PM

Quote:

Originally posted by TDK_RC6
fine, then do this:

NPC Code:

if (created) {
replaceani walk,newalk;
toweapons -ganisystem; }
if (isweapon) { timeout=.05; }
if (timeout) {
if (playerdir!=1) {
playerdir=1;
}
timeout=.05; }


No Pay => no replaceani k?

lordhelmut 02-05-2002 06:59 PM

Anyone have any ideas? If not is there a way to display a chosen frame? like setani name,frame,;

TDK_RC6 02-05-2002 08:08 PM

forgot it was nonP2P, sorry

if you want it to specify a specific gani or something

NPC Code:

if (created) {
toweapons -ganisystem;
this.frametime=.4; // Length of GANI
setani newaniname,; }
if (isweapon) { timeout=.05; }
if (timeout) {
playerdir=1;
if (this.frametime>0) {
this.frametime-=.05;
} else { setani newaniname,; this.frametime=.4; }
timeout=.05; }


lordhelmut 02-06-2002 06:15 AM

what about a menu? are menus using showimg hard to make?

Saga2001 02-06-2002 06:55 AM

Menu? yesh. the one i sent you was fairly simple. If you want to you can easily add and remove items from the menu, etc. I can chat with u on how to make it own.

lordhelmut 02-06-2002 06:58 AM

//NPC Made By LORD HELMUT
if(created){
this.max=7;
}
if(playerchats) {
tokenize #c;
if(strequals(#a,#I(server.ph1tenants,0))){
//add new Tenant
if(startswith(AddTenant,#c)){
if(sarraylen(server.ph1tenants) <= this.max){
addstring server.ph1tenants,#t(1);
}
else {
setplayerprop #c,You already have #v(sarraylen(server.ph1tenants)-1) tenants!; //-1 cause of the owner
}
}
//remove tenant
if(startswith(RemoveTenant,#c)){
removestring server.ph1tenants,#t(1);
}
}
}

thats a ghetto old script I made but remove tenant wont work =/ I say removetenant lordhelmut and it no workie

TDK_RC6 02-06-2002 07:42 AM

a menu is simple :p

thats what im working on right now, but it is like 4 or 5 combined into one :S

lordhelmut 02-06-2002 08:51 AM

how exactly do u make them?

Cybnext_Design 02-06-2002 08:54 AM

Quote:

Originally posted by lordhelmut
<script>

thats a ghetto old script I made but remove tenant wont work =/ I say removetenant lordhelmut and it no workie

Why is it that everytime I make something, somehow you lose it? If you want, I'll remake or try and find it again.

TDK_RC6 02-06-2002 08:54 AM

well lets see, make the menu image

then use
showimg index,imagename,x,y;
changeimgvis index,4;

then it all depends on what you want

lordhelmut 02-06-2002 09:39 AM

// NPC made by Golem
if (playertouchsme) {
this.pos=0;
disabledefmovement;
setani idle,;
timeout=.05;
}
if(timeout&&this.pos=0){
showimg 200,@Arial@cb@->Deposit,(screenwidth/2),(screenheight/2-120);
showimg 201,@Arial@cb@Withdrawl,(screenwidth/2),(screenheight/2-100);
changeimgvis 200,4;
changeimgvis 201,4;
if(keydown(2)&&this.pos=0){
this.pos=1;
showimg 200,@Arial@cb@Deposit,(screenwidth/2),(screenheight/2-120);
showimg 201,@Arial@cb@->Withdrawl,(screenwidth/2),(screenheight/2-100);
changeimgvis 200,4;
changeimgvis 201,4;
}
if(keydown(2)&&this.pos=1){
timeout=.05;
}
timeout=.05;
}


HOW IS THAT SO FAR :D

TDK_RC6 02-06-2002 08:14 PM

ahhhhh, im sorry i just dont like showimg text menus

joseyisleet 02-06-2002 11:08 PM

-=Josey=-
This may not be the best for advanced scripts, but since you were asking how, you most likely won't be making any advanced ones yet.

/*
NPC made by Josey Hunt.
This is a simple menu selector.
*/
if (playertouchsme){
doImages();
disabledefmovement;
}

function doImages(){
showimg 1,@~ Test,50,200;
showimg 2,@Exit,50,250;
this.selected=0;
doZoom();
this.enabled=1;
timeout=.05;
}
if (timeout&&this.enabled=1){
doKeyCheck();
timeout=.05;
}
function doKeyCheck(){
if (keydown(2)&&this.selected=0){
this.selected=1;
showimg 1,@Test,50,200;
showimg 2,@~ Exit,50,250;
}
if (keydown(0)&&this.selected=1){
this.selected=0;
showimg 1,@~ Test,50,200;
showimg 2,@Exit,50,250;
}
if (keydown(5)){
if (this.selected=0){
say2 Testing!;
}
if (this.selected=1){
Exit();
}
}
doZoom();
timeout=.05;
}
function doZoom(){
changeimgvis 1,4;
changeimgzoom 1,.6;
changeimgcolors 1,0,0,0,255;
changeimgvis 2,4;
changeimgzoom 2,.6;
changeimgcolors 2,0,0,0,255;
}
function Exit(){
showimg 1,,,;
showimg 2,,,;
enabledefmovement;
timeout=0;
this.enabled=0;
}

lordhelmut 02-07-2002 03:30 AM

Yea that helped a lot =D thanks

joseyisleet 02-07-2002 03:58 AM

-=Josey=-
You're welcome. ;D

joseyisleet 02-07-2002 04:00 AM

-=Josey=-
Well I think that I've beaten insomnia right about now. So it's time for me to take my weekly slumber. Later everyone.

lordhelmut 02-12-2002 03:20 AM

Couple Questions...

One, for a NPC like a system or something, how do you have it ALWAYS checking for like a keydown or an action or something?

Second, Whats the best way to script a chase script for a boss or baddie that should go after the nearest player. (I know player index but I dont understand how to use it)

neomaximus2k 02-12-2002 04:17 AM

Shiw Image
 
Well i am working ona few sho image menu's for asteria at the moment, so if you still havn't got it sorted out drop me a line :D


All times are GMT +2. The time now is 11:42 AM.

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