Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-27-2005, 06:46 AM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
Angry punching and projectiles

Im runnin GS2 on my server and everybody has this weapon, its just that the projectile part isnt working...
NPC Code:

//#CLIENTSIDE
function onCreated(){
setTimer(.05);
}
function onTimeout(){
if (player.ani == "sword") {
setani("punch", " ");
triggerAction(player.x+1.5+vecx(playerdir)*2,playe r.y+2+vecy(playerdir)*2, "punch", "player.account", "player.guild");
}
setTimer(.05);
}

function onActionProjectile(){
if (params[0] == "punch"){
player.chat == "You have been punched by "@params[1]@" ";
setstring("client.lasthitby"," "@params[1]@" ");
setani("hurt", " ");
}
}




PS: The player.chat part is only to check to see if the script works...
Reply With Quote
  #2  
Old 11-27-2005, 11:28 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
I think you're a bit confused about how some things work.

First off, you don't need to use an onTimeout like that. Try using replaceAni("sword", "punch") in say onCreated of that weapon.

Second,

HTML Code:
triggerAction(player.x+1.5+vecx(playerdir)*2,player.y+2+vecy(playerdir)*2, "punch", "player.account", "player.guild");
Isn't going to work like you think -- having quotes around player.account and player.guild will send those as the strings, not the values of them. And if you are hoping to trigger onActionProjectile with a punch event it isn't going to work.
Reply With Quote
  #3  
Old 11-27-2005, 03:14 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
I guess it would need to be onActionPunch. Better would be to trigger the serverside part of the weapon (triggerserver("weapon",weaponname,"punch")) and check for players near, to make the hitpoint system more secure.
Reply With Quote
  #4  
Old 11-27-2005, 06:23 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
im making a custom hp system, replace ani will just replace the sword with something else and it will use graals heart system
Reply With Quote
  #5  
Old 11-27-2005, 07:14 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
but anyways its fixed now...thank you
Reply With Quote
Reply


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 01:39 AM.


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