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 02-07-2002, 06:48 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Game Control

I am making a game where there are 2 buttons. when a player grabs one it sets focus on a area and they control one of the 2 NPCs inside there.

My code so far looks like this...

// NPC made by Lord Helmut
if (created) {
x+=.4;
y+=.7;
}
if (playertouchsme&&keydown(6)) {
setstring server.axegameplayer,#a;
setfocus 31,28;
disabledefmovement;
playersprite=19;
say2 Do you want to play?;
timereverywhere;
}

Thats the code so far for the button. For some reason u have to hold A and run at it to get it to work LOL.

// Graal2002 NPC by Stefan Knorr
if (created) {
showcharacter;
setcharprop #3,head0.png;
setcharprop #C0,orange;
setcharprop #C1,white;
setcharprop #C2,blue;
setcharprop #C3,red;
setcharprop #C4,black;
setcharprop #2,noshield.gif;
dir = 3;
}
if(timeout){
tokenize #s(server.axegameplayer);
if(strequals(#a,#t(1))){
if(keydown(3)){
x+=5;
timeout=.05;
}
timeout=.05;
}
}

Thats the character NPC. I want it so it can be controlled by the player touching to button but its not working for some reason
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #2  
Old 02-07-2002, 07:37 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
is setfocus allowed??
no1 ever answered my Q about that.
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #3  
Old 02-07-2002, 07:40 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
yes u can use setfocus on free PWs. Can you tell whats wrong with that code so far?
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #4  
Old 02-07-2002, 07:42 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Re: Game Control

Quote:
Originally posted by lordhelmut
// Graal2002 NPC by Stefan Knorr
look hes lying STEFAN MADE IT!!!
lol sorry, i am joking...lol. (conspiracy i think...)
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #5  
Old 02-07-2002, 07:51 AM
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
lmao, he used the predefined showchar
Reply With Quote
  #6  
Old 02-07-2002, 08:38 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Quote:
Originally posted by Faheria_GP2
lmao, he used the predefined showchar
isnt there some command u can use to set the look of the NPC to that of a player? rather than setting each individual piece to the same?
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #7  
Old 02-07-2002, 08:42 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Does anyone have any idea how to fix this? Also would triggeraction work for detecting if one NPC hits the other?
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #8  
Old 02-07-2002, 08:50 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by lordhelmut
yes u can use setfocus on free PWs. Can you tell whats wrong with that code so far?
You could use setfocus but are you ALLOWED to? At first I thought setfocus was going to be Newworld only then it got added into the exe when 2k2 came out, where did you here that you could use it?
Reply With Quote
  #9  
Old 02-07-2002, 08:58 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
YES U CAN USE IT! LORIEL SAID ITS ALLOWED ON FREE SERVERS AND HES GM AND HE KNOWS AND YES IT IS I TELL YOU SO DONT ASK AGAIN.

LOL, any other questions?
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #10  
Old 02-07-2002, 08:59 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
I deosnt matter now, sadly it was released withought consent from the new world staff, seeinga s how hey were jipped with 2k2 taking thier EXE and all, methinks the fetures will just be plucked away one by one until NW is just another Player World.
__________________

subliminal message: 1+1=3
Reply With Quote
  #11  
Old 02-07-2002, 09:46 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
is this like robot wars or something??
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #12  
Old 02-07-2002, 09:57 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Axe wars

see...
Attached Thumbnails
Click image for larger version

Name:	fighting.png
Views:	194
Size:	24.9 KB
ID:	11669  
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #13  
Old 02-07-2002, 10:05 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
first off, the character npc doesnt have a part that calls the timeout in it, so it wont work at all
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #14  
Old 02-07-2002, 10:32 AM
Lomgren Lomgren is offline
Senior Member, Anti-Spam
Join Date: Mar 2001
Location: Missouri
Posts: 196
Lomgren will become famous soon enough
Exclamation

Hmm... why does that look familiar?
*remembers*
Oh yeah!
Attached Thumbnails
Click image for larger version

Name:	tyhm.png
Views:	186
Size:	16.5 KB
ID:	11673  
__________________
Lomgren - devoted to classic, even though I may be gone for months on end
Reply With Quote
  #15  
Old 02-07-2002, 10:43 AM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
well just woundering is there a point to tokenizing the string.. why not just put the string in the if statment..

and ya the time out..
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #16  
Old 02-07-2002, 12:06 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Quote:
Originally posted by lordhelmut


isnt there some command u can use to set the look of the NPC to that of a player? rather than setting each individual piece to the same?
NPC Code:

NPC Code:

if (playerenters||created) {
for (i=0;i<5;i++) {
setcharprop #Ci,#Ci;
}
}




not sure about the syntax though but it would work
something like that ...
Reply With Quote
  #17  
Old 02-07-2002, 08:14 PM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
you might have to do this

NPC Code:

if (playerenters||created) {
for (i=0;i<5;i++) {
setcharprop C#v(i),C#v(i); }
}



i think that would work
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #18  
Old 02-07-2002, 10:27 PM
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
I think graal handles Real input literally. so you are trying to set the player prop of

#C#v(i) instead of #C0-4 =\
__________________

subliminal message: 1+1=3
Reply With Quote
  #19  
Old 02-07-2002, 10:39 PM
Kadar Kadar is offline
Registered User
Join Date: Jan 2002
Posts: 636
Kadar is on a distinguished road
bah i was gonna make something like this for whatever im working on..
ohwhell
__________________
Reply With Quote
  #20  
Old 02-08-2002, 01:03 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Quote:
Originally posted by Kaimetsu
People, please learn about compilative processes. Variable names don't matter - they just provide a way for us humans to tell the computer what we want. They don't exist when the script is running so you can't tell it to select different vars based on runtime-encoded names.
it makes sence, but it is hard for people to understand, they think that after they type in the code it stays in that form and it gets directly read, but actually like with html it is "compiled" by graal, as html gets "compiled" by netscape or IE or whatever u use. So it is not in the form you see it as. What you name something doesn't matter and the name of #C0 doesn't either. So what i think he is saying if i am correct is that #C#v(i) will not work because if gets read as a message code so instead of being read as #C0 if i == 0 it reads directly as #C#v(i).
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #21  
Old 02-08-2002, 03:55 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Quote:
Originally posted by TDK_RC6
first off, the character npc doesnt have a part that calls the timeout in it, so it wont work at all
the button has a timereverywhere

and I didnt know about Tyhms game. Thats cool though cuz now I do know its possible =D
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #22  
Old 02-08-2002, 04:29 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
Quote:
Originally posted by lordhelmut


the button has a timereverywhere

and I didnt know about Tyhms game. Thats cool though cuz now I do know its possible =D

timereverywhere doesnt call timeouts in other npcs, well atleast i dont think so
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #23  
Old 02-08-2002, 04:48 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Quote:
Originally posted by TDK_RC6


timereverywhere doesnt call timeouts in other npcs, well atleast i dont think so
It should, it does a timeout for the whole level
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #24  
Old 02-08-2002, 08:27 AM
Lomgren Lomgren is offline
Senior Member, Anti-Spam
Join Date: Mar 2001
Location: Missouri
Posts: 196
Lomgren will become famous soon enough
Post

I'm not sure, but I think timeout is local, the only thing I know about timeouts on this level is what is in the npcprogrammng.rtf
Quote:
5.4. timeouts/ sleep command

To do animations or movements, you can use the 'timeout' variable.
If you set the timeout to 1sec, then after one second a 'timeout' event occurs and the npcs action script will be called with the flag 'timout' set. To show how it works, here a little example:

if (playerenters) timeout = 1;
if (timeout) {
x += 0.5;
timeout = 1;
}

If an npc has that script, then every second it moves 0.5 fields to the right:
1. When the player enters the level, the script will be called with the 'playerenters' flag set
2. So the timeout will be set to 1 (1 second)
3. The game counts the timeout down to 0
4. After 1 second the script will be called again, this time with the 'timeout' flag set
5. So the x variable will be increased and the timeout will be set again to 1
6. continue with step 3.
If you don't set the timeout again, then the timeout event will not occur again.

You can do the same stuff with the ‘sleep’ command:

if (playerenters) {
while (1==1) {
sleep 1;
x += 0.5;
}
}

When doing ‘sleep’, then the script execution will be paused for 1 second. So in this example the npc will forever do a while loop, in this loop the npc ‘sleeps’ 1 second, then moves to the right, then sleeps 1 second, then moves to the right and so on. Internernally the ‘sleep’ command only uses the ‘timeout’ variable: it sets the timeout variable, then when the ‘timeout’ event occurs the script execution will be started one line behind the ‘sleep’ command. If you change the timeout variable while doing ‘sleep’ (e.g. when another event occurs), then the next timeout event will start with the first script line, so be patient with changing ‘timeout’ while another animation loop may be running.

5.5. timeouts in online mode

In the online mode normally only the player who entered the level first (of all players in the current room) is getting timeout events. With ‘timereverywhere’ you can enable timeout events for all players: it enables the current player to get timeout events, so you should do it while processing the ‘playerenters’ event.
But if you want to do animations or movements you should only change the npc properties on one machine, otherwise you produce too much network traffic and strange npc movements. So check if ‘isleader’ is true. That flag is only true when the player is the one who entered the level first and would always get timeout events.
__________________
Lomgren - devoted to classic, even though I may be gone for months on end
Reply With Quote
  #25  
Old 02-08-2002, 09:53 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Umm that basically says what I said. It does a timeout for everwhere online in that level...
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #26  
Old 02-08-2002, 10:31 AM
dragoonvenganc dragoonvenganc is offline
Registered User
Join Date: Jul 2001
Location: USA
Posts: 331
dragoonvenganc is on a distinguished road
Send a message via ICQ to dragoonvenganc Send a message via AIM to dragoonvenganc
lol..
timereverywhere just makes it so that every player gets the timeout instead of just the leader getting the time out..
__________________
Dragoon Vengance
Owner of Pangea Relics of Time
P2P Rp server
For info or job
Email: [email protected]
aim: dragoonvengnc
Reply With Quote
  #27  
Old 02-08-2002, 10:49 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Quote:
Originally posted by dragoonvenganc
lol..
timereverywhere just makes it so that every player gets the timeout instead of just the leader getting the time out..
oh so its for all players but not all NPCs?
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #28  
Old 02-08-2002, 11:06 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
that would be correct

timereverywhere for all people in level, not all npcs
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #29  
Old 02-08-2002, 11:34 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
so then how may I ask would controlling a NPC be possible from a certain area? Loriel did it on Londeroth
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
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 11:04 PM.


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