Jump to content

need help with a script


garycornett39

Recommended Posts

I made a ship master that transports you to a Island and I want someone to greet you there as soon as you arrive by walking up to you but I get a error in the game when you teleport there

Heres my script

 

 

 

short state

float timer

 

if ( menumode == 1)

return

endif

 

if ( GetDisabled == 1 )

return

endif

 

 

if ( OnActivate -- 1 )

return

endif

 

if ( state == -1 )

if ( GetDistance, Player < 150 )

set timer to + GetSecondsPassed

if ( timer > 1 )

set timer to 0

endif

endif

endif

 

if ( state == 0 )

 

DisablePlayerControls

AITravel 153197.000, 291563.500, 64.260

set state to 10

 

elseif ( state == 10 )

 

if ( GetDistance, Player < 108 )

set state to 20

AiWander 0 0 0 90 0 0 0 0 0 0 0 0

endif

 

elseif ( State == 20 )

 

EnablePlayerControls

AITravel 154333.625, 291569.156, 65.106

 

endif

 

 

can someone please help me out?

Link to comment
Share on other sites

Give the NPc you want to greet the player a greeting in the dialogue editor

 

Then add a few lines to your script

 

First of all another variable so you don't get the greeting over and over again, eg

 

short doonce

 

add a condition somewhere like

 

if ( doonce == 1 )

return

endif

 

 

Then, in the bit of the script where you have the NPC walk up to the player, add something like

 

if ( GetDistancePlayer < whatever distance you want the grreting to occur at )

 

NPC_ID -> Forcegreeting

set doonce to 1

 

endif

 

 

The NPC should then start talking to the player at the distance you specified.

 

This should work...but my scripting is still very basic, so no guarantess that it will work.

Link to comment
Share on other sites

I get "script error:EXPESSION" after it runs though the script so far then it says "Right Eval" the my script looks like this now

 

begin script

 

short state

float timer

short doOnce

 

if ( menumode == 1 )

return

endif

 

if ( GetDisabled == 1 )

return

endif

 

if ( OnActivate == 1 )

return

endif

 

if ( state == -1 )

if ( GetDistance, Player <300 )

Set timer to + GetSecondsPassed

if ( timer > 3 )

set timer to 0

endif

endif

endif

 

if ( state == 0 )

DisablePlayerContols

AiTravel ", ", "

set state to 10

 

elseif ( state == 10 )

 

if ( GetDistance, Player <250 )

set state to 20

AiWander 0 0 0 90 0 0 0 0 0 0 0 0

endif

 

if ( state == 20 )

if ( DoOnce == 0 )

if ( GreetOnce == 0 )

if ( GetDistance, Player <=10 )

NPC-> ForceGreeting

set greetonce to 1

set doonce to -1

set state to 30

endif

endif

endif

endif

 

if ( state == 30 )

EnablePlayerControls

AiTrval ", ", "

endif

endif

 

End script

Link to comment
Share on other sites

remodled my script a little. theres no errors but the force greeting still dont work, I tried to look it up in scripting for dummies but it didnt help much heres my new script

 

Begin script

 

short state

float timer

short doOnce

 

if ( menumode == 1 )

return

endif

 

if ( GetDisabled == 1 )

return

endif

 

if ( OnActivate == 1 )

return

endif

 

if ( doOnce == 1 )

return

endif

 

if ( state == -1 )

if ( GetDistance, Player <300 )

set timer to + GetSecondsPassed

if ( timer > 3 )

set timer to 0

endif

endif

endif

 

if ( state == 0 )

 

DisablePlayerControls

AiTravel ", ", "

set state to 10

 

if ( state == 10 )

if ( doOnce == 0 )

if ( GetDistance, Player <= 100 )

ForceGreeting

set doOnce 1

set state 20

endif

endif

endif

 

if ( state == 20 )

 

EnablePlayerControls

AiTravel ", ", "

endif

endif

 

End script

 

If anyone can help I would appriciate it

Link to comment
Share on other sites

Sorry - tried to reply earlier but the forums broke again.... <_<

 

Is the script attached to the NPC which gives you the forcegreeting? Else you have to specify who is to give the forcegreeting - or attach a simple forcegreeting script to the NPC

 

Does the NPC have a greeting in the dialogue editor? I'd recommend putting the greeting into Greetings 5 where the quest related greetings seem to be, and making the greeting ID specific.

 

Also, the distance you've specified for the forcegreeting is very small - I'd set it much larger. At distance 100 the NPC is almost stepping on the player's toes...Try setting the distance at 300 and see what happens.

 

Good luck

Link to comment
Share on other sites

thanks for the advice, I found out the distance wasnt as far as I wanted after 10 or so trys and I have the script attacted to the npc with the greeting and the greeting in greeting 1. I have everything working, only problem i have is after the force greeting I cant talk to that NPC again, and if I kill them I cant check there body ether.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...