Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-23-2001, 01:03 PM
Link188 Link188 is offline
Registered User
Link188's Avatar
Join Date: Jul 2001
Location: Monroeville, PA
Posts: 548
Link188 is on a distinguished road
Send a message via AIM to Link188
Question Help on a weapon

Can someone help me on this script?


// NPC made by Jeice Lighthawk
if (playerenters) {
toweapons *Giru Shoot;
replaceani shoot,giru_shoot;
setstring girushot,#v(strtofloat(#s(girushot))+50);
timeout=0.05;
}
while (isweapon) {
timeout=0.05;
}
if (isweapon) {
this.pos = {screenwidth-125,65};
this.girushot = ((strtofloat(#s(girushot))/50)*10);
showimg 1,girubeam.gif,this.pos[0],this.pos[1];
changeimgvis 1, 4;
showimg 2,girubeam2.gif,this.pos[0],this.pos[1];
changeimgpart 2,0,0,40,this.girushot;
changeimgvis 2, 4;
timeout=0.05;
}
if (weaponfired&&timeout) {
setstring girushot,#v(strtofloat(#s(girushot))-10);
timeout=0.05;
}
if (timeout&&strtofloat(#s(girushot))<50) {
setstring girushot,#v(strtofloat(#s(girushot))+1);
sleep 1;
timeout=0.05;
}
if (weaponfired&&playerdir=0&&strtofloat(#s(levelup)) >0&&timeout) {
shootnuke;
shootfireblast;
timeout=0.05;
}
if (weaponfired&&playerdir=3&&strtofloat(#s(levelup)) >0&&timeout) {
shootnuke right;
shootfireblast right;
timeout=0.05;
}
if (weaponfired&&playerdir=2&&strtofloat(#s(levelup)) >0&&timeout) {
shootnuke down;
shootfireblast down;
timeout=0.05;
}
if (weaponfired&&playerdir=1&&strtofloat(#s(levelup)) >0&&timeout) {
shootnuke left;
shootfireblast left;
timeout=0.05;
}
timeout=0.05;
__________________
~Jeice Lighthawk~
"And you will shed tears of scarlet..."

~Edited by me. ^_^
Reply With Quote
  #2  
Old 12-23-2001, 01:10 PM
Faheria_GP2 Faheria_GP2 is offline
Banned
Faheria_GP2's Avatar
Join Date: Oct 2001
Posts: 1,177
Faheria_GP2 is on a distinguished road
please wrap it in [.code] tags so we can actually read it :o
Reply With Quote
  #3  
Old 12-23-2001, 01:11 PM
Faheria_GP2 Faheria_GP2 is offline
Banned
Faheria_GP2's Avatar
Join Date: Oct 2001
Posts: 1,177
Faheria_GP2 is on a distinguished road
it gets stuck in this loop
while (isweapon) {
timeout=0.05;
}

this loop is a major scripting nono, it has no "break" command, and no "sleep" command
Reply With Quote
  #4  
Old 12-24-2001, 01:26 AM
mikepg mikepg is offline
Registered User
Join Date: Nov 2001
Location: VA, USA
Posts: 501
mikepg is on a distinguished road
Send a message via AIM to mikepg Send a message via Yahoo to mikepg
hmm

okay, obviously, youre really new to scripting, but atleast your trying

Okay, i have some tips for you!

Instead of doing
if (weaponfired&&timeout&&playerdir=0) {
blah}
ect, you should simplify it!

make it so there is only 1 timeout and weaponfired clause, in other words, make a nested if statement.
NPC Code:

if (timeout) {
if (other clause here) {
}
if (weaponfired) {
}
}


and for the weaponfired section, instead of having all the if playerdirs, use shootfireball playerdir;
that means it shoots the fireball the direction that the player is facing, because 0=up 1=left 2=down 3=right in graal.

And one thing that probably makes your script not run, in the playerdir=up section, you didnt specify a direction for it to shoot the fireball and nuke.

As for the while (isweapon) loop, that is insane.
just put
if (playerenters) {
blah;
timeout = .1;
toweapons MegaCheating Weapon;
}
if (timeout) {
blah;
blah blah;
blah blah blah;
if (isweapon) {timeout = .1;
}
}

that would only loop the timeout if the player has the weapon!
__________________
~War Lord Mpg2
Bravo Online's Asst. Staff Manager

"Sittin by the tree, sippin eggnog, waitin on christmas gifts"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 03:12 PM.


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