Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

making a simple tactics plotscript

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Tue Dec 29, 2009 7:52 am    Post subject: making a simple tactics plotscript Reply with quote

help! is this workable?

npc:
(player) robots 1, 2
(enemy) robots 3,4,5
heroes: arrow, battle robots 1, 2
outline:

1. if robot 1's speed = 5, robot1move = 5
2. if space is pressed --> freeze player, robot 1 moves 5 blocks towards arrow's position, set tag "robot 1 moved" = on
3. end of player's turn (still frozen)

-----------

4. if robot 3 speed = 5, robot3move = 5
5. move robot 3, 5 blocks towards arrow position, set tag "robot 3 moved" = on
6. if robot 3 steps on robot 1, remove hero (arrow), add hero (battle robot 1), commence battle, if battle is won proceed to step 8
7. else, proceed to step 8

----------

8. unfreeze player, remove hero (battle robot 1) , add hero (arrow)
9. player presses space bar on a certain position
10. freeze player, if "robot 1 moved" = on, (robot 2 = 7 speed) robot 2 moves 7 blocks towards arrow position
11. set tag "robot 1 moved" = off, set tag "robot 2 moved" = on

----------

12. if "robot 3 moved" = on, robot 4 speed = 5, robot 4 move = 5
13. move robot 4, 5 blocks towards player npc, set tag "robot 4 moved" = on
14. if robot 3 steps on robot 2, remove hero (arrow), add hero (battle robot 2), commence battle

* cycle repeats for all enemies, when the leader is defeated or all enemies are destroyed, the map ends and proceeds to next mission's briefing
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Tue Dec 29, 2009 8:06 am    Post subject: Reply with quote

btw, with this, i have the super robot wars style tactics in mind...
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Jan 01, 2010 8:04 am    Post subject: Reply with quote

So, the player moves around an arrow while all the robots stand still, and every time they press space one of the player's robots and one of the enemy robots move towards the arrow? I don't really see why you'd want to do that. I haven't played super robot wars.

But your description can be translated pretty directly into script. The only tricky point is moving an NPC 5 tiles towards a point. The OHR doesn't have a pathfinding function yet, so you need to write a little script to figure out how to walk them. The easiest thing to do is to just walk them in the direction of the tile, but then they might get stuck in corners. Maybe that's what you want. Here's the script (which I haven't tested):

Code:
# some useful scripts

script, abs, val, begin
  if (val << 0) then (return (-1 * val)) else (return (val))
end

script, sign, val, begin
  if (val << 0) then (exit returning (-1))
  if (val >> 0) then (exit returning (1))
end


script, walk npc to spot, npc, x, y, num tiles, begin
  #numtiles is the maximum number of tiles to walk the npc
  variable (i, diff x, diff y)
  for (i, 1, num tiles) do (
    if (npc X (npc) == x && npc Y (npc) == y) then (exit script)
    diff x := x -- npc X (npc)
    diff y := y -- npc Y (npc)
    if (abs (diff x) >> abs (diff y)) then (
      walk npc to X (npc, npc X (npc) + sign (diff x))
    ) else (
      walk npc to Y (npc, npc Y (npc) + sign (diff y))
    )
    wait for npc (npc)
  )
end


You seem to have a problem here:

Quote:
6. if robot 3 steps on robot 1, remove hero (arrow), add hero (battle robot 1), commence battle, if battle is won proceed to step 8
7. else, proceed to step 8

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Sat Jan 02, 2010 1:01 am    Post subject: Reply with quote

wow il test this as soon as i get the time, thanks....
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group