change actor to another actor

thank you for reading my question in first place.

i want to creat the follow effect.

I have crt 2 actors already, say warrior and mage with different behaviors.
I want to touch a button and it chang in game from worrior to mage(with their uniqe behaviors).

is there anyhow i can do it?

Thanks for reading and thanks for answering in advnaced.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Hello @‌iceheero

    Welcome to GSC and the Forums. :smile:

    That's straightforward enough: make a boolean attribute, let's call it Switch.

    Now in front of any Rules for the warrior actor, add

    When Switch is false

    This way, any other buttons pressed with movement rules, etc, will effect this actor only.

    Similarly, in front of any rules you have already for your mage actor, add

    When Switch is true

    in front of all existing rules for it.

    Now in your button to change control, put:

    Rule: When touch is pressed
    Rule (nested in the above rule) : When Switch is false
    Change Attribute Switch to true
    Change Image Mage
    Otherwise
    Change Attribute Switch to false
    Change Image Warrior
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • iceheeroiceheero Member Posts: 3

    Thanks for your feedback

    I have been trying to work it out for the pass 1 hr and tried the following method and it works but O am kind of stuck now.

    What i have done is

    creat an interger attribute (switch) in game 1, 2, 3, 4 as job 1, 2, 3, 4

    crt 4 button job1, job2, job3, job4, when press each button (Switch change to regard number)

    So here is what i have done so far.

    starting actor set as job1

    when I press job2 button job 1 actor destory and spawn job2 actor. it works only indivdule or say only once.

    I tried to press job 1, 3, 4 after 1st change and it doesnt make any changes.

    again appreciate for your help

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Hi, right, I think I get what you're after...

    So make your 4 actors to be spawned in the Inspector, each with a different colour, etc, I guess.

    In the rules of the first one, put:

    Rule: When Attribute Job ≠ 1
    Destroy
    

    and in the 2nd:

    Rule: When Attribute Job ≠ 2
    Destroy
    

    etc. for 3 and 4

    In your button 1, you should have something like:

    Rule: When Touch is pressed
    Change Attribute Job to 1
    Spawn Actor Actor 1 pos 100x 300 y -- example coordinates
    

    In your button 2:

    Rule: When Touch is pressed
    Change Attribute Job to 2
    Spawn Actor Actor 1 pos 200x 300 y -- example coordinates
    

    etc. for the other two buttons.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • iceheeroiceheero Member Posts: 3

    some thing like it but a bit different. anyway thanks for your help it helps me to get what i want.

    thanks ^^

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @iceheero said:
    some thing like it but a bit different. anyway thanks for your help it helps me to get what i want.

    thanks ^^

    The "bit different" is probably the bit that makes sure it works for you this time! :smile:

    Glad it helped.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • iceheeroiceheero Member Posts: 3

    yes i crt 4 jobs with unique job number in each jobs.
    So anytime I press job1 it checks the character's job number.
    if switch number = job2 number
    destory
    spawn job2 actor

    so on for job 2 , 3 .

    and so on for button 2,3,4

    and looks like it works at mean time.

    anyway thanks for your help and it helps

Sign In or Register to comment.