SphereCommunity
Teleport - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Teleport (/Thread-Teleport)



Teleport - Alaric - 10-28-2012 12:15 AM

Hi, I began scripting 3 days ago and started with quite hard(for me)script.
It should be a teleport with instant hit.

1.reacts on a command (.teleportation) or reacts on a botton in a spellbook.
2.now some IFs(stamina required and target in sight)
3.the player says something/yells and reduces 20 stam itself.
4.here it checks (if you for example - cast, use skill, the jump wont be finished and sysmessage will say - you interupted jump or whatever.
maybe while cycle get there somehow? and some duration/pause. 2s?
5.and here it should check again if the target is in the sight and jump at it(and @HitTry should be set as TRUE, somehow) and reduce stam by 20.



[ITEMDEF 02254]
defname=asdf //for faster adding, later change
name="Warrior's Book"
weight=0
layer=1

on=@Create
ATTR=attr_newbie
AMOUNT=1
MOREZ=200 //i have no idea why should it be there...I coppied it.

on=@dclick
MOREZ=200 //again, have no idea why
sDIALOG WARBOOK_OPEN

[DIALOG WARBOOK_OPEN]
page 0
gumppic 100 50 02b02
page 1
gumppic 190 125 05302
dtext 188 103 0 War book
dtext 200 195 0 xxxxxxxx
button 320 90 2224 2224 1 2 1
button 320 115 2224 2224 1 0 2
button 320 140 2224 2224 1 0 3
button 320 165 2224 2224 1 0 4
button 320 190 2224 2224 1 0 5
button 320 215 2224 2224 1 0 6
dtext 360 62 0 List
dtext 343 87 0 Teleportation
dtext 343 112 0 2.kouzlo
dtext 343 137 0 3.kouzlo
dtext 343 162 0 4.kouzlo
dtext 343 187 0 5.kouzlo
dtext 343 212 0 6.kouzlo
return


and jump
//-------------------------------------------------------------------------------
[FUNCTION teleportation]
on=@attack //the player attacks
if <src.stam> >= 20 && <src.targ.canseelos>
sound=0512 //or sound=044A
src.emote is about to jump
src.move SRC.TARGP //doesnt work
src.actarg1
src.stam -= 20

elif <src.stam> < 20 //
src.sysmessage Dont have enought stamina for jump

elif //
src.sysmessage Target is not in your sight
return 1
endif

src.sysmessage You arent attacking anybody
return 1
//-------------------------------------------------------------------------------

I'm sorry I want, well, the whole script from you but i rly dont know how to write it and also my English isnt good at all :-/
This script I wrote, is incorrect but these are just my ideas how it shuld work
If somebody could help me, I would be glad.
Alaric


RE: Teleport - Shaklaban - 10-28-2012 04:45 AM

you can't use triggers under functions, it must be under event. also you have some mistakes:
PHP Code:
[events e_teleportation]
on=@attack //@attack trigger, src=attacked character and default= character which is attacking
if (<stam> < 20)
    
sysmessage Dont have enought stamina for jump
elif 
!(<canseelos <src>>) 
    
sysmessage You cant see the target
else
    
sound=0512
    emote is about to jump
    go 
<src.p//go command sends character to specific position, in this case we sending character to position of src
    
stam -= 20     
endif

[function 
teleportation]
if <
isevent.e_teleportation//check is character has the e_teleportation event
    
sysmessage Teleport off
    events 
-e_teleportation  //remove teleportation event from player
else
    
sysmessage Teleport on
    events 
+e_teleportation
endif 



RE: Teleport - Alaric - 10-28-2012 07:14 AM

Thanks for posting, i'll insipe with that and try to rewrite it.

I need in that events "e_teleportation" one main condition.
Like:
IF (character is attacking)
jump(+ those checkings stam, sight, sound, etc.)
ELSE
sysmessage You arent attacking anybody
ENDIF

I meant a player(plevel 1) writes .teleportation and he/she will teleport on another player or NPC after 2s. But it shouldnt be cast because it interupts HitTry.
Actually I cant use trigger I think because I want the condition (if the player attacks or not). And its a state what is happening and if I use on=@attack(or charattack) the procession jump works only in the moment I switch pease to war mode and attack sbd.


RE: Teleport - Alaric - 10-30-2012 07:39 AM

Any ideas how to check if you are attacking sbd?

PHP Code:
[plevel 1]
teleportation

[function teleportation]
IF (
character is attacking)
-
jump-
ELSE
sysmessage You arent attacking anybody
ENDIF 
tried TRIGGER @charattack and then read SRC and I. Is this the right way? If its incorrect, do you know any other one to solve the problem?


RE: Teleport - Extreme - 10-30-2012 08:31 AM

Attack you mean is in war mode?


RE: Teleport - Alaric - 10-30-2012 08:38 AM

(10-30-2012 08:31 AM)Extreme Wrote:  Attack you mean is in war mode?

Yep, in war mod + i have already double clicked npc or player(i'm attacking it)


RE: Teleport - Extreme - 10-30-2012 10:47 AM

Hmmm
try this
PHP Code:
IF (<FLAGS>&STATF_WAR) && (<MEMORYFINDTYPE.memory_iaggressor>)
-
jump
ELSE
bla
ENDIF 



RE: Teleport - Alaric - 10-30-2012 11:53 PM

With "memory_war_targ" it works how i want, thanks.