Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Race selection script
Author Message
maos32
Apprentice
*

Posts: 15
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0



Post: #1
Race selection script
Hello
Im looking for a race selection script
Is it possible to insert a permanent tag for spécific race ?

Like tag.elf so only elf can enter in spécific door

Thanks for your answer
09-15-2013 06:37 PM
Find all posts by this user Like Post Quote this message in a reply
dagger4k
Journeyman
*

Posts: 194
Likes Given: 1
Likes Received: 12 in 12 posts
Joined: Mar 2012
Reputation: 0



Post: #2
RE: Race selection script
yes, At the start, depending on how you set the races (stone, gump selection etc) just make it set a tag to .tag.elf

for a button selection
Code:
onbutton = 2
src.tag.race.elf= 1
return 1

Obviously you will want to add something in there to make it so someone can't be 2 races. A way around this could be to use the 1 tag to deal with the race system
tag.race = 1 // 1 being elf, 2 being human, 3 being vampire etc

Code:
onbutton = 2
src.tag.race= 1 // elf
return 1

then for the door you can try something around the line of
Code:
[itemdef i_elf_door]
id=06e9
Name= Elf door

on=@dclick
if (<src.tag.race>==1) // elf
return 0
else
src.sysmessage = You are not the right class to use this door! blah blah
return 1

You might also want to add something to the player event such as
Code:
[event e_player]
on=@click
IF     (0<tag.race>== 01)
        message= [Elf]
                message=<name>
Elseif
       (0<tag.race>== 02)
                message= [Human]
                message=<name>
Elseif
       (0<tag.race>== 03)
                message= [vampire]
                message=<name>
Else
         message=[Race not selected]
         message=<name>
Return 1
This might work, but mess around with it. I haven't actually scripted in ages and didn't test this atall Tongue
you might even want to make the door teleport the player to the door so other people can't actually pass through it.
(This post was last modified: 09-15-2013 07:58 PM by dagger4k.)
09-15-2013 07:52 PM
Find all posts by this user Like Post Quote this message in a reply
maos32
Apprentice
*

Posts: 15
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0



Post: #3
RE: Race selection script
Heyo , i need just 2 things :
How to add Elf next to the player name?
What is the right command to pass trough the door? no coordinate , just trow the player in the door to let him enter

[ITEMDEF i_race_elf_moongate]
DEFNAME=i_race_elf_moongate
NAME=Portail Elf
ID=i_moongate_blue
TYPE=t_normal

ON=@STEP
SOUND=snd_spell_gate_travel
SRC.GO 1336 1997 5 0 // the player will not be able to comback ( do you have a gump for yes / no) ?
src.SET COLOR=008fd // grey boddy color
src.set title=Elf (Is it possible to add Elf next to the name?)
src.sysmessage: You become "xxx"
src.tag.race.elf= 1 // the permanent tag
return 1

CATEGORY=GM ITEMS
SUBSECTION=race gate
DESCRIPTION=Elf Race Gate

[itemdef i_race_elf_door]
id=06e9
Name= Elf door

on=@dclick
if (<src.tag.race>==1) // elf
src.go <door position> // to pass across (need the right command)
return 0
else
src.sysmessage = You are not the right class to use this door! blah blah
return 1

CATEGORY=GM ITEMS
SUBSECTION=race door
DESCRIPTION=Elf Race door

Thanks mate
09-15-2013 09:24 PM
Find all posts by this user Like Post Quote this message in a reply
Shidhun
Journeyman
*

Posts: 59
Likes Given: 5
Likes Received: 3 in 3 posts
Joined: Jul 2012
Reputation: 1



Post: #4
RE: Race selection script
On my Server, we define Races/Classes by using Tags :

Tag.Plot1=0100 <-- this could be the Human Race
Tag.Plot1=0200 <-- this could be the Elven Race
...

Tag.Plot2=0100 <-- this could be a warrior class
Tag.Plot2=0200 <-- this could be a mages class
...

and so on.

Now how do we give the correct Tags to the players? Plain and simply by using "moongates" which attach them @step

Example :

Code:
[TYPEDEF t_human_plot]
ON=@STEP
    IF (<SRC.ISGM>)||(<ARGN1>)
        RETURN 1
    ENDIF
    IF !(<SRC.TAG0.PLOT1>)
        IF (<SRC.FLAGS>&02)
            SRC.SYSMESSAGE Ghosts can't choose a race!
        ELSE
            SRC.SYSMESSAGE You are now a human
            SRC.TAG.PLOT1=0100
            // SRC.EVENTS=e_human <-- only if needed, on our shard we apply bonus-damage defined by the race (for example humans could make a damage-bonus on sword-weapons, elves on fencing-weapons etc
            SRC.TITLE=Human
            SRC.f_get_start_items //this function just deletes every item the character has, and gives him race-specific items
            SRC.GO=<MOREP>
            SRC.SOUND=snd_SPELL_BLESS
        ENDIF
    ELSE
        SRC.SYSMESSAGE You allready belong to another race
    ENDIF
    RETURN 0

Within other scripts you could check for the plot simply by using a type of this function :

Code:
[FUNCTION ishuman]
IF (<TAG0.PLOT1>&0100)
    RETURN 1
ELSE
    RETURN 0
ENDIF

For Race-Checking you could then just use :

Code:
if <src.ishuman>
src.sysmessage you are a human yeahh!
else
src.sysmessage you are no human
endif
09-15-2013 10:15 PM
Find all posts by this user Like Post Quote this message in a reply
maos32
Apprentice
*

Posts: 15
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0



Post: #5
RE: Race selection script
Thanks Shidhun for the tips but your answer dont solve my problem

How to add Elf next to the player name? in my script (can't remember)
What is the right command to pass trough the door? no coordinate , just trow the player in the door to let him enter

Thanks
09-15-2013 10:56 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #6
RE: Race selection script
[EVENTS e_elfs]//give this event to every elf or just add the trigger to their generic event.
ON=@AfterClick
local.clickmsgtext=<local.clickmsgtext> [Elf]

And for the Door, as you wrote... src.go '<door position>', you just have to change it to src.go <p>
09-15-2013 11:17 PM
Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #7
RE: Race selection script
well, it depends on what client u are using, if its a 4.x. or above and u have AoS on in ur ini, you will need to use and empty cliloc (or u could use title like the guy above me was trying to use, i would recommend an empty cliloc over title tho) in the player event to display, becus u cant single click players when u use AoS or above.

and as for the plot tags, seems kinda the long way around ur elbow, why not just tag then like so:

tag.race=Elven

this way it would be easy to set and display everywhere

Code:
[ITEMDEF i_race_elf_moongate]
DEFNAME=i_race_elf_moongate
NAME=Portail Elf
ID=i_moongate_blue
TYPE=t_normal

on=@step
if (strmatch (<src.tag0.race>,  Elven))
src.sysmessage @,,1 You are already an Elf!
return 1
else
src.tag.race Elven
events += e_race
return 0
endif

[events e_race]
on=@clienttooltip
src.addcliloc 1042971, Race: <src.tag0.elven> // this shows 'Race: Elven' in the tooltip when u hover if using A0s or above

on=@click
say @,,1 <name> [<tag0.race>] this wil display 'Elven' next to their name when single clicked for Below AoS
return 1

[itemdef i_race_elf_door]
id=06e9
Name= Elf door

on=@dclick
if (strmatch (<src.tag0.race>, Elven) // elf
src.go <p> // to pass across (need the right command)
else  
src.sysmessage = You are not the right class to use this door! blah blah
endif
return 1 // stop the door from opening at all, so no one else can enter

noticed u used 'return 0' after u check for race, this will cause the door to open, and then anyone can just walk thru it, i assume you dont want it to open, so i took the return 0 out and placed the return 1 after the IF statement to keep it shut always. as far as their paperdoll, if u want it to say Elven as well, u could use tag.name.suffix (or tag.name.prefix) and use the tag for it, ex.

Code:
on=@step
if (strmatch (<src.tag0.race>,  Elven))
src.sysmessage @,,1 You are already an Elf!
return 1
else
src.tag.race Elven
src.tag.name.suffix <src.tag0.race>
events += e_race
return 0
endif

and its always a good idea to give it an events when scripting race, so u have more control over your player functions, u can either have 1 events that checks the tag with an IF statement, or u can give each race its own events, the later prolly being easiest for a novice.

[Image: matts_siggy.gif]
09-16-2013 08:29 AM
Find all posts by this user Like Post Quote this message in a reply
maos32
Apprentice
*

Posts: 15
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0



Post: #8
RE: Race selection script
Thanks alot that's what im looking for

It's working fine with with somes tweaks
Can you give me a way to prevent accidently choice?
Like a gump or somthing else

on=@step
if strmatch(<src.tag0.race>,Hok'o'Dan))
src.sysmessage @,,1 You all ready blabla!
return 1
else
(<gump> do you realy want to be <race> yes / no)
If yes
src.tag.race Hok'o'Dan
SOUND=snd_spell_gate_travel
SRC.GO 1433 1699 1
SRC.COLOR 008fd
src.sysmessage @,,1 Welcome bla bla
return 0
Else
return 1
endif

Thanks!
09-16-2013 08:10 PM
Find all posts by this user Like Post Quote this message in a reply
Shidhun
Journeyman
*

Posts: 59
Likes Given: 5
Likes Received: 3 in 3 posts
Joined: Jul 2012
Reputation: 1



Post: #9
RE: Race selection script
A simple version would be this "racegate"
You need to change the following things on the gate, to adjust it properly :

Name --> The Name of the Race
Color --> Body-Color of the race
Morep --> The Coordinates to which the player should go

Of course this is not a complex script. You could add a Gump-Menu for GMs, to easily change the Racegate and so on. This is a very (!) simple version.

Code:
[itemdef i_racegate]
ID=i_moongate_red //or what ever you want
name=Race-Selector
type=t_script
weight=1000.0

on=@create
    attr=attr_move_never
    
on=@click
    if !<src.isgm>
        message Race-Gate for <name>
    else
        message Race : <name>
        message Color : <color>
        message MoreP : <morep>
    endif
    return 1
    
on=@step
if (<morex> == 0)&&(<morey> == 0)
    src.sysmessage @026 Please page for a gamemaster, the Racegate is broken
    return 1
endif
if strmatch(<src.tag0.race>,<name>))
    src.sysmessage @,,1 You allready belong to this race.
else
    sdialog d_select_race
endif

[DIALOG d_select_race]
50,71
//nodispose
//´noclose
page 0
resizepic 0 0 3000 320 285
dhtmlgump 20 50 280 40 0 0 <def.center><def.BFONT>color="#444444"><def.big>Do you really want to belong to the race of <name>?<def.BFONTE><def.centere>
radio 20 110 2510 2511 0 1
radio 20 150 2510 2511 1 2
dhtmlgump 40 110 250 40 0 0 <def.BFONT>color="#440000"><def.big>Yes i want to belong to this race<def.BFONTE>
dhtmlgump 40 150 250 40 0 0 <def.BFONT>color="#440000"><def.big>Oh no, i just slipped and fell on this tile<def.BFONTE>
button 130 223 2117 2118 1 0 100
dhtmlgump 150 220 200 30 0 0 <def.BFONT>color="#444444"><def.big>Accept<def.BFONTE>

[DIALOG d_select_race BUTTON]
On=0
return 1

on=100
    if <argchk[1]>
        src.tag.race <name>
        SOUND=snd_spell_gate_travel
        SRC.GO <morep>
        SRC.COLOR <color>
    else
        src.sysmessageua 030,0,0,enu You choose, not to be a member of this race
        src.go <put the general starting coordinates here, the player MUST NOT stay on the tile, else the dialog will fire again with the simple @step-trigger you are using>
    endif
    return 1
09-16-2013 09:59 PM
Find all posts by this user Like Post Quote this message in a reply
maos32
Apprentice
*

Posts: 15
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0



Post: #10
RE: Race selection script
Thank alot it's verry what im looking for !
09-17-2013 07:35 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)