Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-21-2012, 05:25 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
One npc triggered by another one

I'm making a script and I want to use the command placenpc. I need to to be triggered by the original weapon, but I don't know how to do that because "if (weaponfired)" won't work and "if (hasweapon(weapon))" won't work because that I don't want it to activate instantly. How do I trigger a separate npc with a weapon?
Reply With Quote
  #2  
Old 06-21-2012, 05:32 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
:O I just got an idea. I could make a separate flag. I can use this.bomb and this.explosion to trigger the other weapon.

(Try to guess what weapon this is, there was a hit in those flags )
Reply With Quote
  #3  
Old 06-21-2012, 05:41 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by E_Man View Post
(Try to guess what weapon this is, there was a hit in those flags )
Why are you writing nuclear bomb control software in GS1? I'm going to have to report you to the authorities.
__________________
Reply With Quote
  #4  
Old 06-21-2012, 05:49 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Why are you writing nuclear bomb control software in GS1? I'm going to have to report you to the authorities.
WHAT! NO! Wait, is that a joke. I didn't want to say this because I was going to put it in the new code gallery, but it is remote bombs, link in legend of zelda minish cap. I'm having a few troubles with the script right now, but I should be able to figure it out in a bit.

(Why would you have to report me?)
Reply With Quote
  #5  
Old 06-21-2012, 05:50 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
lol
Quote:
Originally Posted by E_Man View Post
(Why would you have to report me?)
because its dangerous
__________________
MEEP!
Reply With Quote
  #6  
Old 06-21-2012, 05:57 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by callimuc View Post
because its dangerous
It's an ingame weapon, like is nukeshot dangerous?
Reply With Quote
  #7  
Old 06-21-2012, 06:07 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
I'm having a few troubles with the script right now, but I should be able to figure it out in a bit.
Yaaaaa... I need some help with me script , I can't figure out what I'm doing wrong.

Here it is:


Weapon:
PHP Code:
// NPC made by E-Man
if (created) {
  
this.bomb=0;
  
this.explosion=0;
  
setimg remotebomb1.png;
}
if (
playertouchsme) {
  
toweapons Remote Bomb;
  
hide;
}
if (
weaponfired && this.bomb=&& playerdir0) {
  
putnpc remotebomb1.png,remotebomb.txt,playerx+0.5,playery-1;
  
this.bomb=1;
}
if (
weaponfired && this.bomb=&& playerdir1) {
  
putnpc remotebomb1.png,remotebomb.txt,playerx-1.5,playery+1;
  
this.bomb=1;
}
if (
weaponfired && this.bomb=&& playerdir2)  {
  
putnpc remotebomb1.png,remotebomb.txt,playerx+0.5,playery+2.5;
  
this.bomb=1;
}

if (
weaponfired && this.bomb=&& playerdir3) {
  
putnpc remotebomb1.png,remotebomb.txt,playerx+2.5,playery+1;
  
this.bomb=1;
}
if (
weaponfired && this.bomb=1) {
  
setani shoot,remote.png;
   
setimg remotebomb1.png;
 
this.explosion=1;
    }
if (
this.bomb=1) {
  
setimg remoteimage.png;


remotebomb.txt:
PHP Code:
if (this.explosion=1) {
setimg remotebomb2.png;
sleep 0.5;
putexplosion 2,x,y;
this.explosion=0;
hide;

Remotebomb.txt never activates and also I can't get the image in my inventory to turn back into remotebomb1.png
Reply With Quote
  #8  
Old 06-21-2012, 06:15 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
If I remember right, putnpc doesn't work in the editor anymore, and haven't for 6+ years.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #9  
Old 06-21-2012, 06:21 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
If I remember right, putnpc doesn't work in the editor anymore, and haven't for 6+ years.
Awww, I wasted so much time on this. Is there a way to change it so it does work?

(Also, I'm just curious, if it did still work, would this script be successful?)
Reply With Quote
  #10  
Old 06-21-2012, 06:46 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
I'm pretty sure putnpc does still work within the editor, it might just be a case of the text file not being found. It may need to be placed within the same folder as the level, or manually browsed to within the NPC image field for it to be added to filenamecache.txt.
Reply With Quote
  #11  
Old 06-21-2012, 06:57 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
I'm pretty sure putnpc does still work within the editor, it might just be a case of the text file not being found. It may need to be placed within the same folder as the level, or manually browsed to within the NPC image field for it to be added to filenamecache.txt.
It is in the same folder and the script is found, because if it wasn't and I click test, it would say that the file is not found, but it does not say that, it says that everything is correct.
Reply With Quote
  #12  
Old 06-21-2012, 07:02 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
The placed NPC would be a separate object to the original weapon script, so the this. variable would not transfer between them. It should use 'if(created){}' as the condition, and then probably use 'destroy;' rather than 'hide;'.

Also I know this is old gscript but I believe you still need to use '==' rather than a single '='. A single '=' is for assigning values, whereas a double '==' is for comparing different values. In modern gscript using just one would result in the condition being determined as true, even if the 2 compared values were different.
Reply With Quote
  #13  
Old 06-21-2012, 09:14 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
The placed NPC would be a separate object to the original weapon script, so the this. variable would not transfer between them. It should use 'if(created){}' as the condition, and then probably use 'destroy;' rather than 'hide;'.

Also I know this is old gscript but I believe you still need to use '==' rather than a single '='. A single '=' is for assigning values, whereas a double '==' is for comparing different values. In modern gscript using just one would result in the condition being determined as true, even if the 2 compared values were different.
But I am assigning values, it is so that when I use the weapon, it can place the bomb first, then when you use the weapon again, it blows it up, and I can't do "if(created)" because I need it to blow up when I want it to, not on it's own.
Reply With Quote
  #14  
Old 06-21-2012, 09:25 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by E_Man View Post
But I am assigning values, it is so that when I use the weapon, it can place the bomb first, then when you use the weapon again, it blows it up
Your assigning of variables is correct, it is the comparing of variables within the if conditions which is incorrect, using an assignment causes the if conditions to always be true.

It should be for example:

PHP Code:
if(playertouchsme){
  if(
this.value == 2){
    
this.value 3;
  }

Doing something like:

PHP Code:
if(this.value 2){
  
//stuff

is essentially the same as:

PHP Code:
if(true){
 
//stuff

It's probably worth mentioning that the opposite can also be applied for doing 'not equal to', for example:

PHP Code:
if(playertouchsme){
  if(
this.value != 2){
    
this.value 2;
  }

Quote:
Originally Posted by E_Man View Post
and I can't do "if(created)" because I need it to blow up when I want it to, not on it's own.
In that case, you should write and read the 'bomb' variable without using 'this.', so it is a global flag, rather than one tied to the weapon.
Reply With Quote
  #15  
Old 06-21-2012, 09:38 PM
E_Man E_Man is offline
E-Man
E_Man's Avatar
Join Date: Jun 2012
Posts: 81
E_Man will become famous soon enough
Quote:
Originally Posted by ffcmike View Post
Your assigning of variables is correct, it is the comparing of variables within the if conditions which is incorrect, using an assignment causes the if conditions to always be true.

It should be for example:

PHP Code:
if(playertouchsme){
  if(
this.value == 2){
    
this.value 3;
  }

Doing something like:

PHP Code:
if(this.value 2){
  
//stuff

is essentially the same as:

PHP Code:
if(true){
 
//stuff

It's probably worth mentioning that the opposite can also be applied for doing 'not equal to', for example:

PHP Code:
if(playertouchsme){
  if(
this.value != 2){
    
this.value 2;
  }



In that case, you should write and read the 'bomb' variable without using 'this.', so it is a global flag, rather than one tied to the weapon.
I don't get why I need to compare variables, also would client.variable work for global flags? Though it probably is the comparing variables because I can place the bomb but it blows up on it's own.
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 12:48 AM.


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