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
  #31  
Old 09-28-2011, 07:29 AM
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
I've moved the list of helpful posts to the wiki, added some new links, and categorized them. It'd be nice if new useful posts were added to this list in the future.

If anybody would like to add, please just edit the page. If you don't have wiki access, I'll be happy to make the edits for you (post here or PM me).
__________________
Reply With Quote
  #32  
Old 10-03-2011, 03:45 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
I found this helpfull, also thanks cbk1994 I need to study the wiki some more.
Reply With Quote
  #33  
Old 06-22-2013, 05:18 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
On the clientside, using the setshape2 value of 5 lets you define NPCs with a shape that can be interacted with but doesn't block the player.

PHP Code:
setshape2(4,4,{
  
5,5,5,5,
  
5,5,5,5,
  
5,5,5,5,
  
5,5,5,5,
}); 
Not insanely useful, but I found it useful when you want NPCs to interact with touching/hitting without necessarily blocking the player(like baddies, doors and such).
Reply With Quote
  #34  
Old 06-22-2013, 08:20 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by DustyPorViva View Post
On the clientside, using the setshape2 value of 5 lets you define NPCs with a shape that can be interacted with but doesn't block the player.

PHP Code:
setshape2(4,4,{
  
5,5,5,5,
  
5,5,5,5,
  
5,5,5,5,
  
5,5,5,5,
}); 
Not insanely useful, but I found it useful when you want NPCs to interact with touching/hitting without necessarily blocking the player(like baddies, doors and such).
Is there any documentation, good documentation on setshape2()? I always have troubles using it due to lack of understanding what all the numbers are for.
Reply With Quote
  #35  
Old 06-22-2013, 08:59 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 scriptless View Post
Is there any documentation, good documentation on setshape2()? I always have troubles using it due to lack of understanding what all the numbers are for.
Same numbers as tiletype: http://www.graal.net/index.php/Creat...tions/tiletype
__________________
Reply With Quote
  #36  
Old 06-23-2013, 02:43 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by cbk1994 View Post
Oh, so I think I understand now. You set a height and width in a grid and then assign a value to each. Always wondered about that. Thanks!!
Reply With Quote
  #37  
Old 06-26-2013, 04:46 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Here's a little tip for understanding the options part of move(), showstats(), enablefeatures() etc and how it works:

If these functions are known to you, you might have noticed the build up of the options going like this

1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 ETC ETC

Basically you can create any numbers using the numbers given above

31 = 1 + 2 + 4 + 8 + 16
30 = 2 + 4 + 8 + 16
29 = 1 + 4 + 8 + 16

Following? Now, why are those functions using numbers like that? Why not use normal numbers from 1 to 10 for example? To answer that, let me set an example up:

PHP Code:
/*
  createNPC(x, y, type, options)
  options:
    1 = randomized look?
    2 = roam around
    3 = hunt and hurt players
*/
function onCreated() {
  
createNPC(xy"baddy"2); // randomized look + roam around

  
createNPC(xy"baddy"3); // function as enemy to the player, hunt & kill
}

function 
createNPC(npcxnpcynpctypeoptions) {
  
// how to tell the difference between 1+2 (randomized look + roam around)
  // and 3 (hunt players and hurt them
  
  
temp.npc putnpc2(npcxnpcy"");
  if (
options == 1+2) {
    
// just give up here and start over., ok?
    //the script can't tell the difference between 1+2 and 3


Now, how can it be done instead? Well, yeah, you use the numbers given further up this post and do like this:

PHP Code:
/*
  createNPC(x, y, type, options)
  options:
    1 = randomized look?
    2 = roam around
    4 =  function as enemy to the player
*/
function onCreated() {
  
createNPC(xy"baddy"2); // randomized look + roam around

  
createNPC(xy"baddy"4); // function as enemy to the player, hunt & kill
}

function 
createNPC(npcxnpcynpctypeoptions) {
  
temp.npc putnpc2(npcxnpcy"");
  
temp.npc.join("npc_"npctype); // would join npc_baddy
  
temp.npc.type npctype;

  if (
options&1temp.npc.join("npc_module_randomizedlook");
  if (
options&2temp.npc.join("npc_module_roam");
  if (
options&4temp.npc.join("npc_module_enemyai");

By using the & operator you can simply check if a bit value exists within the specified bit value given.

so instead of doing something like createNPC(x, y, type, true, true, false);, or set up predefined options, use this method instead!
__________________

Last edited by Chompy; 06-26-2013 at 06:05 PM..
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 10:59 PM.


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