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 11-01-2011, 10:13 PM
Equinox Equinox is offline
Registered User
Equinox's Avatar
Join Date: Jan 2011
Posts: 13
Equinox is on a distinguished road
Red face Quick Question

Would this script work online?

NPC Code:

function onActionLeftMouse() {
putnpc beer.png,beer.txt,mouse.x,mouse.y;
}

beer.txt:

function onPlayerTouchsme {
player.hearts += 3;
destroy;
}
else
sleep (10);
destroy;


Reply With Quote
  #2  
Old 11-01-2011, 10:17 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
No.
__________________
Quote:
Reply With Quote
  #3  
Old 11-02-2011, 12:07 AM
PerfectDark PerfectDark is offline
Banned
Join Date: Aug 2011
Posts: 57
PerfectDark is on a distinguished road
Quote:
Originally Posted by fowlplay4 View Post
No.
Agreed it wouldn't work.. maybe make a class or something

>.> @ who ever sent rep in this thread (-PFA)

Last edited by PerfectDark; 11-02-2011 at 12:27 AM..
Reply With Quote
  #4  
Old 11-02-2011, 12:36 AM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
Quote:
Originally Posted by PerfectDark View Post
Agreed it wouldn't work.. maybe make a class or something
A class NPC wouldn't fix the errors in the script.
__________________

Intelligence without ambition is like a bird without wings.

Reply With Quote
  #5  
Old 11-02-2011, 01:01 AM
PerfectDark PerfectDark is offline
Banned
Join Date: Aug 2011
Posts: 57
PerfectDark is on a distinguished road
i didnt mean that way...
Reply With Quote
  #6  
Old 11-02-2011, 01:16 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Here's why it won't work (don't want you to get confused by the inexperienced others):

1. putnpc isn't used anymore, and you'll have to create a class called beer instead. Use putnpc2 like this instead:

PHP Code:
function onCreated() {
  
temp.npc putnpc2(x,y,"");
  
temp.npc.join("class_name");

2. onActionLeftMouse only applies when you click an NPC. You have to use client-side events in a weapon script and send that data to the server-side then create the npc. Search the forums for triggerserver examples.

PHP Code:
//#CLIENTSIDE

function GraalControl.onMouseDown() {
  
player.chat format("Clicked! X: %s Y: %s"mousexmousey);

3. If you want the 'beer' to be destroyed 10 seconds after it's created you'll have to use the onCreated event and a timeout.

PHP Code:
function onCreated() {
  
setTimer(10); // Schedules a Timeout in 10 seconds from now.
}

function 
onTimeout() {
  
// Timeout occured
  
destroy();

__________________
Quote:
Reply With Quote
  #7  
Old 11-02-2011, 02:13 AM
Draenin Draenin is offline
Magnificent Bastard
Draenin's Avatar
Join Date: Dec 2004
Location: Bermuda Triangle
Posts: 6,790
Draenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud of
Send a message via AIM to Draenin Send a message via MSN to Draenin Send a message via Yahoo to Draenin
If you want to know whether a script will work online or not, check into getting access on the testbed server so you can work on your stuff online.
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 05:17 PM.


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