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 09-02-2002, 11:42 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
It saves but will not send...

For some inane reason, I can't get triggeraction to work for a particular NPC. For testing purposes, it saved the data I wanted to send out, but it does not send...either that or the Control-NPC doesn't want to recieve the triggeraction

NPC Code:
        triggeraction 0,0,servercheck,#s(client.expinc),#s(client.lastat  tacker);



That should send it to the Control-NPC which has:

NPC Code:
if (actionservercheck) {
this.exp = #p(0);
setstring lastattacker,#p(1);
with (getplayer(#s(lastattacker)) {
setstring client.player_exp,#v(strtofloat(#s(client.player_e xp))+#p(0));
setplayerprop #c,I now have #s(client.player_exp) EXP!;
}
}


But I keep checking the extras I have it set and it doesn't set them when I check the Control-NPC...this.exp does not show up as well as lastattacker.

I've been messing with it for the past hour at least...enjoying hitting my counterpart since I need to vent anyway
__________________
Reply With Quote
  #2  
Old 09-03-2002, 12:11 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
try triggering to a weapon
triggeraction 0,0,serverside,-actions,#s(client.expinc),#s(client.lastattacker);
then just make the weapon -actions and put the actionserverside in there
Reply With Quote
  #3  
Old 09-03-2002, 12:16 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Python523
try triggering to a weapon
triggeraction 0,0,serverside,-actions,#s(client.expinc),#s(client.lastattacker);
then just make the weapon -actions and put the actionserverside in there
I already have one weapon triggering another when you attack a player...

Hop on AIM?
__________________
Reply With Quote
  #4  
Old 09-03-2002, 12:26 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Re: It saves but will not send...

Quote:
Originally posted by G_yoshi
For some inane reason, I can't get triggeraction to work for a particular NPC. For testing purposes, it saved the data I wanted to send out, but it does not send...either that or the Control-NPC doesn't want to recieve the triggeraction

NPC Code:
        triggeraction 0,0,servercheck,#s(client.expinc),#s(client.lastat  tacker);



That should send it to the Control-NPC which has:

NPC Code:
if (actionservercheck) {
this.exp = #p(0);
setstring lastattacker,#p(1);
with (getplayer(#s(lastattacker)) {
setstring client.player_exp,#v(strtofloat(#s(client.player_e xp))+#p(0));
setplayerprop #c,I now have #s(client.player_exp) EXP!;
}
}


But I keep checking the extras I have it set and it doesn't set them when I check the Control-NPC...this.exp does not show up as well as lastattacker.

I've been messing with it for the past hour at least...enjoying hitting my counterpart since I need to vent anyway
1) Parameters are sent as strings. (this.exp=#p(0) doesn't work, you are trying to store a string in a variable)
2) lastattacker isnt saved on the control NPC, however with a THIS. prefix...... (this.lastattacker)

These are pretty stupid mistakes I must say =\
__________________

subliminal message: 1+1=3
Reply With Quote
  #5  
Old 09-03-2002, 12:36 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Re: Re: It saves but will not send...

Quote:
Originally posted by Falcor


1) Parameters are sent as strings. (this.exp=#p(0) doesn't work, you are trying to store a string in a variable)
2) lastattacker isnt saved on the control NPC, however with a THIS. prefix...... (this.lastattacker)

These are pretty stupid mistakes I must say =\
Sorry :/ I was trying to save it as a string to the control-NPC since variables are variables, not text

Doesn't matter anyway, still not sending...
__________________
Reply With Quote
  #6  
Old 09-03-2002, 12:41 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
NPC Code:

if (actionservercheck) {
this.exp = #p(0); //should be this.exp = strtofloat(#p(0))
setstring lastattacker,#p(1); //should be this.lastattacker
with (getplayer(#s(this.lastattacker))) {
setstring client.player_exp,#v(strtofloat(#s(client.player_e xp)) +this.exp);
setplayerprop #c,I now have #s(client.player_exp) EXP!;
}
}



does this work at all? I havn't tested it but It should, unless I missed yet another bug.
__________________

subliminal message: 1+1=3
Reply With Quote
  #7  
Old 09-03-2002, 12:56 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Falcor
NPC Code:

if (actionservercheck) {
this.exp = #p(0); //should be this.exp = strtofloat(#p(0))
setstring lastattacker,#p(1); //should be this.lastattacker
with (getplayer(#s(this.lastattacker))) {
setstring client.player_exp,#v(strtofloat(#s(client.player_e xp)) +this.exp);
setplayerprop #c,I now have #s(client.player_exp) EXP!;
}
}



does this work at all? I havn't tested it but It should, unless I missed yet another bug.
WTF?!?!?!?! I changed that pie NPCW you had me create to trigger actionservercheck and everything went through...must be something in -Triggers...not sure what though :/
__________________
Reply With Quote
  #8  
Old 09-03-2002, 03:30 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
I still cannot get it to send triggeraction to the control-NPC :/

NPC Code:
if (actionswordhit && !strtofloat(#p(1))==playerid) {
setarray this.attack,5;
setstring client.lastattacker,#p(2);
setstring client.lastexp,#p(3);
this.attack[0] = int(strtofloat(#p(0))%255);
this.attack[1] = int(strtofloat(#s(client.def))%255);
this.attack[2] = abs(this.attack[0]-this.attack[1]);
this.attack[3] = abs(int(random((this.attack[2]/15),this.attack[2])));
this.attack[4] = int(random(0,2));
if (!this.attack[4]==1) {
showimg 1,@FixedSys@MISS,playerx,playery+2;
showimg 2,@FixedSys@MISS,playerx+.1,playery+2+.1;
changeimgcolors 2,0,0,0,0;
//changeimgcolors 1,1,.34,.34,1;
changeimgvis 1,2;
changeimgvis 2,1;
sleep .25;
hideimg 1;
hideimg 2;
} else {
setani hurt,;
hurt 0;
showimg 1,@FixedSys@#v(this.attack[3]),playerx,playery+2;
showimg 2,@FixedSys@#v(this.attack[3]),playerx+.1,playery+2+.1;
changeimgcolors 2,0,0,0,0;
//changeimgcolors 1,1,.34,.34,1;
changeimgvis 1,2;
changeimgvis 2,1;
setstring client.player_hp,#v(strtofloat(#s(client.player_hp ))-this.attack[3]);
if (strtofloat(#s(client.player_hp))<=0) {
this.expinc = strtofloat(#s(client.player_exp))/8+int(random(4,10));
triggeraction 0,0,servercheck,#v(this.expinc),#s(client.lastatta cker);
setstring client.player_hp,0;
setplayerprop #c,Dead!;
sleep .1;
playerhearts = 0;
}
else {
playerhearts = 3;
}
sleep .25;
hideimg 1;
hideimg 2;
}
}



That is the entire section which basically controls player damage. I'm pretty sure its not as clean as what it could or should be, but complain about something else :/
__________________
Reply With Quote
  #9  
Old 09-03-2002, 03:33 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Kaimetsu
It's also pretty darn insecure. The experience increase is calculated on the client?
I'll worry about that once I get it to send the triggered action.
__________________
Reply With Quote
  #10  
Old 09-03-2002, 03:37 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Kaimetsu
Ack! Argh! Damage is also calculated on the client?!?!
You really have the intent of beating this into the ground :/

*edit*
Apparently, I can't call another triggeraction after just doing one...
__________________

Last edited by G_yoshi; 09-03-2002 at 04:13 AM..
Reply With Quote
  #11  
Old 09-03-2002, 04:48 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Quote:
Originally posted by G_yoshi

You really have the intent of beating this into the ground :/
Important calculations should be handle by the server to make it hack-proof, thats all he's trying to say... Am I to assume you don't see the logic in that?
__________________

subliminal message: 1+1=3
Reply With Quote
  #12  
Old 09-05-2002, 01:52 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Falcor


Important calculations should be handle by the server to make it hack-proof, thats all he's trying to say... Am I to assume you don't see the logic in that?
I see the logic

Sorry, I'm just too focused on getting from point A to point B

Anyway, I do now have the server handling it, but here's the problem I've found...if I do triggeraction to the player with params, it won't let me send those params if I've saved them to strings through another triggeraction to the Control-NPC...I checked. I can, however, send out 2 triggeractions to both player and the Control-NPC; problem there is things collide and cause problems from that point as well.

So I'm kind of stuck now...I was trying to do with (players[<vars>]) {...} inside a for loop to check for a string, but it wouldn't do it.

Any suggestions on how to get this working because it is vital to the RPing environment :/
__________________
Reply With Quote
  #13  
Old 09-06-2002, 04:09 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
x.X I'm not even sure what is going ON anymore! Originally you were trying to save a NON variable to a this.var instead of a string. Then you changed it x.X
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #14  
Old 09-10-2002, 01:53 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by emortylone
x.X I'm not even sure what is going ON anymore! Originally you were trying to save a NON variable to a this.var instead of a string. Then you changed it x.X
---Shifter
Um, when saving stuff on the Control-NPC as far as strings and variables go...you have to use this.<vars/string>. 'setstring this.string' makes it a local string for the Control-NPC that only it can play with or for any other db NPC you have
__________________
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 02:54 PM.


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